Hi, i find so annoying having to always tap "agree" when enabling Network location checkbox (i automatically enable it with a task together with GPS, when i need it) so I managed to obtain the same result of this Xposed module http://xdaforums.com/xposed/modules/mod-disable-google-location-consent-t2449926, modifing directly the involved file system/app/NetworkLocation.apk of my JB 4.2.2 AOKP based rom (as in AOKP, CM roms you can't install Xposed Framework). tested 3 days on my JB 4.2.2 and using the app "Location test" from Google Play store. I'm sharing my knowledge.
---Always: test it yourself, at your own risk. I don't know if there are memory leaks (don't know exactly what they are but read about them ) or something else like unpredictable crashes. I'm not a developer and i just make small changes to smali code usually---
Instructions:
I took some hints from the source code of this Module and made changes to NetworkLocation.apk (thanks to the authors)
I used the tool dex2jar (https://code.google.com/p/dex2jar/downloads/list) (i find it useful for editing system apks).
Extract it in a folder.
It contains some batch files, you drag and drop files/folders into them and they make their work.
You can also use Apktool, if you prefer (be sure that the file decompiles without errors).
First of all: open NetworkLocation.apk taken from your rom and extract classes.dex (use 7-zip)
Drag and drop classes.dex into d2j-dex2jar.bat, a .jar file will be created. Then drag and drop the created .jar file into d2j-jar2jasmin.bat, a new jasmin folder will be created. Now open this folder and go to com-google-android-location and find 2 files: ConfirmAlertActivity.j and NetworkLocationProvider.j
These jasmin (.j) files are similar to .smali files,
Open them as text and edit as below (be sure to find and edit the correct pieces of code)(edit only the green numbers) :
A) ConfirmAlertActivity.j
1)
(.....)
iconst_1 (instead of iconst_0)
putfield com/google/android/location/ConfirmAlertActivity/mAgreed Z
(.....)
[smali code for those who are using apktool:
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/google/android/location/ConfirmAlertActivity;->mAgreed:Z ]
2)
(.....)
L0:
iconst_1 (instead of iconst_0)
istore 3
goto L1
.limit locals 4
(.....)
[corresponding smali code:
.line 67
:cond_0
const/4 v0, 0x1 ]
B) NetworkLocationProvider.j
(....)
L0:
aload 0
iconst_1 (instead of iconst_0)
invokespecial com/google/android/location/NetworkLocationProvider/setUserConfirmedPreference(Z)V
return
(....)
[in smali:
.line 206
:cond_2
const/4 vX, 0x1 (where X is a number not used elesewhere in the method, for example: v10, v11, ...)
invoke-direct {p0, v6}, Lcom/google/android/location/NetworkLocationProvider;->setUserConfirmedPreference(Z)V ]
Finished!
Now do the inverse process: drag and drop the modified jasmin folder into d2j-jasmin2jar.bat, then the new .jar file into jar2dex.bat.
You will obtain a new classes-jar-blablabla-jasmin.dex file. Rename it classes.dex and use it to replace the classes.dex in the original NetworkLocation.apk (use 7-zip to open the.apk, Winrar might give problems).
Now you have your new NetworkLocation.apk without location consent dialog (automatically agreed). When you replace the old .apk, be sure that the new one has the same permissions of the old one.
I'm attaching the modified NetworkLocation.apk (version 1.1.10) of my android version: Rootbox JellyBean 4.2.2
These instructions won't work with Kitkat but should work at least with android 4.3.
Hope this is useful to someone that can't install this Xposed Module but want the same result!
---Always: test it yourself, at your own risk. I don't know if there are memory leaks (don't know exactly what they are but read about them ) or something else like unpredictable crashes. I'm not a developer and i just make small changes to smali code usually---
Instructions:
I took some hints from the source code of this Module and made changes to NetworkLocation.apk (thanks to the authors)
I used the tool dex2jar (https://code.google.com/p/dex2jar/downloads/list) (i find it useful for editing system apks).
Extract it in a folder.
It contains some batch files, you drag and drop files/folders into them and they make their work.
You can also use Apktool, if you prefer (be sure that the file decompiles without errors).
First of all: open NetworkLocation.apk taken from your rom and extract classes.dex (use 7-zip)
Drag and drop classes.dex into d2j-dex2jar.bat, a .jar file will be created. Then drag and drop the created .jar file into d2j-jar2jasmin.bat, a new jasmin folder will be created. Now open this folder and go to com-google-android-location and find 2 files: ConfirmAlertActivity.j and NetworkLocationProvider.j
These jasmin (.j) files are similar to .smali files,
Open them as text and edit as below (be sure to find and edit the correct pieces of code)(edit only the green numbers) :
A) ConfirmAlertActivity.j
1)
(.....)
iconst_1 (instead of iconst_0)
putfield com/google/android/location/ConfirmAlertActivity/mAgreed Z
(.....)
[smali code for those who are using apktool:
const/4 v0, 0x1
iput-boolean v0, p0, Lcom/google/android/location/ConfirmAlertActivity;->mAgreed:Z ]
2)
(.....)
L0:
iconst_1 (instead of iconst_0)
istore 3
goto L1
.limit locals 4
(.....)
[corresponding smali code:
.line 67
:cond_0
const/4 v0, 0x1 ]
B) NetworkLocationProvider.j
(....)
L0:
aload 0
iconst_1 (instead of iconst_0)
invokespecial com/google/android/location/NetworkLocationProvider/setUserConfirmedPreference(Z)V
return
(....)
[in smali:
.line 206
:cond_2
const/4 vX, 0x1 (where X is a number not used elesewhere in the method, for example: v10, v11, ...)
invoke-direct {p0, v6}, Lcom/google/android/location/NetworkLocationProvider;->setUserConfirmedPreference(Z)V ]
Finished!
Now do the inverse process: drag and drop the modified jasmin folder into d2j-jasmin2jar.bat, then the new .jar file into jar2dex.bat.
You will obtain a new classes-jar-blablabla-jasmin.dex file. Rename it classes.dex and use it to replace the classes.dex in the original NetworkLocation.apk (use 7-zip to open the.apk, Winrar might give problems).
Now you have your new NetworkLocation.apk without location consent dialog (automatically agreed). When you replace the old .apk, be sure that the new one has the same permissions of the old one.
I'm attaching the modified NetworkLocation.apk (version 1.1.10) of my android version: Rootbox JellyBean 4.2.2
These instructions won't work with Kitkat but should work at least with android 4.3.
Hope this is useful to someone that can't install this Xposed Module but want the same result!