5,605,120 Members 36,566 Now Online
XDA Developers Android and Mobile Development Forum

NlpWakeLock and NlpCollectorWakeLock Discussion

Tip us?
 
DoesntPostAThing
Old
(Last edited by DoesntPostAThing; 2nd December 2013 at 07:13 AM.)
#1  
DoesntPostAThing's Avatar
Senior Member - OP
Thanks Meter 1436
Posts: 1,977
Join Date: Nov 2012
Location: Vancouver
Battery Full NlpWakeLock and NlpCollectorWakeLock Discussion

Firstly, this is not another thread to complain about your horrible battery life due to Google Play Services. I'm tired of those (mostly on Reddit, but some here too. Either way, none of that here ). This is instead to try and find a root cause for it. "It's Google's fault" is not good enough for me, and if you truly care about your battery life it shouldn't be for you either. If all you're after is an easy way out to get your battery life back, then this thread is not for you. We're here to reach a solution where you can get location services and good battery life. I've done if before, on my Galaxy Nexus on 4.3, but it seems that something is wrong in KitKat. Let this be a place where we all dig deeper into this issue, perform tests, gather results, and then share and discuss them. Here's what I've got so far:

The wakelocks that cause this battery drain are NlpWakeLock and NlpCollectorWakeLock. Nlp stands for network location provider. As you may know, Android provides developers with two ways of gathering location information. One is through the GPS_PROVIDER, which uses the GPS, and the other is through NETWORK_PROVIDER, which uses cell towers and WiFi APs to get your position. According to their developer website[1] , NETWORK_PROVIDER uses less battery, is faster, but is less accurate. GPS uses more battery, takes longer, but is good if you want an accurate location. I'm assuming this particular wakelock uses NETWORK_PROVIDER.

I also did some digging using ROM Toolbox Pro's autostart manager. My guess was that Google Play Services must be triggered every time a certain intent is broadcasted, since nothing obvious is telling it to run. Turns out there are quite a few. 30, to be exact. However, many of them have to do with GCM and we don't really care about those. One of particular interest is one called com.google.android.location.internal.NlpNetworkPro viderSettingsUpdateReceiver. It listens for the intent android.location.PROVIDERS_CHANGED. The LocationManager API's documentation[2] tells us this:

Quote:
Broadcast intent action when the configured location providers change. For use with isProviderEnabled(String). If you're interacting with the LOCATION_MODE API, use MODE_CHANGED_ACTION instead.
I'd assume that this means when you change your location providers, such as enabling/disabling data, WiFi, GPS, etc.

However, location reporting only seems to use network location. If you're on KitKat, go to the location settings and choose device only. Then choose battery saving. It asks you to accept location reporting. Same thing when you choose high accuracy. What do both of those have in common? Network location. You can switch between those two as much as you want and it won't ask you to accept again. However, once you switch to device only and back it will ask you. This shows that it only uses network location.

I find that Google (Play) Services has 5% (+/- 1%) keep awake. Tested on both Nexus 5 running KRT16M and Galaxy Nexus running JWR66V. Both use a certain time of GPS, although that number is never increasing. I assume this is some sort of initial one-time lock. It can be disregarded.

One more thing I noticed is that this Google Play Services issue is much more prominent on KitKat. While they have happened before, often times a simple Play Store update would fix it. This time it seems to be location based. Guess what changed in KitKat? The way you deal with location settings. It may be that the way location settings are grouped in KitKat cause that intent to keep firing, and that in turn triggers something that eventually ends up being what you see as NlpWakeLock.

What I'm going to try next is disabling that intent receiver and then monitor that wakelock as well as if location reporting still works. Feel free to play around, and be sure to share your results.

To those who are suffering from these wakelocks, could you please share your settings? Such as what type of location mode you have (high accuracy, battery saving, device only), WiFi on or off, data on or off, signal strength, WiFi always scanning, Play Store and Play Services version, what device you have, Android build number, and what ROM/kernel you're using if you are using one? Any other info such as screenshots of battery screen, betterbatterystats, wakelock detectors, etc. will all be welcomed.

