How to Control Both Moto G and Moto E LEDs

Notification LEDs offer a great way to check for notification at a glance on the Moto G (2013) and … more

LG G3 Receives Oversharpening Fix via Modified Kernel

Nothing is perfect, as they say. No matter how alluring or seemingly perfect, … more

APKTool Updated with Android Lollipop Support

One of the beauties of Android is the level of flexibility we have over our devices. Whether … more

Lollipop Leak for Sprint Galaxy S5, TWRP for Micromax Canvas Magnus – XDA TV

Android 5.0 Lollipop has been leaked for the Sprint … more

Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[MOD][GUIDE] Disable Google Location consent dialog when enabling network location

OP nopainwithme

22nd June 2014, 07:56 PM   |  #1  
OP Member
Thanks Meter: 12
 
33 posts
Join Date:Joined: Jul 2013
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://forum.xda-developers.com/xpos...nsent-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!
Attached Files
File Type: apk NetworkLocation.apk - [Click for QR Code] (268.2 KB, 36 views)
28th June 2014, 09:33 PM   |  #2  
tdunham's Avatar
Recognized Contributor
TampaBay
Thanks Meter: 19,785
 
8,720 posts
Join Date:Joined: Jun 2008
Donate to Me
More
Would you mind adding the .method headers where the 3 edits are located?
Or please provide stock apk so that I may diff the changes.
The code I am trying to adapt this to is for 4.4.2 and it is very different.
Tnx - TD
29th June 2014, 12:16 PM   |  #3  
tdunham's Avatar
Recognized Contributor
TampaBay
Thanks Meter: 19,785
 
8,720 posts
Join Date:Joined: Jun 2008
Donate to Me
More
Nevermind, I figured it out. Here is the guide I did for 4.4.2 TW for the Galaxy S5.
http://forum.xda-developers.com/show....php?t=2798995
30th June 2014, 12:25 AM   |  #4  
OP Member
Thanks Meter: 12
 
33 posts
Join Date:Joined: Jul 2013
Quote:
Originally Posted by tdunham

Nevermind, I figured it out. Here is the guide I did for 4.4.2 TW for the Galaxy S5.
http://forum.xda-developers.com/show....php?t=2798995

Sorry for the delay, happy you solved it for kitkat!
The Following User Says Thank You to nopainwithme For This Useful Post: [ View ]
12th July 2014, 11:10 PM   |  #5  
Member
Thanks Meter: 6
 
41 posts
Join Date:Joined: Jul 2014
Any more info on how to do this on 4.4, the thread was deleted.

Sent from my One X using XDA Free mobile app
12th July 2014, 11:19 PM   |  #6  
tdunham's Avatar
Recognized Contributor
TampaBay
Thanks Meter: 19,785
 
8,720 posts
Join Date:Joined: Jun 2008
Donate to Me
More
Quote:
Originally Posted by budbay

Any more info on how to do this on 4.4, the thread was deleted.

All of my 4.4.2 guide were moved here:

GALAXY S5 UNIFIED MODS THREAD - GUIDES & LINKS
13th July 2014, 01:23 AM   |  #7  
Member
Thanks Meter: 6
 
41 posts
Join Date:Joined: Jul 2014
Thanks for the info. I am trying to reapply to HTC one x but I don't think I have the GmsCore.apk. I guess I'll keep searching.

Edit- I actually found PrebuiltGmsCore.apk that might be the equivalent

Sent from my One X using XDA Free mobile app
Last edited by budbay; 13th July 2014 at 01:37 AM.

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes