yashsingh1/xdaforums huggingface dataset:
[Nexus 5 General] radko93:
Recently Foursquare launched a new feature that check your location even if the app is closed to send notifications with tips and recommendations. You can turn it off somewhere in settings.

I bought my SGS4 recently and I have problems with Nlpwakelock and Play services from the begging.

I already tried changing stock Touchwiz roms (Android 4.3) and now I'm on stock android 4.4 rooted. I already tried: turning off location reporting, location history, Android Device Manager, Google Now, disabling and reinstalling Maps. I deleted Play Store services (in Titanum backup, not disabled but deleted) and downloaded them again. I tried to delete my Google account and reinstall all Google Apps. The only way to stop those wakelocks for me is to disable Network Location, but I rely on this and don't want to lose it. Any help? It's really frustrating. Could it be a hardware issue? Or third party app?
[Nexus 5 General] ratson:
4.4.1 resolved the issue for me. I got location sharing on and battery time is fantastic :)
[Nexus 5 General] biggaboss:
Excuse my ignorance... but where/how do you turn this off?
[Nexus 5 General] biggiestuff:
When you go into Google now click the 3 dot menu on the traffic update. Just click no when it asks you if you want to keep track of your commute. Same for weather.
[Nexus 5 General] jdec529:
Is anyone still having issues with Google services being a large hit to battery due to the nlp wakelocks.
[Nexus 5 General] irmantas:
Yes, Google Services are hungry today
[Nexus 5 General] Ohgami_Ichiro:
MyTmobile has ALWAYS been a Battery hog ever since the Cupcake/Donut days. Usually it has to do with the Battery Saver (ironically). Turn Battery Saver off and the usage goes down conciderably.
[Nexus 5 General] xybur:
I had a weird wakelock the other day, I've read its related with turning off location services entirely.

This was the result (please forgive the darkness of the images, I had Lux in night mode since it was late when I capped the images):

Also, I've noticed wifi being on drains a considerable amount of battery. At 100%, I left my phone unplugged at 1 am and fell asleep. I let the phone do its thing after a reboot, and I had a 9% drain in battery over the course of about 6 hours while I was asleep. Which seems pretty high to me.
[Nexus 5 General] muyoso:
I had that entriesRefresh wakelock on my Nexus 7. I found that as soon as I disabled Location Reporting it would get that wakelock, and as soon as I enabled location reporting it would go away.
[Nexus 5 General] xybur:
Well, as you can see I lost a considerable amount of battery while the wakelock was active. Something like 63% over the course of 4-5 hours.

I guess I'll keep location reporting on to not have that happen again.

I also took the tips of removing the traffic and weather updates from Google Now, and hoping that'll help a bit.
[Nexus 5 General] xybur:
Well that clears up a lot. Thanks
[Nexus 5 General] razholio:
I tried uninstalling Google play services with tibackup as someone suggested, and I accidentally got the play store the first time. I restored the play store from backup, but now it FC's whenever I launch it. I've wiped data on it, wiped and restored play services, but nothing works. I've got xposed installed and had xprivacy, but temporarily disabled it.

Anyone gotten outta this before?
[Nexus 5 General] yaytzo:
Yes. By factory restore... Hopefully you could find a better workaround.
[Nexus 5 General] javacody:
Reflash system.img. Just back up anything on your SD card first.
[Nexus 5 General] razholio:
That's what I'm doing now (boot too cause I had Franco kernel on there). I've done a few backup and restore it twrp and not yet had an issue with the SD card. Hell, that's where the backups are stored! :)

---------- Post added at 09:23 AM ---------- Previous post was at 08:58 AM ----------

That's what I'm doing now (boot too cause I had Franco kernel on there). I've done a few backup and restore it twrp and not yet had an issue with the SD card. Hell, that's where the backups are stored! :)

This post failed, and in the meantime I did a full backup of fubar system, restored pre-fubar system and boot, reinstalled Franco kernel and xposed and xprivacy. I can confidently say that the system restore fixed my issues with the play store. Thanks for the help, guys. I'm so glad I'm passed the days of factory resets now that I have TWRP and nandroids.
[Nexus 5 General] PhilipL:
Hi

Just to add an interesting theory I read over on Google posts regarding battery stats now being hidden and generally inaccessible (unless a few tricks are used on a rooted device.) Google have said these have been taken away due to security, and the code shows reference to an internal tracking note detailing why but this isn't public. What security risk is there in exposing battery consumption data? Mmmm, exactly.