Here is the Reddit thread I created discussing the same issue: http://www.reddit.com/r/Android/comm...ck_discussion/
Check out my apps:

All apps


Pedometer: (FREE | PRO | XDA)


Owner of a 32GB black Nexus 5 running ParanoidAndroid with ElementalX kernel
The Following 18 Users Say Thank You to DoesntPostAThing For This Useful Post: [ Click to Expand ]
 
a senile fungus
Old
#2  
a senile fungus's Avatar
Senior Member
Thanks Meter 622
Posts: 1,396
Join Date: May 2010
I don't have this device, nor do I know if I'll be getting it, but I must say that I applaud your method.

Bravo!
 
stumpy352
Old
#3  
stumpy352's Avatar
Senior Member
Thanks Meter 940
Posts: 996
Join Date: Sep 2011
I just turn location reporting off then select 'battery saving' setting & accept the request for reporting when it pops up. This allows you to use network location without logging. Google now & maps work fine although not quite as accurate. I just turn on gps if i need navigation. Never get more than 2% usage from play services & it's giving me a total kept awake time of about 28mins out of 12hrs of use with 3hrs screen on time.

Sent from my Nexus 5 using Tapatalk
 
tylerdurden83
Old
#4  
Senior Member
Thanks Meter 141
Posts: 772
Join Date: May 2011
Location: Rome
If I disable the wifi and 3g, leave my phone on battery saving location, google location set to on, it is using wifi always scanning only and it didnt consume 1% battery in a whole night
 
HB_Mosh
Old
#5  
HB_Mosh's Avatar
Senior Member
Thanks Meter 10
Posts: 133
Join Date: Jun 2012
Location: Bogota
Quote:
Originally Posted by stumpy352 View Post
I just turn location reporting off then select 'battery saving' setting & accept the request for reporting when it pops up. This allows you to use network location without logging. Google now & maps work fine although not quite as accurate. I just turn on gps if i need navigation. Never get more than 2% usage from play services & it's giving me a total kept awake time of about 28mins out of 12hrs of use with 3hrs screen on time.

Sent from my Nexus 5 using Tapatalk
That is working for me right now.

Sent from my Nexus 5 using Tapatalk 2
Proud owner of :
Galaxy Ace | Nexus 4 | NEXUS 5
Galaxy Tab 2 7.0
 
iammuze
Old
#6  
Senior Member
Thanks Meter 37
Posts: 105
Join Date: Jul 2008
Quote:
Originally Posted by ickboblikescheese View Post
To those who are suffering from these wakelocks, could you please share your settings? Such as what type of location mode you have (high accuracy, battery saving, device only), WiFi on or off, data on or off, signal strength, WiFi always scanning, Play Store and Play Services version, what device you have, Android build number, and what ROM/kernel you're using if you are using one? Any other info such as screenshots of battery screen, betterbatterystats, wakelock detectors, etc. will all be welcomed.
I am experiencing this issue on my Nexus 5, as confirmed by betterbatterystats (NlpCollectorWakelock 5.5% awake time)

ROM: CyanogenMod 11 alpha

Build Number: KRT16S

Location Mode: High accuracy

Location Reporting: Off

WiFi On: Sometimes

Play Store Version: 4.4.22

Play Services Version: 4.0.34


This issue first appeared for me the other day. I noticed that my device was not appearing in the online Android Device Manager, nor the desktop version of the Play Store. To fix the ADM issue, I disabled remote wipe, cleared data for Play Services, reenabled remote wipe, and rebooted. To fix my device not appearing in the Play Store, I cleared data for the Play Store app. Both issues were thereafter resolved, but now I am experiencing the Network Location battery drain.

Is it possible the problem is related to requests from Android Device Manager? I was under the impression that location for that purpose was 'on demand' instead of logged, but what do I know.

Thanks for doing this! Others, please feel free to use my comment as a template, and post your own data.
nexus 5 - cm11
nexus 7 2012 - stock 4.4
woot android.
 
DoesntPostAThing
Old
(Last edited by DoesntPostAThing; 3rd December 2013 at 01:32 AM.)
#7  
DoesntPostAThing's Avatar
Senior Member - OP
Thanks Meter 1436
Posts: 1,977
Join Date: Nov 2012
Location: Vancouver
So I was playing around with autostart, and I accidentally caused a bunch of FCs for Play Services. Ended up freezing/defrosting and then uninstalling updates then let it update itself, and I noticed this (may or may not have anything to do with what I did): Even though it wakelocks, it barely uses up any batter. I was in an area of 2-3 bar HSPA+, with sync on, location reporting on at high accuracy, etc. and it drained 1% per hour. Still kept phone awake ~5% of the time, but battery usage was significantly better over what I recorded to be 4.8%/hour from last Friday.

EDIT: The only other change I can think of making is temporarily freezing Cerberus. I'll have to look more into that. However, check which apps are requesting your location. The new location settings in KitKat make this simple enough. For me it's only Google Now and Google Play Services, and whatever app that happens to require GPS such as camera (geotagging) and maps.
Check out my apps:

All apps


Pedometer: (FREE | PRO | XDA)


Owner of a 32GB black Nexus 5 running ParanoidAndroid with ElementalX kernel
 
natezire71
Old
#8  
natezire71's Avatar
Senior Member
Thanks Meter 281
Posts: 1,210
Join Date: Mar 2010
Quote:
Originally Posted by ickboblikescheese View Post
So I was playing around with autostart, and I accidentally caused a bunch of FCs for Play Services. Ended up freezing/defrosting and then uninstalling updates then let it update itself, and I noticed this (may or may not have anything to do with what I did): Even though it wakelocks, it barely uses up any batter. I was in an area of 2-3 bar HSPA+, with sync on, location reporting on at high accuracy, etc. and it drained 1% per hour. Still kept phone awake ~5% of the time, but battery usage was significantly better over what I recorded to be 4.8%/hour from last Friday.
So, how should I replicate this? I'm using the Xposed Module that dev posted in your Reddit post.
MotoX, KitKat
Nexus7.2, KitKat
 
the7thson
Old
#9  
Senior Member
Thanks Meter 38
Posts: 452
Join Date: Sep 2008
Location: Denver, CO
Quote:
Originally Posted by stumpy352 View Post
I just turn location reporting off then select 'battery saving' setting & accept the request for reporting when it pops up. This allows you to use network location without logging. Google now & maps work fine although not quite as accurate. I just turn on gps if i need navigation. Never get more than 2% usage from play services & it's giving me a total kept awake time of about 28mins out of 12hrs of use with 3hrs screen on time.

Sent from my Nexus 5 using Tapatalk
How do you do this exactly? If I turn location reporting off, then I can't select the battery saving method because it's greyed out. This also causes location based cards to stop working on Google Now and Maps can't locate me either.

---------- Post added at 11:24 PM ---------- Previous post was at 11:19 PM ----------

Quote:
Originally Posted by natezire71 View Post
So, how should I replicate this? I'm using the Xposed Module that dev posted in your Reddit post.
Use Titanium Backup to FIRST backup Google Play Services. Then use it to uninstall GooglePlay Services. Then open Google Now or Maps, they will ask you install Google Play Services and take you to the app store.

If anything goes wrong, use Titanium to restore.
The Following User Says Thank You to the7thson For This Useful Post: [ Click to Expand ]
 
stumpy352
Old
#10  
stumpy352's Avatar
Senior Member
Thanks Meter 940
Posts: 996
Join Date: Sep 2011
You need location toggled on. Go down to location services & click on Google Location Reporting. Select off for both settings. Then go back out & select battery saving mode & accept the terms.

Sent from my Nexus 5 using Tapatalk

The Following User Says Thank You to stumpy352 For This Useful Post: [ Click to Expand ]
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes