project:android:grouper
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
project:android:grouper [2016/01/03 09:31] – [Conclusion] yan | project:android:grouper [2016/02/14 09:37] (current) – yan | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== CM Grouper from source ====== | ||
+ | Grouper is an N7 tablet with only wifi and without integrated 3G support, that means that [[ https:// | ||
+ | === Useful CM compiling related links === | ||
+ | * [[ http:// | ||
+ | * [[ https:// | ||
+ | |||
+ | ===== Cherry-picking SlimRecents to CM 12.1 ===== | ||
+ | This guide is example of **succesfull cherry-pick** of slightly advanced feature to android OS. Purpose of this guide is to show an easy approach to cherry-picking more complex features in case you have almost no experience with Android, git and programming itself. I would like to declare this approach as **[[https:// | ||
+ | |||
+ | ==== Setting-up enviroment ==== | ||
+ | First you need to set up nice working enviroment (ugly part will come pretty fast). This guide was tested on Nexus 2012 (wifi) (aka grouper) with CM12.1 as source. | ||
+ | * follow [[ https:// | ||
+ | * dont forget to [[ https:// | ||
+ | * try to compile clean code (without cherry-pick) first and **test it on your device** , if something doesnt work try to read [[ https:// | ||
+ | |||
+ | ==== Find commit you want to cherry pick ==== | ||
+ | * In our case it is [[ https:// | ||
+ | * It is very helpful to see this commit already cherry-picked in another project, in my case I used [[ https:// | ||
+ | b059e | CarbonROM ]] as guides. Best scenario is to find ROMs which are very similar to your source code (so with almost no features implemented). | ||
+ | * By checking commited files history it is obvious that they performed clean-up after cherry-pick: | ||
+ | f94ed | CR cleanup ]] in CR they cleaned up after more commits, so there is some unrelated stuff too. | ||
+ | |||
+ | ==== Getting new repo ==== | ||
+ | If you read [[https:// | ||
+ | |||
+ | Add frameworks_opt_cards repo: | ||
+ | you need to edit **~/ | ||
+ | |||
+ | * First add SlimRoms remote | ||
+ | < | ||
+ | 1 <?xml version=" | ||
+ | 2 < | ||
+ | 3 | ||
+ | 4 < | ||
+ | 5 fetch=" | ||
+ | 6 review=" | ||
+ | 7 revision=" | ||
+ | 8 | ||
+ | 9 < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | |||
+ | .... | ||
+ | .... | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | * Than you can easily add frameworks_opt_cards repo | ||
+ | < | ||
+ | |||
+ | .... | ||
+ | .... | ||
+ | .... | ||
+ | 594 < | ||
+ | 595 < | ||
+ | 596 < | ||
+ | </ | ||
+ | |||
+ | ==== Cherry pick ==== | ||
+ | Now comes the first attempt to cherry pick slimrecents commit from SlimRoms following [[http:// | ||
+ | < | ||
+ | $cd ~/ | ||
+ | $git fetch https:// | ||
+ | </ | ||
+ | It should take some time.. | ||
+ | After we fetch the repo it's finally time to perform cherry-pick | ||
+ | |||
+ | < | ||
+ | $git cherry-pick 2b4aea893a916cf7f60b3c809f5a7bc616041058 | ||
+ | </ | ||
+ | |||
+ | After few seconds you should get something that looks approximately like this | ||
+ | < | ||
+ | error: could not apply 2b4aea8... Frameworks: Slim Recents app screen (1/2) | ||
+ | hint: after resolving the conflicts, mark the corrected paths | ||
+ | hint: with 'git add < | ||
+ | hint: and commit the result with 'git commit' | ||
+ | </ | ||
+ | |||
+ | Git told you by this that there are some conflicts which need to be resolved manually. | ||
+ | |||
+ | By typing | ||
+ | < | ||
+ | $git status | ||
+ | </ | ||
+ | |||
+ | You get long list of changes to be commited and on the bottom there are few files in red color, in this case: | ||
+ | |||
+ | < | ||
+ | Unmerged paths: | ||
+ | (use "git add/rm < | ||
+ | |||
+ | both modified: | ||
+ | deleted by us: core/ | ||
+ | both modified: | ||
+ | both modified: | ||
+ | deleted by us: packages/ | ||
+ | both modified: | ||
+ | both modified: | ||
+ | </ | ||
+ | |||
+ | In these files you need to resolve conflicts manually. | ||
+ | |||
+ | ==== Resolving conflicts ==== | ||
+ | |||
+ | * **both modified: | ||
+ | < | ||
+ | <<<<<<< | ||
+ | 283 ======= | ||
+ | 284 | ||
+ | 285 /** | ||
+ | 286 * Toggle global menu | ||
+ | 287 * | ||
+ | 288 * @hide | ||
+ | 289 */ | ||
+ | 290 void toggleGlobalMenu(); | ||
+ | 291 | ||
+ | 292 /** | ||
+ | 293 * Get current system ui visibility mode. | ||
+ | 294 * | ||
+ | 295 * @hide | ||
+ | 296 */ | ||
+ | 297 int getSystemUIVisibility(); | ||
+ | 298 >>>>>>> | ||
+ | 299 } | ||
+ | </ | ||
+ | |||
+ | Probably no big deal, lets try to implement those few lines, probably no one gets hurt. | ||
+ | |||
+ | * **deleted by us: core/ | ||
+ | When you look into file you see some symbol definitions, | ||
+ | |||
+ | * **both modified: | ||
+ | < | ||
+ | 13 <<<<<<< | ||
+ | | ||
+ | 15 ======= | ||
+ | | ||
+ | 17 >>>>>>> | ||
+ | </ | ||
+ | |||
+ | It looks like that in slimrecent they dont use org.cyanogenmod.platform.sdk package (how unexpected.. ) and in SR they need android-opt-cards (which author mentioned in the initial commit for SlimRecents). Let both live freely. | ||
+ | |||
+ | * **both modified: | ||
+ | < | ||
+ | 326 <<<<<<< | ||
+ | 327 ======= | ||
+ | 328 | ||
+ | 329 < | ||
+ | 330 < | ||
+ | 331 < | ||
+ | 332 < | ||
+ | 333 | ||
+ | 334 < | ||
+ | 335 Must be minimum 1 and maximum 10 (See @EdgeServiceConstants.java). | ||
+ | 336 | ||
+ | 337 < | ||
+ | 338 | ||
+ | 339 < | ||
+ | 340 < | ||
+ | 341 | ||
+ | 342 >>>>>>> | ||
+ | </ | ||
+ | |||
+ | That looks interesting, | ||
+ | in [[ https:// | ||
+ | |||
+ | * **deleted by us: packages/ | ||
+ | < | ||
+ | 1 <?xml version=" | ||
+ | 2 <!-- | ||
+ | 3 Copyright (C) 2015 The SlimRoms Project | ||
+ | 4 Copyright (C) 2014 The CyanogenMod Project | ||
+ | 5 | ||
+ | 6 Licensed under the Apache License, Version 2.0 (the " | ||
+ | 7 you may not use this file except in compliance with the License. | ||
+ | 8 You may obtain a copy of the License at | ||
+ | 9 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 17 --> | ||
+ | 18 < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 44 </ | ||
+ | </ | ||
+ | Looks like Cyanogenmod deprecated this config, as we see in [[ https:// | ||
+ | 58# | ||
+ | |||
+ | < | ||
+ | 1 <?xml version=" | ||
+ | 2 <!-- | ||
+ | 3 Copyright (C) 2015 The SlimRoms Project | ||
+ | 4 Copyright (C) 2014 The CyanogenMod Project | ||
+ | 5 | ||
+ | 6 Licensed under the Apache License, Version 2.0 (the " | ||
+ | 7 you may not use this file except in compliance with the License. | ||
+ | 8 You may obtain a copy of the License at | ||
+ | 9 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 17 --> | ||
+ | 18 < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 37 </ | ||
+ | </ | ||
+ | |||
+ | * **both modified: | ||
+ | |||
+ | < | ||
+ | 101 <<<<<<< | ||
+ | 102 ======= | ||
+ | 103 import com.android.systemui.slimrecent.RecentController; | ||
+ | 104 import com.android.systemui.statusbar.phone.NavigationBarOverlay; | ||
+ | 105 import com.android.systemui.statusbar.policy.PieController; | ||
+ | 106 >>>>>>> | ||
+ | </ | ||
+ | |||
+ | RecentControler and NavigationBarOverlay looks valid as it is only thing which was added by [[ https:// | ||
+ | |||
+ | Lets delete the rest. | ||
+ | |||
+ | * **both modified: | ||
+ | |||
+ | < | ||
+ | 486 <<<<<<< | ||
+ | 487 ======= | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 503 >>>>>>> | ||
+ | </ | ||
+ | |||
+ | Here once again - we probably need only SlimRecents related stuff, that means: **USE_SLIM_RECENTS ; RECENT_CARD_BG_COLOR ; RECENT_CARD_TEXT_COLOR** | ||
+ | |||
+ | < | ||
+ | 546 <<<<<<< | ||
+ | 547 ======= | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 559 >>>>>>> | ||
+ | </ | ||
+ | Here it looks like it is little bit out of context (things which are near do not look like related stuff). | ||
+ | |||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 546 <<<<<<< | ||
+ | 547 ======= | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 559 >>>>>>> | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | "if (oldClockView != mClockView)" | ||
+ | |||
+ | From SR source code we can see that it is under **public void onChange(boolean selfChange, Uri uri)** void. | ||
+ | |||
+ | We have **public void onChange** with variable **selfChange** but without variable **uri**, and code uses parameter uri. That means we need to add new void to our source code and put that few lines into it, or try to delete it and see the result. First we try to delete it, if it causes some troubles we could try to implement new onChange function. | ||
+ | |||
+ | * **Now lets try to compile** | ||
+ | |||
+ | < | ||
+ | $ cd ~/ | ||
+ | $ source build/ | ||
+ | $ breakfast grouper | ||
+ | $ croot | ||
+ | $ brunch grouper | ||
+ | </ | ||
+ | |||
+ | after a while.. | ||
+ | |||
+ | < | ||
+ | .... | ||
+ | HOST_OS_EXTRA=Linux-3.13.0-32-generic-x86_64-with-Ubuntu-14.04-trusty | ||
+ | HOST_BUILD_TYPE=release | ||
+ | BUILD_ID=LMY48Y | ||
+ | OUT_DIR=/ | ||
+ | ============================================ | ||
+ | " | ||
+ | make: Entering directory `/ | ||
+ | frameworks/ | ||
+ | make: Leaving directory `/ | ||
+ | |||
+ | #### make failed to build some targets (04:04 (mm:ss)) #### | ||
+ | </ | ||
+ | |||
+ | Little mistake .. | ||
+ | |||
+ | < | ||
+ | $ vi frameworks/ | ||
+ | </ | ||
+ | |||
+ | before: | ||
+ | < | ||
+ | ... | ||
+ | 9 LOCAL_STATIC_JAVA_LIBRARIES := Keyguard \ | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | after: | ||
+ | < | ||
+ | ... | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | * **And again** | ||
+ | < | ||
+ | $ brunch grouper | ||
+ | </ | ||
+ | |||
+ | after a while.. | ||
+ | < | ||
+ | ... | ||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | frameworks/ | ||
+ | |||
+ | make: *** [/ | ||
+ | make: *** Deleting file `/ | ||
+ | make: Leaving directory `/ | ||
+ | |||
+ | #### make failed to build some targets (02:42 (mm:ss)) #### | ||
+ | </ | ||
+ | |||
+ | Looks like slim_symbols.xml need some changes.. | ||
+ | |||
+ | < | ||
+ | $ vi frameworks/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | 1 <?xml version=" | ||
+ | 2 <!-- | ||
+ | 3 /* Copyright 2013-2015, SlimRoms project | ||
+ | 4 ** | ||
+ | 5 ** Licensed under the Apache License, Version 2.0 (the " | ||
+ | 6 ** you may not use this file except in compliance with the License. | ||
+ | 7 ** You may obtain a copy of the License at | ||
+ | 8 ** | ||
+ | 9 ** | ||
+ | 10 ** | ||
+ | 11 ** Unless required by applicable law or agreed to in writing, software | ||
+ | 12 ** distributed under the License is distributed on an "AS IS" BASIS, | ||
+ | 13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
+ | 14 ** See the License for the specific language governing permissions and | ||
+ | 15 ** limitations under the License. | ||
+ | 16 */ | ||
+ | 17 --> | ||
+ | 18 < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 29 </ | ||
+ | </ | ||
+ | |||
+ | this should do the trick.. | ||
+ | |||
+ | * **And again** | ||
+ | |||
+ | < | ||
+ | $ brunch grouper | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | make: *** No rule to make target `/ | ||
+ | needed by `/ | ||
+ | make: *** Waiting for unfinished jobs.... | ||
+ | </ | ||
+ | |||
+ | Lets try if it isnt some compilation garbage.. | ||
+ | |||
+ | < | ||
+ | $ make clean | ||
+ | $ breakfast grouper | ||
+ | $ croot | ||
+ | $ brunch grouper | ||
+ | |||
+ | </ | ||
+ | |||
+ | **and delete all files in ccache** | ||
+ | |||
+ | still same .. lets think for a while.. | ||
+ | |||
+ | **whoops.. we (I) forgot** to sync new repo.. no pain no gain. | ||
+ | |||
+ | == syncing new repo == | ||
+ | < | ||
+ | $ repo sync | ||
+ | </ | ||
+ | |||
+ | |||
+ | == continue with cherry-pick== | ||
+ | now we should be back on track.. | ||
+ | |||
+ | < | ||
+ | $ source build/ | ||
+ | $ breakfast grouper | ||
+ | $ croot | ||
+ | $ brunch grouper | ||
+ | </ | ||
+ | |||
+ | if you really deleted all your ccache and commited **make clean** command now its time for you to grab a beer and have some **[[https:// | ||
+ | |||
+ | < | ||
+ | .... | ||
+ | target Java: SettingsProvider (/ | ||
+ | Install: / | ||
+ | target Static Jar: Keyguard (/ | ||
+ | target Package: Tag (/ | ||
+ | frameworks/ | ||
+ | and does not override abstract method toggleGlobalMenu() in IWindowManager | ||
+ | Note: Some input files use or override a deprecated API. | ||
+ | Note: Recompile with -Xlint: | ||
+ | public class WindowManagerService extends IWindowManager.Stub | ||
+ | ^ | ||
+ | Note: Some input files use or override a deprecated API. | ||
+ | Note: Recompile with -Xlint: | ||
+ | Note: Some input files use unchecked or unsafe operations. | ||
+ | Note: Recompile with -Xlint: | ||
+ | 1 error | ||
+ | make: packages/ | ||
+ | *** [/ | ||
+ | make: *** Waiting for unfinished jobs.... | ||
+ | Warning: AndroidManifest.xml already defines versionCode (in http:// | ||
+ | Warning: AndroidManifest.xml already defines versionName (in http:// | ||
+ | DroidDoc took 17 sec. to write docs to / | ||
+ | make: Leaving directory `/ | ||
+ | |||
+ | #### make failed to build some targets (02:58:55 (hh:mm:ss)) #### | ||
+ | </ | ||
+ | |||
+ | lets check [[ https:// | ||
+ | |||
+ | < | ||
+ | .... | ||
+ | @Override | ||
+ | public float getCurrentAnimatorScale() { | ||
+ | synchronized(mWindowMap) { | ||
+ | return mAnimationsDisabled ? 0 : mAnimatorDurationScaleSetting; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | /* @hide */ | ||
+ | | ||
+ | public void toggleGlobalMenu() { | ||
+ | mPolicy.toggleGlobalMenu(); | ||
+ | } | ||
+ | |||
+ | void dispatchNewAnimatorScaleLocked(Session session) { | ||
+ | mH.obtainMessage(H.NEW_ANIMATOR_SCALE, | ||
+ | } | ||
+ | |||
+ | @Override | ||
+ | public void registerPointerEventListener(PointerEventListener listener) { | ||
+ | mPointerEventDispatcher.registerInputEventListener(listener); | ||
+ | } | ||
+ | |||
+ | ... | ||
+ | </ | ||
+ | |||
+ | lets **add void toggleGlobalMenu()** and see result. | ||
+ | |||
+ | < | ||
+ | frameworks/ | ||
+ | mPolicy.toggleGlobalMenu(); | ||
+ | ^ | ||
+ | symbol: | ||
+ | location: variable mPolicy of type WindowManagerPolicy | ||
+ | Note: Some input files use or override a deprecated API. | ||
+ | Note: Recompile with -Xlint: | ||
+ | Note: Some input files use unchecked or unsafe operations. | ||
+ | Note: Recompile with -Xlint: | ||
+ | 1 error | ||
+ | make: *** [/ | ||
+ | make: *** Waiting for unfinished jobs.... | ||
+ | .... | ||
+ | .... | ||
+ | make: Leaving directory `/ | ||
+ | |||
+ | #### make failed to build some targets (06:25 (mm:ss)) #### | ||
+ | </ | ||
+ | |||
+ | So something in WindowManagePolicy and that GlobalMenu.. | ||
+ | |||
+ | < | ||
+ | $ cd ~/ | ||
+ | $ find . -name WindowManagerPolicy* | ||
+ | ./ | ||
+ | ./ | ||
+ | ./ | ||
+ | </ | ||
+ | |||
+ | Lets look at [[ https:// | ||
+ | |||
+ | < | ||
+ | .... | ||
+ | .... | ||
+ | /** | ||
+ | * Notifies the keyguard to start fading out. | ||
+ | * | ||
+ | * @param startTime the start time of the animation in uptime milliseconds | ||
+ | * @param fadeoutDuration the duration of the exit animation, in milliseconds | ||
+ | */ | ||
+ | public void startKeyguardExitAnimation(long startTime, long fadeoutDuration); | ||
+ | |||
+ | /** | ||
+ | * Toggle global menu | ||
+ | * | ||
+ | * @hide | ||
+ | */ | ||
+ | public void toggleGlobalMenu(); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | just add toggleGlobalMenu as implemented in SlimRom and see what happens. | ||
+ | |||
+ | < | ||
+ | frameworks/ | ||
+ | error: PhoneWindowManager is not abstract and does not override abstract method toggleGlobalMenu() | ||
+ | in WindowManagerPolicy | ||
+ | public class PhoneWindowManager implements WindowManagerPolicy { | ||
+ | ^ | ||
+ | Note: Some input files use or override a deprecated API. | ||
+ | Note: Recompile with -Xlint: | ||
+ | 1 error | ||
+ | </ | ||
+ | |||
+ | Global menu everywhere !!! .. **it is NOT** part of original slimrecents commit -> lets try to get rid of it.. | ||
+ | |||
+ | s&d: | ||
+ | < | ||
+ | $ cd ~/ | ||
+ | $ grep -RE toggleGlobalMenu | ||
+ | core/ | ||
+ | core/ | ||
+ | </ | ||
+ | |||
+ | search is finished, now you juts get rid of it.. | ||
+ | |||
+ | * **and brunch again** | ||
+ | |||
+ | < | ||
+ | Package Complete: / | ||
+ | make: Leaving directory `/ | ||
+ | |||
+ | #### make completed successfully (33:21 (mm:ss)) #### | ||
+ | </ | ||
+ | |||
+ | Now is time for runtime.. | ||
+ | |||
+ | And everything looks like Oook. | ||
+ | |||
+ | ==checking for problems/ | ||
+ | < | ||
+ | $ adb logcat | ||
+ | </ | ||
+ | < | ||
+ | E/ | ||
+ | </ | ||
+ | |||
+ | boot into some official snapsoht: | ||
+ | no errors in the logcat, probably fault on our implementation side. But the feature works, so who cares. When you try to google it, you see that [[http:// | ||
+ | |||
+ | ==== Commiting cherry-pick ==== | ||
+ | < | ||
+ | $ cd frameworks/ | ||
+ | $ git status | ||
+ | $ git add --all | ||
+ | $ git commit | ||
+ | </ | ||
+ | |||
+ | ==== Conclusion ==== | ||
+ | If you went through whole tutorial, you sucesfully implemented SlimRecents to your ROM in [[https:// | ||
+ | * Go through codes and understand a little logic behind whole slimrecent feature | ||
+ | * Try to make some nice settings button to switch between normal Recents and SlimRecents, | ||
+ | * Get rid of error " | ||
+ | |||
+ | |||
+ | ===== Debundling build & GAPPS ===== | ||
+ | Cyanogenmod comes with many bundled features which i never use. If you want to remove them here are list of things which i found to be probably safe to remove. | ||
+ | |||
+ | For further reading [[ https:// | ||
+ | |||
+ | ==== Debundling CM build ==== | ||
+ | |||
+ | i used nice script for finding correct .mk files which needed to be modified (thx. 2 **[[user: | ||
+ | < | ||
+ | grep -RE $UnwantedPackage --include *.mk | ||
+ | </ | ||
+ | |||
+ | **Dont forget to remove already compiled packages in /out directory** | ||
+ | |||
+ | compiled app adresses: | ||
+ | * out/ | ||
+ | * out/ | ||
+ | |||
+ | === ThemeChooser === | ||
+ | |||
+ | * removed vendor/ | ||
+ | * in vendor/ | ||
+ | * [[project: | ||
+ | |||
+ | === Wallpapers === | ||
+ | * in vendor/ | ||
+ | 9 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | === CM related stuff === | ||
+ | |||
+ | * in vendor/ | ||
+ | 147 | ||
+ | 151 | ||
+ | 152 | ||
+ | </ | ||
+ | |||
+ | === SetupWizard & OneTimeInit === | ||
+ | * in build/ | ||
+ | 26 | ||
+ | </ | ||
+ | * in vendor/ | ||
+ | 151 | ||
+ | </ | ||
+ | |||
+ | **Do not forget to**: | ||
+ | * turn settings -> location off | ||
+ | * turn settings -> wifi off | ||
+ | * turn settings -> privacy -> send debug data off | ||
+ | |||
+ | === WAPPushManager === | ||
+ | marked as invasive from: | ||
+ | https:// | ||
+ | |||
+ | * in build/ | ||
+ | 24 | ||
+ | </ | ||
+ | dont forget to delete "/" | ||
+ | |||
+ | ==== Debundling GAPPS ==== | ||
+ | I used [[http:// | ||
+ | |||
+ | After installing GApps zip file through [[https:// | ||
+ | * in / | ||
+ | GoogleCalendarSyncAdapter | ||
+ | GoogleContactsSyncAdapter | ||
+ | </ | ||
+ | |||
+ | * in / | ||
+ | GooglePartnerSetup | ||
+ | GoogleOneTimeInitializer | ||
+ | GoogleFeedback | ||
+ | GoogleBackupTransport | ||
+ | </ | ||
+ | |||
+ | I also tried to remove **SetupWizard** in priv-apps. Result was booting rom which was in pretty unstable state, logcat was still mumbling something about | ||
+ | < | ||
+ | I/ | ||
+ | { act=android.intent.action.MAIN cat=[android.intent.category.HOME] flg=0x10200000 } | ||
+ | </ | ||
+ | |||
+ | And I didnt want to argue with GApps that user setup is really not in progress so i putted SetupWizard back and everything was fine. | ||
+ | |||
+ | in Settings -> Accounts -> Google -> click on your_mail@gmail.com and **Turn Sync OFF**. | ||
+ | |||
+ | === Debundling links, tips & tricks === | ||
+ | |||
+ | * **[[ https:// | ||
+ | * How to get info about app from app ID:< | ||
+ | * [[https:// | ||
+ | |||
+ | |||
+ | ==== Conclusion ==== | ||
+ | Even after all those gently hints to google like "Turn sync off" and removing applications for GoogleSync Google just love to hear from to you, or better interpreted: | ||
+ | |||
+ | ===== Modify Settings(.apk) source ===== | ||
+ | When you modify your rom heavily it is good to accordingly modify Settings.apk. For security enhanced compilations it is fe good to have wifi off at boot time etc. When I was searching for some guide to safe my time spent on project I found only [[ http:// | ||
+ | |||
+ | **interesting file list** | ||
+ | * **Settings layout file** - packages/ | ||
+ | * **Development settings layout file** - packages/ | ||
+ | * **Development settings main file** - packages/ | ||
+ | |||
+ | ==== Removing ThemeChooser from Settings ==== | ||
+ | this thread is continuation of [[project: | ||
+ | |||
+ | First it is necessary to locate ThemeChooser in settings. In Settings it is named Themes as we can see if we open Settings in unmodified android device: | ||
+ | |||
+ | {{: | ||
+ | $ cd packages/ | ||
+ | $ grep -RE Themes | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | </ | ||
+ | |||
+ | Now we know what we want to find: | ||
+ | < | ||
+ | $ grep -RE themes_settings | ||
+ | res/ | ||
+ | res/ | ||
+ | ..... | ||
+ | ..... | ||
+ | ..... | ||
+ | res/ | ||
+ | res/ | ||
+ | grep: .git/ | ||
+ | </ | ||
+ | |||
+ | Little refinement: | ||
+ | < | ||
+ | $ grep -RE themes_settings --exclude-dir=*values-* | ||
+ | res/ | ||
+ | res/ | ||
+ | grep: .git/ | ||
+ | </ | ||
+ | |||
+ | if we open **res/ | ||
+ | |||
+ | commenting out Themes entry will do the trick | ||
+ | < | ||
+ | 118 | ||
+ | 119 < | ||
+ | 120 < | ||
+ | 121 < | ||
+ | 122 | ||
+ | 123 | ||
+ | 124 | ||
+ | 125 < | ||
+ | 126 | ||
+ | 127 < | ||
+ | 128 </ | ||
+ | 129 </ | ||
+ | 130 | ||
+ | </ | ||
+ | |||
+ | and we're done. | ||
+ | |||
+ | ==== Advanced Reboot by default ==== | ||
+ | When I'm using [[https:// | ||
+ | |||
+ | Locate - analogously to themechooser: | ||
+ | < | ||
+ | $ cd packages/ | ||
+ | $ grep -RE Advanced\ reboot --exclude-dir=*values-* | ||
+ | res/ | ||
+ | res/ | ||
+ | grep: .git/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ grep -RE advanced_reboot --exclude-dir=*values-* | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | rebooting into recovery, bootloader or performing a soft reboot</ | ||
+ | src/ | ||
+ | grep: .git/ | ||
+ | </ | ||
+ | |||
+ | this leaves us to: | ||
+ | res/ | ||
+ | |||
+ | After litte research we could find that the're mAdvancedReboot, | ||
+ | mAdvanced reboot is of type SwitchPreference, | ||
+ | |||
+ | after litte research I located those lines: | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | setChecked looks pretty much like something we want to fiddle. | ||
+ | |||
+ | If we look at adb_notify (Debugging notify option) which is **on by default**: | ||
+ | < | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | We can probably figure out what to do: | ||
+ | < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | </ | ||
+ | |||
+ | After compiling with this setting and running we can see that **ADVANCED REBOOT DOES NOT WORK**. If we turn on Developer options we can see that we **Only switched radio button to checked, but leave value of it unchanged**, | ||
+ | |||
+ | After little poking around and finding lot of dead ends i decided to **look to original commits**. I should do that probably on the first place. | ||
+ | |||
+ | Locating original commit: | ||
+ | * search on github for file with lines definitely related to our problematics fe [[ https:// | ||
+ | * [[ https:// | ||
+ | |||
+ | In this case it looks like this commit has a brother somewhere, probably named **[[https:// | ||
+ | |||
+ | After reviewing the code I found few pretty interesting lines in [[https:// | ||
+ | < | ||
+ | 148 | ||
+ | 149 | ||
+ | 150 | ||
+ | 151 | ||
+ | 152 | ||
+ | 153 | ||
+ | 154 | ||
+ | 155 | ||
+ | </ | ||
+ | |||
+ | If we check [[ http:// | ||
+ | < | ||
+ | 148 | ||
+ | 149 | ||
+ | 150 | ||
+ | 151 | ||
+ | 152 | ||
+ | 153 | ||
+ | 154 | ||
+ | 155 | ||
+ | </ | ||
+ | |||
+ | After compilation and testing we find out that **Advanced reboot is ON** even in fact, not only in menu. | ||
+ | |||
+ | ==== Adaptive brightness off by default ==== | ||
+ | I dont know if it works on other devices, but on my N7 this feature drives me mad. It was pretty tricky for me to find this one. | ||
+ | |||
+ | Locate - analogous to themechooser: | ||
+ | < | ||
+ | $ cd packages/ | ||
+ | $ grep -RsE Adaptive\ brightness --exclude-dir=*values-* | ||
+ | res/ | ||
+ | res/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ grep -RsE auto_brightness --exclude-dir=*values-* | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | src/ | ||
+ | </ | ||
+ | |||
+ | closer look on **DisplaySettings.java** | ||
+ | < | ||
+ | ... | ||
+ | 663 if (preference == mAutoBrightnessPreference) { | ||
+ | 664 | ||
+ | 665 | ||
+ | 666 auto ? SCREEN_BRIGHTNESS_MODE_AUTOMATIC : SCREEN_BRIGHTNESS_MODE_MANUAL); | ||
+ | 667 } | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | after unsuccessful attempts to locate something relevant to **SCREEN_BRIGHTNESS_MODE** in Settings.apk I performed search in android source root directory, which aslo found nothing. After a lot of unsuccessful attempts to find source of default settings i finaly found magic keyword **def_screen_brightness_automatic_mode** in < | ||
+ | the problem was that here it was off, but in **overlay**: | ||
+ | < | ||
+ | $ vi device/ | ||
+ | |||
+ | 19 < | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 28 </ | ||
+ | </ | ||
+ | situation was different, when I rewrited true on **line 23** to false it was solved. | ||
+ | |||
+ | ===== Modify Browser(.apk) source ===== | ||
+ | ====Addition of search engine==== | ||
+ | If you're using default browser in **noscript** & **no cookies** setting, you'll find out that when you search by Google it switches to czech mutation if you're connecting from Czech republic. If you switch to DuckDuckGo you'll find out, that search engine is set to javascript version. Solution is addition of search engine to source code. | ||
+ | |||
+ | < | ||
+ | $ cd packages/ | ||
+ | $ grep -RsE DuckDuck | ||
+ | res/ | ||
+ | res/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ vi | ||
+ | .... | ||
+ | 750 </ | ||
+ | 751 < | ||
+ | 752 < | ||
+ | 753 < | ||
+ | 754 < | ||
+ | 755 < | ||
+ | 756 < | ||
+ | 757 < | ||
+ | 758 </ | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ grep -RsE duckduck | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | </ | ||
+ | |||
+ | I've learned by trial and error that you need to add your custom search engine in **all_search_engines.xml**, | ||
+ | < | ||
+ | res/ | ||
+ | res/ | ||
+ | res/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ vi res/ | ||
+ | ...... | ||
+ | 759 < | ||
+ | 760 < | ||
+ | 761 < | ||
+ | 762 < | ||
+ | 763 < | ||
+ | 764 < | ||
+ | 765 < | ||
+ | 766 </ | ||
+ | ...... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ vi res/ | ||
+ | ... | ||
+ | | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ vi res/ | ||
+ | ... | ||
+ | | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | voilà | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ====Addition of browser user-agent==== | ||
+ | There are few predefined spoofed user-agents in browser, this is way how to add one more to them. | ||
+ | |||
+ | changes in short (base dir is ~/ | ||
+ | < | ||
+ | $vi res/ | ||
+ | .... | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ vi src/ | ||
+ | .... | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | 94 | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | $ vi res/ | ||
+ | .... | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | .... | ||
+ | </ | ||
+ | |||
+ | This solution have **three major issues** - you also need to [[ user: | ||
+ | |||
+ | ===== First start traffic analysis ===== | ||
+ | |||
+ | Also cyanogenmod itself want to talk a little bit after first boot even after debundling and turning reports off. | ||
+ | |||
+ | |||
+ | === Recorded HTTP/HTTPS traffic === | ||
+ | < | ||
+ | CONNECT shopvac.cyngn.com: | ||
+ | Host: shopvac.cyngn.com | ||
+ | User-Agent: Dalvik/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | CONNECT account.cyngn.com: | ||
+ | Host: account.cyngn.com | ||
+ | User-Agent: Dalvik/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | CONNECT stats.cyanogenmod.org: | ||
+ | Host: stats.cyanogenmod.org | ||
+ | User-Agent: Dalvik/ | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | GET http:// | ||
+ | User-Agent: Dalvik/ | ||
+ | Host: connectivitycheck.android.com | ||
+ | </ | ||
+ | |||
+ | * **connectivitycheck** remains even after Afwall, but ends after one HTTP response. | ||
+ | * **stats.cyanogenmod.org** and **account.cyngn.com** is produced probably under AppID 1000 (Android system) | ||
+ | |||
+ | === List of experimental setups === | ||
+ | All setups were clean install of custom built CM (configuration - [[project: | ||
+ | |||
+ | After initial boot: | ||
+ | Location service was turned off | ||
+ | Timezone was set to sarajevo | ||
+ | CyanogenMod statistics were turned OFF | ||
+ | in case of AfWall ON setups AfWall was instaled from disc. | ||
+ | |||
+ | In all cases DNS requests were seen. | ||
+ | |||
+ | **AfWall off** | ||
+ | * Starts with connectivitycheck | ||
+ | * Continues with account.cyngn.com: | ||
+ | * shopvac.cyngn.com: | ||
+ | * stats.cyanogenmod.org: | ||
+ | |||
+ | **AfWall on** | ||
+ | * Starts with connectivitycheck (After respond Android does not answer anymore - lot of [TCP Retransmission]) | ||
+ | * Continues with stats.cyanogenmod.org: | ||
+ | |||
+ | **AfWall on, reboot before connect, Kernel Allowed by afwall** | ||
+ | * Connectivitycheck (After respond Android does not answer anymore - lot of [TCP Retransmission]) | ||
+ | * Android System packets blocked by AfWall | ||
+ | |||
+ | **AfWall on, reboot before connect, Kernel Allowed by afwall, Android System Allowed by afwall** | ||
+ | * Starts with connectivitycheck | ||
+ | * Continues with stats.cyanogenmod.org: | ||
+ | * Once again stats.cyanogenmod.org: | ||
+ | * Continues with account.cyngn.com: | ||
+ | * shopvac.cyngn.com: | ||
+ | |||
+ | ** AfWall on, not first boot, everything disabled in afwall ** | ||
+ | * Connectivitycheck still persists. | ||
+ | * Only DNS requests for android ntp server were seen. | ||
+ | |||
+ | ** AfWall on, not first boot, everything disabled in afwall except linux kernel ** | ||
+ | * Connectivitycheck still persists. | ||
+ | * Only DNS requests for android ntp server, and stats.cyanogenmod.org, | ||
+ | |||
+ | === Source search === | ||
+ | only wanted to try it, i was lazy to search whole source code, maybe it could give more hits. | ||
+ | |||
+ | < | ||
+ | ~$ cd android/ | ||
+ | $ grep -RE shopvac\.cyngn\.com | ||
+ | grep: build/ | ||
+ | grep: ndk/ | ||
+ | grep: ndk/ | ||
+ | grep: abi/ | ||
+ | ... | ||
+ | ... | ||
+ | grep: packages/ | ||
+ | grep: packages/ | ||
+ | grep: packages/ | ||
+ | packages/ | ||
+ | grep: packages/ | ||
+ | grep: packages/ | ||
+ | .... | ||
+ | .... | ||
+ | grep: packages/ | ||
+ | grep: packages/ | ||
+ | grep: packages/ | ||
+ | grep: .repo/ | ||
+ | ^C | ||
+ | $ vi packages/ | ||
+ | |||
+ | 100 < | ||
+ | 101 < | ||
+ | 102 < | ||
+ | 103 < | ||
+ | </ | ||
+ | |||
+ | After digging a while few changes from true to false in one AndroidManifest helped a bit: | ||
+ | |||
+ | **~/ | ||
+ | < | ||
+ | 2278 < | ||
+ | 2279 < | ||
+ | 2280 | ||
+ | 2281 | ||
+ | 2282 | ||
+ | 2283 < | ||
+ | 2284 < | ||
+ | 2285 < | ||
+ | 2286 </ | ||
+ | 2287 </ | ||
+ | 2288 | ||
+ | 2289 < | ||
+ | 2290 | ||
+ | 2291 | ||
+ | 2292 | ||
+ | 2293 </ | ||
+ | </ | ||
+ | |||
+ | === LTO - GPS === | ||
+ | New friend emerged after applying fix above: | ||
+ | GET http:// | ||
+ | Accept: */*, application/ | ||
+ | x-wap-profile: | ||
+ | Host: gllto.glpals.com | ||
+ | Connection: Keep-Alive | ||
+ | User-Agent: Android | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | ~/ | ||
+ | ... | ||
+ | Binary file vendor/ | ||
+ | device/ | ||
+ | device/ | ||
+ | device/ | ||
+ | </ | ||
+ | |||
+ | It is [[https:// | ||
+ | |||
+ | Link Adresses: | ||
+ | < | ||
+ | ~/ | ||
+ | NTP_SERVER=north-america.pool.ntp.org | ||
+ | XTRA_SERVER_1=http:// | ||
+ | XTRA_SERVER_2=http:// | ||
+ | XTRA_SERVER_3=http:// | ||
+ | </ | ||
+ | |||
+ | GPS configuration (**LTO OFF/ON**): | ||
+ | < | ||
+ | ~/ | ||
+ | <?xml version=" | ||
+ | <glgps xmlns=" | ||
+ | <!--HAL Confguration | ||
+ | <hal | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | /> | ||
+ | |||
+ | <gll | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | /> | ||
+ | |||
+ | <job id=" | ||
+ | < | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== conclusion ==== | ||
+ | After setting **ReportingService OFF** and **LTO Sync OFF** first time connection of tablet to wifi consist only of connectivitycheck at the start and than dns request for NTP servers (10 minutes cap). (AfWall not installed). Turning off sending statistics in GUI probably restrict amount of statistics traffic slightly down, but to turn it off completely you need to edit according config. GPS on N7 2012 have feature named [[ttps:// |
project/android/grouper.txt · Last modified: 2016/02/14 09:37 by yan