The speculation is Google want to hide as much as possible all these wake-locks and background running processes to avoid people asking questions about just what usage Google puts our devices to even when we are not actively using them. They obviously don't want people easily identifying Google causing the power drain and then turning services off.

While of course these are smart phones, and we (well Google have encouraged) us to want things location based, and some of us will consume this location data, those that aren't using, for whatever reason, all these Google Now cards and navigation but have perhaps location services enabled for local weather reports or just because the default is to have them on, are still enrolled in a fairly considerable amount of data gathering. This equals less battery run-time and more frequent charging.

I think Google need to be more transparent on exactly how often they are waking our devices and what exactly the data is being gathered and give us a more granulated way to opt out. I have no problem with the odd polling for Wi-Fi access points if I'm also getting the benefit of using that service, but to have all that other data gathered for Googles own purposes of data mining or offering traffic information for a subset of people using Google as a car satnav, is taking advantage of the ignorance Google have put us in.

Regards

Phil
[Nexus 5 General] razholio:
I don't doubt it. It's possible this is also an attempt to discourage naive users from attempting to 'fix' battery drain in mostly fruitless and sometimes harmful ways, I tend to think this is google protecting their investment. They pour considerable resources into android development because they gain what is technically a 'botnet' of sorts that they can control (to a certain extent) via play services. If you look at the stock battery stats, however, you can see that usage for 'play services' is still displayed and at least for me yesterday, there was a considerable amount of GPS usage which tells me that they were comparing GPS location data with wifi and/or wireless location data. I actually wouldn't mind this sort of thing if they would allow me to specify when it happens, like only when plugged in...

---------- Post added at 10:34 AM ---------- Previous post was at 10:29 AM ----------

while my own data is purely anecdotal, I would have to say that it syncs up perfectly with what you describe. I get very impressive battery life whilst sitting at home (<1%/hr) even with relatively poor LTE signal, slightly worse at work, and far worse when out and about, especially in the car. I felt pretty sure that in JB I could disable location history and reporting and effectively disable this location tracking and subsequent battery drain, but in KeyLimePie, google seems to be determined to collect this data no matter what the user opts-in to.
[Nexus 5 General] PhilipL:
Hi

Yes it used to be the case that disabling location tracking history was enough to stop this background collection of data, however all this changed with Google's new fused location provider API. The idea being that rather than each app doing their own location collection, it could all go through Googles API. The advantage is it saves multiple apps all doing their own thing and using lots of battery repeating the same requests, in reality what is saved is just used up by Google to collect "current activity" data regardless if we are using that data ourselves or not, Google want it regardless. Botnet is essentially what all our Google devices are and the virus joining us to this Botnet is Google Play Services, which gets silently updated without our knowledge, with money made by Google using data from this collective Botnet.

While we do benefit of course as we get things like Maps and navigation which we don't pay for directly, if we don't use those services, Google is still taking the data from us for it's own benefit and without our knowledge. It costs us time and some money to keep charging our devices, and the inconvenience of finding a phone almost flat is frustrating. No sooner as the manufacturers find ways of increasing battery life, Google just take that increase for themselves by upping sampling rates.

I like Android and Google services, but it does annoy me how they take control of my device and use it as they see fit without being transparent they are doing it.

Regards

Phil
[Nexus 5 General] shreknel:
xposed/'Per App Hacking' attempt

I've set up the xposed 'per app hacking' module up in such a way that it delays the alarms issued by com.google.android.gms (google play services) by a factor of 5. I'm expecting the number of wakeups (wakelocks and associated non-sleep time) to decrease by a factor of 5.

Will report back in a day or two, but maybe others can try the same approach in the meantime...
[Nexus 5 General] the7thson:
Are you using App Settings for this?

And yes please do report back with results :good:
[Nexus 5 General] shreknel:
No, I used Per App Hacking, it supports multiplying the delay of alarms.

The results are disappointing, unfortunately.

I first tried the vanilla per app hacking (enabled on com.google.android.gms) and still got about one alarm per minute (after enabling the module and rebooting, over one hour).

Then, I adapted the module to also hook the 'setExact' and 'setWindow' AlarmManager calls. Measured again with the updated module (replaced module, rebooted, measured for an hour) and unfortunately I got the same results (about one alarm per minute).

