[Q] NlpWakeLock and DozeService - Xposed/Amplify - Nexus 6 Q&A, Help & Troubleshooting

I have 2 questions, but first some background.
I use Project Fi. I'm on the Pure Nexus Rom (8/28 Stable), I have installed Xposed and am using the following modules (Amplify, Greenify, Exchange Security Bypass, and Secure Settings).
1. I used Amplify to block some wakelocks, namely location based services, and anything relating to facebook. I've noticed that, while I'm blocking several wakelocks of the NlpWakeLock (600 seconds), I've started noticing that this wakelock has been held open for a couple minutes at a time. When I look at BBS I see NlpWakeLock (com.google.android.googlequickseachbox.Google App) 20m which is about a little over 1/3 of the time the phone has been unplugged. A reboot did not seem to fix this. My device is not always awake, but it seems when this wakelock gets activated, it's being held open longer than it should.
2. In BBS i'm seeing several different instances of DozeService.xxxxxx, all related to system UI. Not sure why this is, I did not tought this service at all.
Any help would be appreciated. Let me know what additional information may be of help.

Related

[Q] Google Play Services/Now Battery drain observations

So since the latest Google Play Services update, I have been suffering some serious battery drain issues. There are various mentions all around the internet and most point to the issue being 4.2.1, which, we aren't running.
I spent some time over the last few days trying to figure out what the issue is and have some observations. But, for some background, last few days I have been getting no more than 10 hours battery with no more than an hour or two screen time.
Google Play Services is listed as the biggest battery drainer with 49%, so I started looking into that.
First off, I noticed in battery stats that if Wifi is on, the device doesn't deep sleep, even though wifi is set to never on when sleeping, the wifi never turns off and the phone never deep sleeps.
First thing to try was turning off wifi, so, I turned off wifi, straight away, phone deep sleeps again.
Next I began messing with Google related things, first of all I "uninstall updates" on GPlayS, tested with Wifi on, great, no more battery drain, phone sleeps, BUT, phone keeps bugging me with notifications to update.
Next was to update, battery drain returns. So, disable Google Now in its own settings, battery drain remains when on Wifi, however, if I kill "Google Search" after disabling Google Now, the battery drain stops.
Various mention on the internet has attributed it to location history and location services in the "Google Settings" however I have had those disabled for a few days now and they seem not to be the issue in this case.
My conclusion so far is that the link between the latest GPlayS and Google Now is the real killer.
At present, I have Google Now disabled, and no battery drain, Wifi turns itself off as it should and the phone sleeps. This isn't a great solution since I use Google Now regularly.
I'm hoping that unless someone has come up with a realistic solution that doesn't involve disabling services, Google will release an update to fix the issue.
Currently without access to another device other than my N10, I'm unable to test whether this particular version of the issue is specific to the XZ or the GoogleNow/GPlayS versions.
My next test is to install Network Info from F-Droid and Better Battery stats, and see if I can attribute the thing preventing wifi from turning off during sleep, and hence the failure for the device to deep sleep, to a particular activity going on.
Further, I have already tested the GPlayS related services by disabling everything such as Calendar and Contact Sync, disabled all of books, movies, photo sync, disabled Google Plus, none of these had any effect on the issue, which all but rule them out of the equation.
Has anyone else got observations on this, is anyone else suffering the issue, or has anyone got a real solution?
I'm off on Holiday on Saturday and would really like to have access to Google Now back, but not have the battery drain that's going to kill my battery while roaming the streets of Rome without access to a charger.
alias_neo said:
So since the latest Google Play Services update, I have been suffering some serious battery drain issues. There are various mentions all around the internet and most point to the issue being 4.2.1, which, we aren't running.
I spent some time over the last few days trying to figure out what the issue is and have some observations. But, for some background, last few days I have been getting no more than 10 hours battery with no more than an hour or two screen time.
Google Play Services is listed as the biggest battery drainer with 49%, so I started looking into that.
First off, I noticed in battery stats that if Wifi is on, the device doesn't deep sleep, even though wifi is set to never on when sleeping, the wifi never turns off and the phone never deep sleeps.
First thing to try was turning off wifi, so, I turned off wifi, straight away, phone deep sleeps again.
Next I began messing with Google related things, first of all I "uninstall updates" on GPlayS, tested with Wifi on, great, no more battery drain, phone sleeps, BUT, phone keeps bugging me with notifications to update.
Next was to update, battery drain returns. So, disable Google Now in its own settings, battery drain remains when on Wifi, however, if I kill "Google Search" after disabling Google Now, the battery drain stops.
Various mention on the internet has attributed it to location history and location services in the "Google Settings" however I have had those disabled for a few days now and they seem not to be the issue in this case.
My conclusion so far is that the link between the latest GPlayS and Google Now is the real killer.
At present, I have Google Now disabled, and no battery drain, Wifi turns itself off as it should and the phone sleeps. This isn't a great solution since I use Google Now regularly.
I'm hoping that unless someone has come up with a realistic solution that doesn't involve disabling services, Google will release an update to fix the issue.
Currently without access to another device other than my N10, I'm unable to test whether this particular version of the issue is specific to the XZ or the GoogleNow/GPlayS versions.
My next test is to install Network Info from F-Droid and Better Battery stats, and see if I can attribute the thing preventing wifi from turning off during sleep, and hence the failure for the device to deep sleep, to a particular activity going on.
Further, I have already tested the GPlayS related services by disabling everything such as Calendar and Contact Sync, disabled all of books, movies, photo sync, disabled Google Plus, none of these had any effect on the issue, which all but rule them out of the equation.
Has anyone else got observations on this, is anyone else suffering the issue, or has anyone got a real solution?
I'm off on Holiday on Saturday and would really like to have access to Google Now back, but not have the battery drain that's going to kill my battery while roaming the streets of Rome without access to a charger.
Click to expand...
Click to collapse
I shut it off it was draining my battery!
I had the same problem.
And here's a solution for you: Factory data reset
After that there will be no problems with battery drain.
NXT3 said:
I had the same problem.
And here's a solution for you: Factory data reset
After that there will be no problems with battery drain.
Click to expand...
Click to collapse
I did a factory reset and have the problem.
So the amount of battery drain has lowered significantly, but it is still there. I attached a screenshot from before the change and a screenshot from after.
use link 2 sd ( root required ) search at playstore
open it and seacrh google play service
option and sleep it..and u done
echopark15 said:
use link 2 sd ( root required ) search at playstore
open it and seacrh google play service
option and sleep it..and u done
Click to expand...
Click to collapse
it must be a way without root
Update Google play Service to version 5.x

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.NlpNetworkProviderSettingsUpdateReceiver. It listens for the intent android.location.PROVIDERS_CHANGED. The LocationManager API's documentation[2] tells us this:
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.
Click to expand...
Click to collapse
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/comments/1rvmlr/nlpwakelock_and_nlpcollectorwakelock_discussion/
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!
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
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
stumpy352 said:
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
Click to expand...
Click to collapse
That is working for me right now.
Sent from my Nexus 5 using Tapatalk 2
ickboblikescheese said:
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.
Click to expand...
Click to collapse
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.
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.
ickboblikescheese said:
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.
Click to expand...
Click to collapse
So, how should I replicate this? I'm using the Xposed Module that dev posted in your Reddit post.
stumpy352 said:
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
Click to expand...
Click to collapse
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 ----------
natezire71 said:
So, how should I replicate this? I'm using the Xposed Module that dev posted in your Reddit post.
Click to expand...
Click to collapse
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.
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
stumpy352 said:
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
Click to expand...
Click to collapse
Turns out that's exactly how I had set up after all, doh! Thank you.
I have actually been getting really decent battery life, noticeably better than my HTC One, with exactly similar usage patterns and same apps installed etc.
Also, Play Services is not the only app that uses this NlpWakeLock. Facebook also uses it & in my case has the highest time kept awake. I turned off location in chat & noticed that it is much better.
Sent from my Nexus 5 using Tapatalk
That's what I thought too. That could explain why some people have this issue more than others.
Sent from my Nexus 5
ickboblikescheese said:
That's what I thought too. That could explain why some people have this issue more than others.
Sent from my Nexus 5
Click to expand...
Click to collapse
Have you tried the Xposed module that filters wake locks? I've been using it and the NLP counts have drastically dropped
No, not using xposed. I understand that wake locks must occur for accurate location services (otherwise what is doing the reporting). What shouldn't be there is the incredible battery drain. Wake locks don't necessarily mean battery drain. You could have a 1h wake lock and drain 1% battery, or a 5 min wake lock that keeps CPU on high frequency causing a 10% battery drain. I don't mind wake locks as long as battery isn't affected too much.
Sent from my Nexus 5
ickboblikescheese said:
No, not using xposed. I understand that wake locks must occur for accurate location services (otherwise what is doing the reporting). What shouldn't be there is the incredible battery drain. Wake locks don't necessarily mean battery drain. You could have a 1h wake lock and drain 1% battery, or a 5 min wake lock that keeps CPU on high frequency causing a 10% battery drain. I don't mind wake locks as long as battery isn't affected too much.
Sent from my Nexus 5
Click to expand...
Click to collapse
That was the point of this module. https://play.google.com/store/apps/details?id=in.andro.wlt. Take a look and read the description. From my understanding, the location stuff still works--which for me has been the case. However, it stops the unnecessary wakelocks. I would like to believe my battery has improved.
Nice thread!!
I've changed my location settings and I'll report if it works!!!
Thanks!!!
natezire71 said:
That was the point of this module. https://play.google.com/store/apps/details?id=in.andro.wlt. Take a look and read the description. From my understanding, the location stuff still works--which for me has been the case. However, it stops the unnecessary wakelocks. I would like to believe my battery has improved.
Click to expand...
Click to collapse
Please keep us posted on this works out for you, it looks really promising!
the7thson said:
Please keep us posted on this works out for you, it looks really promising!
Click to expand...
Click to collapse
I think it's working.
natezire71 said:
I think it's working.
Click to expand...
Click to collapse
Can you tell us which apps you disabled wake locks for?
Sent from my Nexus 7 using Tapatalk 4

mediaserver, google play services and battery drain

hey everyone. I noticed recently that my battery life on my m7 was really poor. The battery was draining at 6-8% per hour idling in my pocket, so I decided to see what was up. I noticed my cpu usage never went below 80%. I checked my app usage, but nothing specific was showing under battery usage in settings, so I did some googling. I downloaded a bunch of apps including Gsam and better battery life and saw mediaserver was thrashing the cpu nonstop, as well as logcat, and google play services was constantly waking the device.
I tried all sorts of things from the common reboot to adb commands. Finally, I found something that at least partially worked.
I downloaded an app from the play store called system tuner, which let me kill mediaserver, and instantly my cpu usage went from 80% to 7%. logcat also stopped when I stopped mediaserver. I have noticed no side effects from doing this. I hope this can help someone out there.
Now I just need to figure out 2 things:
1) prevent play services from wakelocking (up to 46 times per hour, wow!)
2) automate killing mediaserver on startup, as I noticed the issue returns everytime I reboot the device.
If someone out there can help me, it would be appreciated, and if I find out on my own, I will share this info here for all the people with the same problem.
EDIT: I found an app called mediaserver killer, which didn't work at first, but after updating my play store opened just fine. I set it to kill mediaserver on screen on, and hid the toast and app icon, which is about as automated as its gonna get.
play services is still wakelocking the device a lot, but much less since the update. I'm just going to call it a day and move on.

XT1064 Android 6.0 will not go into deep sleep, CPU stuck awake

I have a Moto G 2014 (XT1064) running Android 6.0 that will not go into deep sleep. I could see that the CPU was never going into the deep sleep state even when the phone was not being used and no user apps were actively running in the background. This is causing abysmal battery life as expected. The phone was updated to Android 6.0 via regular OTA updates. I haven't flashed any third party ROMs onto it at all since I bought it.
The first thing I did to investigate was to unlock the bootloader (it was still locked since purchase prior to this) so that I could obtain root access to see what was going on. This also had the additional affect of wiping the phone to stock Andoird 6.0, which I had hoped would maybe solve the problem but it did not.
My first thought was that it was a user app that was holding a wakelock keeping the phone awake. I looked at the user and kernel wakelock counts via BetterBatteryStats and WakeLockDetector, but from what I can tell it is not any user app that is holding a wakelock at all. Instead it must be some kernel level app keeping the CPU awake, but I can't determine what it is. There isn't any single entry in the wakelock list that sticks out as the culprit.
I have done some other investigative tests such as turning WiFi off while the phone sits unused overnight. This did not have any effect as the phone still remained awake the whole time. I also repeated this test with the phone in airplane mode (WiFi + cellular radios off) and again it had no affect. From this I could only conclude that it was not the wireless radios that were keeping the phone awake. The wakelock counts also didn't show any evidence that WiFi, cellular or GPS were holding wakelocks.
Here are two screenshots I took of the BetterBatteryStats and WakeLockDetector apps showing the highest count kernel wakelocks over a roughly 17 hour period:
(I'd link them in properly but I am prevented from posting outside links on this forum until I have 10 cumulative posts...)
i.imgur.com/nPAY3S6.png
i.imgur.com/5VfgFv1.png
You can see that the phone has been awake 96% of the time during this period, and that the highest count kernel wakelocks are from "event8-1877", "event9-1877", "qpnp_soc_wake" and "qpnp-vadc-e4a28400". I could not find any information as to what these entries mean or what they're related to. Whatever they are, they appear to have abnormally large wakelock counts which leads me to believe that they are related to this problem. The other thing that puzzles me is that the total time for the top four entries in that list only sum to about 2 hours, yet the phone has been awake for almost 17 hours within the same period.
If anyone has any idea about this I'd appreciate the help. I may be completely wrong about the root cause here but I'm running out of ways to debug this.
Updating this thread to say that I have also tried re-flashing stock Android 6.0 using the firmware files linked from this thread (in my case I used XT1064_TITAN_RETCA_6.0_MPB24.65-34_cid14_CFC.xml since I am in Canada). I still experienced the same behaviour where the phone would rarely enter deep sleep. It seemed to be marginally better after re-flashing, going into deep sleep about 10% of the time over a 12 hour period or so, where as before it was only going into deep sleep about 4% of the time during the same period. This still doesn't solve the problem though.
Now I am thinking about downgrading to stock Android 5.0.2 and see if that fixes the problem since I don't know how else to diagnose this.

[Q] Location always running

Hi fellows,
Whenever I look into AppOps, Location is ALWAYS running for Android System and Google Play Services.
It doesn't matter if GPS is on or off, neither running in Safe Mode helps - always running. If I force-kill Google Play Services then it stops running Location, but starts again as soon as any app triggers it (Maps or anything else). I'm using Location in 'device only' mode. To be honest for some reason I cannot select any other option.
I'm running my Z3c on Stock MM .575, rooted, manually debloated (maybe too hard?), with some Xposed modules. (Just to make it clear, I turned off every possible syncing, scanning, location reporting, location history, google now, what have you)
Is there a way to see what process/app triggers Location constantly? I know that probably factory reset is a good thing to try, but I'd rather like to avoid that I'm attaching some screens with battery stats and wakelocks. They were taken after a night, unplugged and idle. The battery drain is not a problem, GSam is also not reporting GPS usage. However it shows that the phone is 'active' quite often, two times even woke up from Doze. I don't know how that corresponds to the data from Wakelock Detector (attached as well).
Any ideas?
(fixed images)

Categories

Resources