Solved

WSA and Wakelocks

  • 30 January 2014
  • 12 replies
  • 51 views

Userlevel 2
Can someone explain "Wakelocks" to me?
 
I recently installed "Wakelock Detector-Save Battery" on my Samsung Note 10.1. After running it for just a couple days, it is reporting that WSA Mobile has the highest number of wakelocks and this accounts for over 42 minutes on my tablet?!  In addition, it's had 342 "wakeup triggers". (This is the second highest number of triggers; second only to Samsung Push Service at 544.)
 
I am assuming that based upon this information that WSA is a rather significant drain on my tablet's battery and I'm wondering if I need to find a different mobile AV?!
 
(PrevxHelp from Wilder's suggested that I post here at the forums.  So, please forgive me if you've already read this post at Wilder's....)
icon

Best answer by nic 6 February 2014, 17:18

View original

12 replies

Userlevel 7
Badge +56
I don't know the answer off the top of my head, but I'll ping some folks here to see if they can find the answer.  I'll post back when I have more info.
Userlevel 7
Hi Alex
 
How are you doing, buddy?
 
Trust you to come up with an interesting question....;)
 
THe best definitions that I have managed to find are as follows (although I suspect that there will be better ones somewhere):
 
SHORT: "A kernel mechanism for Android power management. When a thread holds a wakelock, the kernel will refrain from entering a low-power state."
 
LON(ER): "In order to prolong battery life, over time Android devices will first dim, then turn off the screen,  before turning off the CPU. WakeLocks are a Power Manager system Service feature, available to your applications to control the power state of the host device.

Wake Locks can be used to keep the CPU running, prevent the screen from dimming, prevent the screen from turning off, and prevent the keyboard backlight from turning off.

Creating and holding Wake Locks can have a dramatic influence on the battery drain associated with your application. It’s good practice to use Wake Locks only  when strictly necessary, for as short a time as needed, and to release them as soon
as possible."
 
Hope that helps?
 
Regards
 
 
Baldrick
 
Userlevel 7
Badge +56
So I heard back from one of the folks here.  That amount of activity is normal for WSA Mobile.  Any time you are taking actions that require WSA to become active, such as running a new app or visiting a new website, it will trigger a wakelock to make sure that the device doesn't sleep in the middle of that action.  That doesn't mean that it has woken your device up from sleep though, except for the few times that it is actually downloading definitions or running a general scan.  But the bulk of those wakelocks are happening when the device is already awake and active, so it isn't like it is waking your app up from sleep for all of those times, and therefore it shouldn't be impacting your battery life.  Does that make sense?
Userlevel 2
It makes sense.  However, that doesn't appear to jive with my experience.  
 
Literally, as my tablet sat in my briefcase, the number of wakelocks climbed exponentially.  I would check the number at night before I went to bed and then again the next day at lunch.  The whole time, my tablet sat in my briefcase, unused.  Yet, the amount of time and the total number of wakelocks continued to grow.
 
So, I have tried an experiement.  I actually un-installed WSA from my Android and have installed a different AV product.  I have now run that AV product for 2 days.  I have yet to see that product produce a wakelock?!  I'm going to give it another day or two and then try a 3rd AV product.
 
BTW-I charged my tablet last night and took it off the charger this morning around 7 a.m.  At about 1 p.m., after lunch, I turned my tablet on and found the battery still at 100%.  That was NOT my experience with WSA; I'm sorry.
 
I am 100% sold on the WSA PC AV product.  However, I'm sorry, I am not near as confident in the Android product so far.
Userlevel 7
Badge +56
That does sound unusual.  Let me check with folks here again to see if there is anything else to try to remedy this.
Userlevel 7
Badge +56
Ok, so a few more questions so we can narrow this down:
 
1)  With the other AV product you didn't see any battery drop in the course of a morning of no usage - what sort of battery drop did you see with WSA Mobile installed during an equivalent period of no usage?  Was it a significant difference in percentage drop?
 
2) If the device isn't losing its network connection while it is in your briefcase, it is possible that could cause the app to try and ping the server over and over again, so you could also try leaving it outside the briefcase but in sleep to see if that is the case
 
3) This might be a reach, but if the push notifications are firing so frequently then those could be triggering WSA to take a look and that might extend the amount of time the device is out of sleep.  If you were to turn off the push notifications as an experiment and then leave it unused with WSA installed, do you see the same number of WSA wakelocks?
Userlevel 2
1)  With the other AV product you didn't see any battery drop in the course of a morning of no usage - what sort of battery drop did you see with WSA Mobile installed during an equivalent period of no usage?  Was it a significant difference in percentage drop?
 
I am not seeing any battery drain nor am I seeing ANY wakelocks at all with this different AV.  It's hard to quantify, but if I had to give an estimate, I would say that with WSA installed and the tablet in my briefcase (on, but asleep), I would typically see a 3-5% drop in battery over an 8 hour period (from 100%-95 or 97%).
 
2) If the device isn't losing its network connection while it is in your briefcase, it is possible that could cause the app to try and ping the server over and over again, so you could also try leaving it outside the briefcase but in sleep to see if that is the case
 
I keep my tablet in my briefcase, which I take back and forth to work daily.  I do keep it on, but it is asleep.  (I seldom turn off my tablet.)  So, I would say that traveling from home to work (and vice-versa) that the tablet would lose it's network connection since it is only a wi-fi tablet.
 