I then opted to disassemble the com.google.android.gms apk, but it's really hard to figure out from where the alarms are scheduled (it seems to use 'set' and 'setRepeating' for sdk version 19).

The one thing which I'm not sure about is whether the xposed module should be enabled for another 'app' than 'Google Play Services' (com.google.android.gms).

If anyone has any suggestions, I'm open to try them...

PS: After enabling the XposedBridge.log code in the module, I still didn't get any output in the xposed debug log, which makes me think that it's enabled for the wrong apps...
[Nexus 5 General] benfiller:
Hi,

I have been using App Ops since 2 days and I have disabled 'Location' and 'Keep Awake' of Google Play Services.

I don't have Nlp wakelock et my com.google.androidd.gms alarms have been reduced significantly.

I have seen no drawbacks for now, Maps works correctly, my GCM push notifications works (WhatsApp, Facebook messenger and Hangouts).

Hope it helps some of you ;)
[Nexus 5 General] jtwlbz:
I got it fixed this by disabling google location report and turn off wifi scan
[Nexus 5 General] tylerdurden83:
Well duh, you turned off geolocation and you are surprised that you dont have wakelocks involving locating you anymore?...
[Nexus 5 General] LeoRex:
No need to get fiesty...

In reality, we only have a few options... 1) Disable network location 2) Toggle network location (either programatically or manually) or 3) screw around with the backend and block the wakelocks.

1) sucks.... You lose a lot of the functionality of Google Now and I also think that, at least with 4.4, some apps that had to get location from GPS can now access the location data from GLS.

2) In 4.3, that's possible as the Xposed Module that disables the location consent popup is functional. When you have to deal with that pop-up, (without Xposed or in 4.4), it's a pain in the butt and it won't be a 'hands off' solution....

3) There are a few options out there... Xposed has several modules... one can block an app from throwing a wakelock, the other can fake out specific wakelocks (the latter here is a FAR FAR better option). I've even seen a few ROMs out there that have wakelock blockers built in (I think they were OSE and beanstalk).

Right now, I'm testing option three. I'm using Xposed with Wakelock Terminator on a PA 4.4.2 nightly. I'm blocking the NlpWakelock and NlpCollectorWakelock from Google Play Services and I'm blocking 'EntriesRefresh' and the 'Sidekick_TrafficIntent' wakelocks in Google Search. By the way.. that search refresh was a sneaky bastard. The first time I tried to block Google Play Services from getting ANY wakelocks. Went over like a fart in church. The two NLP wakelocks that were a thorn in my side wen't poof and I thought I was in the clear. Nope, not only had the phone never gone to sleep, a NEW wakelock; EntriesRefresh_wakelock pretty much fired and NEVER cleared and feasted on my battery.. Now must have seen Location on, but without the wakelock, it wouldn't allow it to get a location, so it basically continuously kept trying... with expected results. With Wakelock Terminator (or the baked in wakelock blockers that can pick them individually), things are far more calm.

With the biggest offenders gone, I'll pick off the little fish.... if not for the wifi issues with CM 4.4.2 base code (wlan_* wakelocks are improving, but still a problem) I'd have this thing going into deep sleep quickly, only to wake up when I say so.... the base CM code between 12/16 and 12/24 has greatly improved so I can only assume that things will get tightened up as we go forward... The paint is still wet on 4.4.2, even on the officially supported devices, so I have to accept some stability/performance issues.
[Nexus 5 General] thigger_tom:
I pretty much fixed this on mine by setting 'Location Reporting' off, but leaving 'Location History' on.

Google Now still seems to work fine, including location-based reminders (possibly they take a little longer to trigger? I'm not sure). Battery life is much improved.
[Nexus 5 General] LeoRex:
I've been looking around for a good, in depth overview of the whole process, how things interact, the flow, etc. If I had a good grasp of the inner workings, I think I'd be able to tweak things more effectively.
[Nexus 5 General] the7thson:
Quoting myself to provide an update - the settings above worked 100% well. All my NLP wakelocks are gone and I can pretty consistently get 2 full days of use on my Nexus 5 with my typical usage.

I recommend that you guys try this out as well.
[Nexus 5 General] irmantas:
And how Google Now work and other location based apps?
[Nexus 5 General] the7thson:
Google Now works great, Maps can pick up my location easily without using high accuracy GPS mode, weather widget shows the right place no matter where I go, everything works great :)
[Nexus 5 General] johhn:
my phone is not rooted cos I need barclays online banking app which doesnt support rooted devices.

