yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] chamonix:
My understanding of a PWL is whatever happens during the time that wakelock is in place the phone will never go to deep sleep. My understanding is also that this is independent of the fact of the phone going into deep sleep otherwise or not (if I keep using it it won't neither even without wakelock). I remember that from old times working on enabling deep sleep for XDAndroid: there are/were different levels of sleep and the last one was deep sleep. To inter it the kernel first checked for PWLs and only if non were in the status it saved the registers and shut down almost everything for a calculated period of time. So PWLs clearly prevented this from happening but as well did actions preventing the display to switch off (e.g. actual use).

From that the duration of a PWL is indeed not representative for "wasted" power if you measure the time between the "set" and the "release" of the PWL but would be if you time the interval between the first failed deep sleep attempt and the release of the PWL. Now looking at the code below the wakelock time is obtained by the method Timer.getTotalTimeLocked(...). I will have to go through the code that sums the locked time up to see from when to when it spans (that's the source of the batterystats service and is public but quite hard to read).

// Process wake lock usage

Map<String, ? extends Uid.Wakelock> wakelockStats = u.getWakelockStats();

for (Map.Entry<String, ? extends BatteryStatsTypes.Uid.Wakelock> wakelockEntry : wakelockStats.entrySet()) {

BatteryStatsTypes.Uid.Wakelock wakelock = wakelockEntry.getValue();

// Only care about partial wake locks since full wake locks

// are canceled when the user turns the screen off.

Timer timer = wakelock.getWakeTime(WAKE_TYPE_PARTIAL);

if (timer != null) {

wakelockTime += timer.getTotalTimeLocked(uSecTime, which);

}

}

wakelockTime /= 1000; // convert to millis

The test if(timer != null) comes from the original code from the battery stats and suggests that there can be wakelocks without wake time. To come back to your first question that could (but I can not prove it) be wakelocks that never interfered with the phone wanting to sleep. I'll add a trace on that to see if I get some and could even generate some to see what the output looks like.

I found the notion of wakeup at Pkg (package level in BatteryStatsImpl with the not very self speaking comment

Number of things that could wake up the device as of the last run.

I feel pretty uncomfortable interpreting that comment and will have to collect that as a todo.

As I just started trying to understand google's code I won't be able to answer them all but every question is a good entrypoint to an aspect of the code and a good point to start learning.
[Android Apps and Games] brandall:
Thanks for your reply chamonix, would give it two thanks if I could. Very informative and appreciated.

Rather you than me! But if you could pick up on that it would be brilliant.. And perhaps unprecedented it would appear..?

// Process wake lock usage
Map<String, ? extends Uid.Wakelock> wakelockStats = u.getWakelockStats();
for (Map.Entry<String, ? extends BatteryStatsTypes.Uid.Wakelock> wakelockEntry : wakelockStats.entrySet()) {
BatteryStatsTypes.Uid.Wakelock wakelock = wakelockEntry.getValue();
// Only care about partial wake locks since full wake locks
// are canceled when the user turns the screen off.
Timer timer = wakelock.getWakeTime(WAKE_TYPE_PARTIAL);
if (timer != null) {
wakelockTime += timer.getTotalTimeLocked(uSecTime, which);
}
}
wakelockTime /= 1000; // convert to millis

I got confused by the first '//' :eek:

+1//WHOOP!

I'm starting to think they don't want you to find out!? But good spot, despite the rather nondescript description...

Thanks again for sharing your findings and I look forward to the next update!
[Android Apps and Games] bgx:
Looking forward to the next update too! Dsd isn't working at the moment... Everytime I get data wrong ... reseting!

Btw. Very good task for tasker! Keep up the good work!
[Android Apps and Games] brandall:
I hope it will be out later... It's a massive update! Sorry it's not working for you... V9 has error logging so in cases such as yours I will be able to diagnose the problem...

All I can suggest for now is you reboot, which would solve any temporary issues...
[Android Apps and Games] bgx:
Thx brandall! The problem has solved itself. Now its working again! ;-)

One question: In the report witch are the most power hungries calls? The wake calls or the alarms? What's meaning the alarms? Any lecture to read about it?
[Android Apps and Games] mynameisjon:
SGS2 users, when you look at your DSD log, do you notice that com.android.location seems to be waking up your device an awful lot?

of course, that is if you're using location services.
[Android Apps and Games] brandall:
A couple of users have mentioned this before...

Glad it fixed itself! In V8 you can't tell which are individually preventing deep-sleep and therefore more 'power hungry'. The coming later tonight (definitely!) V9 has more comprehensive details of timings, so should make a lot more sense :)
[Android Apps and Games] nobnut:
I saw what you did there ;)

'Fixed itself' vs operator discrepancy aka user error.

V9 sounds like the Daddy.

Sent from my HTC Flyer using vodka
[Android Apps and Games] tommo123:
i have the feeling the answer to this is going to be no, but i'll ask anyway.

is there a way to get tasker to control gps on gingerbread? - without using a cyanogen build? even with root?

i want to be able to enable gps when using google maps and turn it off when leaving the app etc (other apps too). it was really useful when you could do it
[Android Apps and Games] mynameisjon:
Thanks.. sorry that it seems like i didn't search... I search the thread for "location" and it didn't return any relevant hits.. :s

I've been getting this strange message when I wake my phone, something about the data save failing and being reset... Is there a problem? I go to the DSD file and it's the same one that was there before from the previous save.
[Android Apps and Games] nobnut:
I could lie to you and say yes :(

It worked for me on 2.3.3 but no 'sucky sucky twenny dolla' on 2.3.4.

Same here sometimes Jon on my SGSII (paperweight) . DSD is still in development and improves in leaps and bounds in every release. Check out v9 when released ;)

Sent from my HTC Flyer using vodka
[Android Apps and Games] mynameisjon:
Good to know that it's not me doing something wrong.. I'm not complaining though.. This.. app? is an amazing piece of work.
[Android Apps and Games] nobnut:
I compare it to the ceiling of the Cistine Chapel. Brandall deserves a Knighthood, Canonisation and a Galaxy named after him.

Sent from my Motorola StarTac using Voodoo
[Android Apps and Games] tommo123:
sucks that google blocked this. you can turn mobile data on and off so why would they block this? :mad:
[Android Apps and Games] nobnut:
My guess is that they have started wearing black polo knecks and calling themselves Steve. Next they will block Flash. After that they will block widgets.

Sent from my HTC Flyer using vodka
[Android Apps and Games] brandall:
My app is so clever it can fix itself! Sometimes... If it's in the mood..

My usual response to the GPS question is here - it's all good :)

No need to apologise, it was only mentioned briefly.. The error is indeed my fault for leaving out a variable clear action... Tis fixed in V9 :D

You're too kind nobnut :):) I shall remember you even when I'm famous and ignorant and have no time to talk to anyone from my previous life....

V9 is 98% Complete!!! Just testing it out now... Be up in a few hours!
[Android Apps and Games] nobnut:
Very much looking forward to v9. Thank you. I'll give it some slap and tickle tomorrow when my solicitor has arranged my bail.

As for the GPS issue. I was aware of %LOC and the ability to get (and store) a location. I am less sure about the ability to keep GPS on indefinitely, rather than the maximum 240 seconds.

I use the former but I am no longer able (since 2.3.4) to turn on GPS indefinitely, for example turned on whilst using a SatNav app, or when plugged into a car dock.

Is this in fact true, or am I just being 'special'?

EDIT: I guess in short what I am trying to clarify is, can Tasker actually turn on and off GPS in 2.3.4? It is my understanding that it can no longer do this.

EDIT 2:

Me: "Nurse?"

Nurse: "I'm not changing your sheets again Mr Hastings"
[Android Apps and Games] tommo123:
thanks :)

thought i'd posted this in your other tasker thread though dammit! :eek:
[Android Apps and Games] brandall:
LOL! You are indeed special... there's no doubt... What my post meant was that Tasker no longer needs to toggle GPS in Gingerbread - ticking 'GPS Satellites' in the Android options just means 'it's ready to use when needed' not that it's permanently 'on', which some widgets will detail... If it randomly appears to come on it's down to apps with naughty settings or location services on the net etc... Hope that clarifies?!

No worries :)
[Android Apps and Games] XlAfbk:
not being able to enable GPS in Tasker can be quite annoying though, e.g. in the usecases of your Sherlock profiles.
[Android Apps and Games] brandall:
I'm obviously not explaining myself very well! Sorry... If 'use GPS Satellites' is ticked under menu/setting/location and security in the android settings, GPS will turn on whenever you launch an application that requires the use of GPS. When the application closes, GPS will turn off and remain dormant using no resource.

Tasker therefore no longer needs to be able to toggle GPS, because it is will automatically turn on when performing any action that requires it. It's not the case for Froyo, but Tasker can toggle that...

I really hope I explained that better!? Tick the box in the settings and ignore any widgets telling you it's on - it isn't! It's just ready to be on....

A version of the above was posted by Google themselves...
[Android Apps and Games] XlAfbk:
That doesn't help if the phone gets stolen and the thief disables GPS.