3) This might be a reach, but if the push notifications are firing so frequently then those could be triggering WSA to take a look and that might extend the amount of time the device is out of sleep.  If you were to turn off the push notifications as an experiment and then leave it unused with WSA installed, do you see the same number of WSA wakelocks?
 
Since I un-installed WSA, I currently cannot test this.  However, when I re-install WSA, I'll be glad to test this.
 
P.S.  My apologies for the italicised text.  I cannot figure out how to do quotes on this forum....
Userlevel 7
Badge +56
There should be a quote button in the upper right when you post, so that should allow you to quote my posts.  Either way, the italics did the job fine :)
 
From talking to the folks here the 3-5% drop isn't significant enough to be of major concern.  If it was dropping a huge amount then they'd be concerned.  For point 2, once you are at work, it has a connection right?  It isn't like it is sitting there for hours at a time not connected to wifi.  I think once we try the experiment from point 3, that should tell us something more about where the extra wakelocks are coming from.  Are there any other apps that are periodically doing anything while the device is asleep, besides the push notifications?
Userlevel 2
@ wrote:
 
From talking to the folks here the 3-5% drop isn't significant enough to be of major concern.  If it was dropping a huge amount then they'd be concerned.  For point 2, once you are at work, it has a connection right?  It isn't like it is sitting there for hours at a time not connected to wifi.  I think once we try the experiment from point 3, that should tell us something more about where the extra wakelocks are coming from.  Are there any other apps that are periodically doing anything while the device is asleep, besides the push notifications?
Correct, it has a connection when I am at work.  (It automatically connects to my work wifi once I waken it up from being "asleep".)  
 
I re-started my tablet late last night or early this morning.  As of right now, under "wakeup triggers", the Samsung Push Service shows 83 ocurrences.  AirDroid shows 12 ocurrences, and Google search shows 7.  
 
Under CPU wakelock, Amazon Kindle shows 25 seconds, Samsung Push Service shows 22 seconds.  
 
The new AV I installed does not currently show up on either list.  Again, I just want to point out that WSA, when it was installed, was at the top of both lists:  wakeup triggers and CPU wakelock.  And, it was considerably higher than any other listing.
 
I encourage you to install the "Wakelock Detector--Save Battery" app for yourself.  Run it for a day or two and see how WSA fairs compared to the other services running on your device.  I think it will be enlightening.  
 
I will try it again in a couple days to see if there is any change.
 
Thank you for listening and responding.  You guys really are the best.
Userlevel 7
Badge +56
Thanks for the updated info.  I'm on iOS myself, so I don't have a device to test this on, but maybe I can borrow one.
 
I had some an in-depth conversation with one of the QA guys for mobile here, and his question about the other AV was, if it isn't issuing any wakelocks, "maybe it isn't doing anything?" 🙂  
 
I'd be interested to see how many wakelocks there were for WSA now that the Samsung Push Service has dropped down to a more reasonable number.  My understanding is that WSA will be high up because it gets activated whenever any other app is communicating, and it issues its own wakelock just to be sure it gets time to finish its work.  Therefore its wakelocks will be roughly equal to the wakelocks for all the other apps combined.
 
Anyway, keep me posted on what you find out, and I'll see if I can do some informal testing on my end. 
 
Glad to help!
Userlevel 2
@ wrote:
 
I had some an in-depth conversation with one of the QA guys for mobile here, and his question about the other AV was, if it isn't issuing any wakelocks, "maybe it isn't doing anything?" 🙂  
 
I'd be interested to see how many wakelocks there were for WSA now that the Samsung Push Service has dropped down to a more reasonable number.  My understanding is that WSA will be high up because it gets activated whenever any other app is communicating, and it issues its own wakelock just to be sure it gets time to finish its work.  Therefore its wakelocks will be roughly equal to the wakelocks for all the other apps combined.
 
Anyway, keep me posted on what you find out, and I'll see if I can do some informal testing on my end. 
 
Glad to help!
It's kind of funny and/or interesting that you say that.  Here's why:
 
I mentioned earlier that I un-installed WSA and installed a different AV product.  (I'm not sure if I'm allowed to say which one.)  I had it installed for 2 days or so, and as I indicated, I didn't see one wakelock; either cpu or wakeup trigger, the entire 2 days.  
 
So, I then un-installed it and tried a 3rd AV product for a day.  It reacted/responded very much like WSA--both CPU wakelocks and wakeup triggers.  The pattern appeared very similar to WSA.
 
I have now gone back to the second AV for a day and once again not a single wakelock or wakeup trigger.  Now, I've got to wonder as you suggested--is it actually doing anything?!
 
BTW--During all of this, the Samsung Push Service continues to be the "leader" in wakelocks.  Again, I don't fully understand them, but the Samsung Push Service is 10 times higher than anything else.
 
Anyway--I'll move back to WSA soon.  In the mean time, I consider this topic "solved" or answered.  I once agan thank you for your responses and assistance.
Userlevel 7
Badge +56
You can mention the other guys by name if you like, we don't mind :)
 
I borrowed @  's HTC just to see what numbers he got, and it shows 11 wakeup triggers from WSA over the past 3 hours.  Under the CPU Wakelock it shows 15 times, but only for a total of .4s, so the wakelocks must not last very long.  He doesn't have the Samsung Push services, so I don't have anything to compare on that front.  I'm wondering if you can change the settings on the push services to be less often to save on battery life.
 
Anyway, glad you got what you needed and please let me know if you see any other weird behavior when your go back to WSA!

Reply