so any idea what other wakelock apps I can use ?
[Nexus 5 General] JoshuaOrphir:
It work great, thank you! But now my Google maps location isnt that great. It only locate a roughly Position. Around 100 m...do you know a way to fix that?

Gesendet von meinem Nexus 5 mit Tapatalk
[Nexus 5 General] LeoRex:
What mode is location in? Sounds like GPS isn't running. Network location is only as good as Google's location data in your area...not much we can do to fix that.

On the other question, blocking wakelocks is a root only function.

Location Services works fine without wakelocks.. it just won't update when your phone is sleeping. When you go into Google Now and it refreshes, it should be up to date.

Those 'you need to leave by' reminders might not always be up to date since they might fire while the phone is sleeping... I have to figure out a way to resolve that.
[Nexus 5 General] the7thson:
Not sure sorry, I've never owned a phone for more than 5 mins without rooting it :( BUT you can root your phone and hide that fact from your Barclays app by applying the Root Cloak module in Xposed. If you're not sure what that all means, I can walk you through it, send me a PM.

Similar situation for me, but if I'm out and about and need to use Maps, I switch to GPS mode in Location. You can automate that using Tasker if you want so that as soon as you open Google Maps, it will switch to GPS mode. As soon as you exit out of Maps, it will turn off GPS mode. Problem solved :)
[Nexus 5 General] phishstics:
Barclays app working here on Cataclysm.
[Nexus 5 General] ickoicko:
found this and it's about wakelocks so yeah http://xdaforums.com/showthread.php?t=1827676 thought it might help us understand and have a unified answer on how to maximize our battery lives
[Nexus 5 General] johhn:
thanks for the advice but I just read a few posts about getting barclays app to work on a rooted phone, not sure a root-hiding program can do it with the latest 1.7.7 version.

http://xdaforums.com/showthread.php?t=2360053&page=2

looks like the only way to work is to use a hacked and outdated unofficial app which sounds quite unsafe to me.

so how do you manage to get the app to work on a rooted phone?
[Nexus 5 General] phishstics:
Installed this version from the Play Store, nothing else needed and no issues to report. Just opened and checked...Yup my credit card is still maxed.

https://play.google.com/store/apps/details?id=com.barclaycardus
[Nexus 5 General] Remoteconcern:
Different countries app, I think!
[Nexus 5 General] phishstics:
It's the US version and works in the US. So if you're here, something else is wrong. If not, then yes you're correct, it probably won't work for you.
[Nexus 5 General] Remoteconcern:
Yeah I'm not the guy asking the question but he writes like an Englishman and we have Barclay's bank here. :)

Anyway, back on topic.

Can anyone tell me what the impact on Google now is if you don't enable reporting and history? I haven't noticed any, and mine are disabled. Battery drain is night and day though.
[Nexus 5 General] JoshuaOrphir:
hm I set it to high accuracy but it is very slow and very inaccurate..
[Nexus 5 General] LeoRex:
Download a GPS test apps from Play... Might be something up with it.
[Nexus 5 General] JoshuaOrphir:
I have done the same but it dosnt work. It think its an GPS problem, maybe because I used "faster GPS".
[Nexus 5 General] JoshuaOrphir:
Everything works fine now. I messed something in the Google play app ops up. But thanks for your help.
[Nexus 5 General] marinierb:
# XTRA_SERVER_QUERY (1=on, 0=off)
# If XTRA_SERVER_QUERY is on, the XTRA_SERVERs listed
# below will be ignored, and instead the servers will
# be queried from the modem.
XTRA_SERVER_QUERY=0
# XTRA_SERVERs below are used only if XTRA_SERVER_QUERY
# is off.
XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra2.bin
XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra2.bin
XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra2.bin

# Error Estimate
# _SET = 1
# _CLEAR = 0
ERR_ESTIMATE=0

#Test
NTP_SERVER=time.gpsonextra.net
#Asia
# NTP_SERVER=asia.pool.ntp.org
#Europe
# NTP_SERVER=europe.pool.ntp.org
#North America
# NTP_SERVER=north-america.pool.ntp.org

# DEBUG LEVELS: 0 - none, 1 - Error, 2 - Warning, 3 - Info
# 4 - Debug, 5 - Verbose
# If DEBUG_LEVEL is commented, Android's logging levels will be used
DEBUG_LEVEL = 2