Also it's quite annoying that with GPS enabled, e.g. Google Maps always uses GPS to get your position, even if you just start it to check something you don't need to know your exact location for.
[Android Apps and Games] brandall:
That's what pattern locks are for! ;)

Agreed on that one....
[Android Apps and Games] XlAfbk:
with pattern lock he'll just turn it off. with no lock he might use it which gives you the chance to recover it. so no lock protects your phone ;)

ps: shouldn't system apps always be able to enable gps? at least my galaxy s' camera.apk uses gps for coordinates, even if gps is disabled. then it should be possible to create a apk that enables/disables apk and put that in /system/app and just call it when needed?
[Android Apps and Games] brandall:
It's a little backward, but yes, I do know what you're saying...

It really shouldn't be able to unless it's hacked - it would be a BIG breach of privacy.

In theory, yes definitely... Anything is possible. I'm sure there's just a file kicking around somewhere with GPS=0 written it... Your motivation is to protect against a pretty niche thief though!! ;)
[Android Apps and Games] XlAfbk:
I'm attaching the camera.apk, maybe you want to have a look at it (not sure it works on non-Touchwiz phones). The position it measures are just too accurate to be net-only so it must work around the gps stuff somehow.

I read somewhere that native code isn't bound by the normal permissions, never looked into that though.

ps: maybe we should take this to PM as it's not really deep-sleep-related anymore?
[Android Apps and Games] brandall:
PM's good with me - beware though, I've barely got a moment to fart right now... Lots of projects on the go already!!! Sleep is a long forgotten thing that folks did in stories... :eek:
[Android Apps and Games] nobnut:
...and that is the point. I would like that function. I have a widget that will happily use network location but instead uses GPS. That's why I mourn the loss of this feature. I have to manually toggle now to save battery.

Sent from my Motorola StarTac using Voodoo
[Android Apps and Games] brandall:
Well that widget smells...
[Android Apps and Games] nobnut:
Damn! I knew I should have got one of those scratch and sniff screens!

Buggerypoopants
[Android Apps and Games] brandall:
I've developed a plugin for V10 :eek:
[Android Apps and Games] brandall:
V9n Up!

HUGE thanks to waydownsouth who helped me for hours and hours with the shell script - which is a beast. He's a genius.

[B][U]V9[/U][/B]

* More notifications of what is going on to update the user and identify error sources
* Error logging and request to email the details included
* Updated reporting tools and information
* Increased intelligence of tasks
* Included 'self-checking' of necessary actions
* Standard binary injection
* Standard file permissions on boot
* Fixed screen off/on/power/on/off entanglement
* Updated aesthetics

Installation Instructions

* Unzip the latest version download

* Place the task files in /sdcard/Tasker/Tasks

* Place the profile files in /sdcard/Tasker/Profiles

* Place the folder dsdbin on the root of your storage card

In Tasker, from the menu options/profile data 'Import One Task':

DSDDO

DSDIntMaths

DSDNotify

DSDAdhoc

DSDAhMathsDST

DSDAhMathsUPS

DSDFileSetUp

DSDSUPOP

DSDSuperUser

DSDWakelock

DSDErrorLog

DSDXDAUN

In menu options/profile data 'Import One Profile':

DSD-DisplayOn

DSD-DisplayOff

DSD-Incall

DSD-EndCall

DSD-Power

DSD-Boot

DSD-Shutdown

DSD-Media

First Run

* Ensure all of the task and profiles imported correctly

* Save out of Tasker to preserve the changes made

* Load Tasker and select the task DSDSuperUser

Thanks to nobnut and his testing (whilst being blind drunk watching opera), I've been able to establish that the SuperUser requests can take up to 30 seconds to appear. There is only one command that needs permission. DSDSuperUser has a 20 second wait time to give the SuperUser application a chance to prompt. If it hasn't appeared by the end of the wait time, there is a pop up asking if you want to run the task again - I hope you'll only need to run it once though!

NOTE! The previous /sdcard/DSD/ folder will be deleted on installation of V9. Please transfer any files you wish to preserve elsewhere.

* Press 'test' in DSDSuperUser and follow the instructions from there!

Let's get detecting... :eek:
[Android Apps and Games] nobnut:
Thank you!

Just installed v9... can't find the link for v10 :confused::p

I will let it run and test now. Just two things to report:

+

Got SU request ok

-