# Intermediate position report, 1=enable, 0=disable
INTERMEDIATE_POS=0

# supl version 2.0
SUPL_VER=0x20000

# GPS Capabilities bit mask
# SCHEDULING = 0x01
# MSB = 0x02
# MSA = 0x04
# ON_DEMAND_TIME = 0x10
# GEOFENCE = 0x20
# default = ON_DEMAND_TIME | MSA | MSB | SCHEDULING | GEOFENCE
CAPABILITIES=0x33

# Accuracy threshold for intermediate positions
# less accurate positions are ignored, 0 for passing all positions
# ACCURACY_THRES=5000

################################
##### AGPS server settings #####
################################

# FOR SUPL SUPPORT, set the following
# SUPL_HOST=supl.host.com or IP
# SUPL_PORT=1234
SUPL_HOST=supl.google.com
SUPL_PORT=7275

# FOR C2K PDE SUPPORT, set the following
# C2K_HOST=c2k.pde.com or IP
# C2K_PORT=1234

####################################
# LTE Positioning Profile Settings
####################################
# 0: Enable RRLP on LTE(Default)
# 1: Enable LPP_User_Plane on LTE
# 2: Enable LPP_Control_Plane
# 3: Enable both LPP_User_Plane and LPP_Control_Plane
LPP_PROFILE = 0

################################
# EXTRA SETTINGS
################################
# NMEA provider (1=Modem Processor, 0=Application Processor)
NMEA_PROVIDER=0

##################################################
# Select Positioning Protocol on A-GLONASS system
##################################################
# 0x1: RRC CPlane
# 0x2: RRLP UPlane
# 0x4: LLP Uplane
A_GLONASS_POS_PROTOCOL_SELECT = 0
[Nexus 5 General] JoshuaOrphir:
Thank you! Everything is working fine now :)
[Nexus 5 General] anshmiester78900:
Guys if I turn on Google Now, it will start creating the problem of entries refresh wakelock which doesn't let my phone to go to sleep. Is there any way to correct it ?
[Nexus 5 General] LeoRex:
You come to the right place. :) it all depends on what version of Android you are running and if you are rooted. If you haven't rooted your phone, the only option to eliminate that wakelock is basically to not use Google Now.

But if you are rooted, there are a few options, depending on your version. What are you running?
[Nexus 5 General] anshmiester78900:
I'm running Android 4.4.2 mate. What are my options? :o
[Nexus 5 General] msgfromside3:
Looks like changing the location setting to use gps only gets rid of those two wakelocks. :)
[Nexus 5 General] refinition:
Don't think there are any good ones right now
[Nexus 5 General] the7thson:
That's all fair, but nothing prevents us from wrestling some of this control back from Google over our own phones, which is exactly what we're doing here - many of us successfully I might add.
[Nexus 5 General] PhilipL:
Hi

I quite agree. The more control we can back the better.

At some point I think Microsoft will get hold of all this activity data gathering and use it against Google in the same way they have for Google reading emails.

Regards

Phil
[Nexus 5 General] Enddo:
turning off location reporting and location history did not fix these wakelocks on my device(while my phone is supposed to be in deep sleep). woke my phone up 98 and 46 times just while i was in the shower

im testing right now, but i think it might have to do with battery saver location mode. i have it on device only now, and am testing it with the screen locked. i will report back

edit - this has seemed to fix my wakelocks during temporary testing(20 minutes, like my shower). i kept google now on and location reporting/history with device mode gps and no wakelocks during brief testing. im gonna test device only gps mode vs my battery saver mode during usage as well as a full nights sleep tonight.

i wonder why some people are getting positive results by just turning off location reporting/history, but i did not. maybe it has to do with distance from cell towers or something that keeps my device up on battery saver mode gps
[Nexus 5 General] LeoRex:
Could they just let us pick our update interval????!

Really.... that's all I ask. There is no technical reason, that I can think of, to have Google Now check THAT often.

I know it isn't a bug... It's designed that way. But I like to tinker, and this is a good, juicy, technical problem for me to solve. It's my mana. :)
[Nexus 5 General] Sensamic:
Where are those optiosn to disable location reporting/history? I have my location turned off always. Do I need to do something else to disable those options you mention or disabling location is enough?

Today I woke up and my phone's battery was 0% when last night it was 98%!!! And WIFI was off, sync off, airplane mode on, etc.