As SU request arrived, got an error that DSDSUPOP was missing... it isn't I checked.

(Need more than 20 seconds on the SGSII?)

I then ran DSDSUPOP and folder & files were written.

PS the ReadMe needs editing, it still refers to 3 SU requests

Thanks again!!
[Android Apps and Games] brandall:
Strange for the pop-up task?? Damn it on the readme! Thanks for your feedback!
[Android Apps and Games] nobnut:
Sorry, I should have clarified, it wasn't a DSD popup, it was a Tasker popup. I haven't disbaled them.
[Android Apps and Games] brandall:
I was with you - very strange... It's also strange about the readme file... I've checked the write file action and it makes no mention of 3 SU requests.... Confused.. I'm hoping the task exports ran correctly and I haven't packaged up some V8tasks.... Will check when I get back shortly....
[Android Apps and Games] nobnut:
No rush on my account.

My phone's just had a terminal case of the squits and nandroid is playing up (not related to DSD). It's turned into a proper wrongun and I'm going to have to download and reflash a ROM (all my originals are at work).

I'll resume testing tonight (my bandwidth is from the Victorian era).

EDIT: I just had a look at my SD card... DSD folder wasn't deleted when v9 was installed as per instructions. That explains the ReadMe issue.

EDIT 2: There is a chance that USB debugging wasn't enabled (I guess this would make a difference to DSD)... I was cocking around earlier and can't remember if I re-enabled it. No way of telling now as my phone is ballbagged.
[Android Apps and Games] brandall:
If only you had a spare phone to use! ;) I hope you manage to fix it soon...

The only reason the folder and files wouldn't have been deleted was if it didn't detect the DSD-BootLog.txt file - otherwise it should have deleted...

I'm thinking something went very wrong if the readme file didn't overwrite either... The task must have failed... but can't think why... I tested the ass off it... Did you get the notification that the binary transfer was successful?

Anyway, I'll leave you in peace until you sort your phone woes - THEN I'M HUNTING YOU DOWN! :eek:
[Android Apps and Games] chamonix:
Time reported for PWLs

Ok as I have a working version of my app with a GUI now I did some testing this morning:

- checked "since unplug" stat and wrote down some figures

- played with the phone (reading mails) for in not to switch off

- rechecked the stats

Result: the timeof the PWLs increased even if there was no way in hell the phone would have slept if those weren't there.

Interpretation (in the context of the "batterystats" service on 2.3.3):

partial wakelocks are timed and reported for the duration they were applied and not for the time they prevented the phone from going to sleep.

This is neither good or bad it's just something to keep in mind (or find a workaround to) that means that the wakelock statitistics are more precise if the phone is not in use.

Going to have a look at the wakelock stats that were hidden in Froyo now to see if there is something is done in the code about that fact.
[Android Apps and Games] chamonix:
A little OT but has anyone seen a thread / collection of information about apps and settings that are sensitive in terms of power drain?

e.g.: using my stats I noticed that the wakelock duration for synchronising the draft folder of my IMAP account (using push and K9-mail) was almost as high as the wakelock duration for synchronizing my inbox. As I don't want/need that I simply moved my Draft folder from 1st class to 2nd class and that wakelock time is gone without me losing any functionality.

I'm sure such a collection of setting patterns would be usefull.

Any thoughts?
[Android Apps and Games] nobnut:
The only notifications I received were the first that I can't remember but was something like 'now installing DSD', the next '20 seconds blah blah'. Then the SU request. There was also a message about 'let's go detecting'.

After reboot, I saw the DSP sleep prevented due to USB connected with the old trilby... nice touch ;)

I can test on other phones but I wanted to test on the SGSII for continuity purposes. DSD is the only reason it hasn't gone down the toilet yet.

Sent from my HTC Flyer using vodka
[Android Apps and Games] nobnut:
I haven't seen such a thread but I will go hunting.

Sent from my HTC Flyer using vodka
[Android Apps and Games] chamonix:
I feel weird to quote myself

<monolog>

The code in Froyo looks the same as in Gingerbread (and mine).

For the curious reader: http://grepcode.com/file/repository...battery_history/BatteryHistory.java/?v=source

Map<String, ? extends BatteryStats.Uid.Wakelock> wakelockStats = u.getWakelockStats();
long time = 0;
int count = 0;
if (wakelockStats.size() > 0) {
for (Map.Entry<String, ? extends BatteryStats.Uid.Wakelock> ent
: wakelockStats.entrySet()) {

Uid.Wakelock wl = ent.getValue();
Timer timer = wl.getWakeTime(BatteryStats.WAKE_TYPE_PARTIAL);
if (timer != null) {
// Convert from microseconds to milliseconds with rounding
[B]time += (timer.getTotalTimeLocked(uSecNow, mWhich) + 500)[/B] / 1000;
count += timer.getCountLocked(mWhich);
}
}
}

So the definitive answer is: when talking about wakelock time we are talking about the time a wakelock was active as opposed to the time a wakelock prevented the phone from sleeping.

</monolog>
[Android Apps and Games] mynameisjon:
Quick question, updating the DSD would entail deleting all the old profiles + tasks right?

I did that and there wasn't a problem. Just wondering if there was a quicker way that I might have missed.

Also I noticed that the time between pressing test on Super Users didn't allow me to catch the SU permissions in time. The DSD option screen came up before I could "allow" super users permission.. got around that by changing the wait time to 30 seconds.

Edit: I see nubnut already caught on the the wait time. apologies.
[Android Apps and Games] brandall:
Thanks for reporting back Chamonix - that makes sense from the stats you posted and is great that you've clarified a fundamental for me about how PWLs are recorded. I'll pm you a command output I've got that you can compare to your overall timings to see if they match up.

It's another interesting find - never seen a thread on it though - I think the reporting methods you are using are a little more in depth than available to most, so you may end up being the 'OP'!

I like the Trilby too :) wanted a pipe, but no such icon ... I'm glad I've saved the life of your SGSII, death by flush is not a good way to go... I tested the set-up tasks to the max, so gutted they failed! :mad:
[Android Apps and Games] nobnut:
I'm nearly ready to go again with DSD - reflashed. Just taking some valium before I handle Samsung's abomination.

Sent from my HTC Flyer using vodka
[Android Apps and Games] brandall:
Did the pop-up not appear saying 'pick an option from below' - 'SU approved' 'run SU task again' ??

Unfortunately all Tasker allows is to import and delete profiles - I know it's on the todo list to make this more of a 'batch' process...

LOL

It's official then... Quite why they would do this is beyond me... PM you shortly...

Good luck soldier!!
[Android Apps and Games] nobnut:
Show me the moneeeeeeey!!!!!!!!!!!!!!!!

Right, I think the 20 seconds needs to be increased, at least for the SGSII. EDIT: See mynameisjon's earlier post.

I just tried four times... 4th time lucky.

My abortive attempts at DSDSuperUser ranged from a kick in the nads (nothing) through to the SU request coming up after the DSDSUPOP error popup like before.

Eventually, it worked as planned. I received notifications about the binary being copied and a whole bunch of other stuff (it all happened very quickly and I immediately got a swelling in my speedos which distracted me).

I then saw the text file.

I have now rebooted and will test.

Shabbadabbadingdong!

Sent from my HTC Flyer using vodka
[Android Apps and Games] brandall:
LOL! Thanks nobnut - this DSDSUPOP is bugging me... Attached is another one, just in case the first was corrupt..

Hope all else is going smoothly! :eek:
[Android Apps and Games] nobnut:
Thanks for the new one. I'll give the old one to Oxfam, it'll be worth something when DSD goes viral.

Do I need to reinstall DSD from scratch or can I just replace the old one?

Cheers Pingu!

Sent from my HTC Flyer using vodka
[Android Apps and Games] brandall:
You are a shrewd investor! I wonder if that would count as insider trading though...? :eek:

Well, I know what a thorough tester would do............. ;)

Just kidding! Whatever you can be bothered to do whenever you can be bothered to do it... It's a great moto that your employer should adopt.

Erm, pleasure dangermouse... ... ... .. .

EDIT: If that one doesn't work, then it must be a Tasker BETA issue and all users should suffer with it... :(
[Android Apps and Games] nobnut:
I will test thoroughly in the morning with a clean install.

But I've just discovered a problem... I was running a Media test and got a Tasker popup error. I didn't catch it fully but it said something about 'DSDWakelock missing'. I checked and I don't have one. I will redownload the zip to check.

EDIT: There isn't one in the zip and I don't have one :confused:

Sent from my HTC Flyer using vodka
[Android Apps and Games] brandall:
THANKS NOBNUT! The data was definitely corrupt as other files are missing too!! Will upload V9a Shortly!!!
[Android Apps and Games] nobnut:
Cheers boss. But I have to do something nasty tonight which will take some time... I hate my real life.

I will test tomorrow!

Au revoir mes amis. Je vouz aime, Je doit partir.

Sent from my HTC Flyer using vodka