yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] brandall:
V10 Up!

V10

* Called time in state data via script to avoid permission errors

* Reverted DSDDO, DSDShutdown, DSDAdhoc to the above

* Added wait times and loops to allow for delays

* Removed DSDXDAUN as it was too buggy

* Reordered tasks to allow for multiple calls of single script

* Removed directory/file making tasks to minimise possible set-up errors

* Removed unnecessary permissions from script

* Added further dynamic script controls to increase speed of shutdown task

* A few more bits and bobs...

Bugs

* Media profile is deactivating when the music application is no longer in the foreground - Dirty solution for now is to switch the screen off only when you are in the application... - I'm on it

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

* Place the folder DSD on the root of your storage card (after deleting your current folder from a previous version)

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

DSDDO

DSDIntMaths

DSDNotify

DSDAdhoc

DSDAhMathsDST

DSDAhMathsUPS

DSDFileSetUp

DSDSUPOP

DSDSuperUser

DSDWakelock

DSDErrorLog

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, 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 30 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!

* Press 'test' in DSDSuperUser and follow the instructions from there (including a reboot)!

Let's get detecting... :eek:

Feedback appreciated as always - thanks to you guys for helping me test the long forgotten V9! :eek:
[Android Apps and Games] brandall:
Get up and test this right now! Priorities... :eek:
[Android Apps and Games] sixstringsg:
Just a suggestion, those that have a really long report could use pastie.org to make the thread cleaner.

Sent from my SGH-I897
[Android Apps and Games] :
quick reply before I back to work:

v10 never worked for me, I mean installation was fine but unable to generate reports.

v9n + UPDATE.zip earlier worked fine.

Any idea? (sorry not enough time to post details right now)
[Android Apps and Games] :
Hi nobnut,

Thanks for ur answer.

Btw, I would like to ask, apart from the 'normal' installation procedures in the 1st post ie. Import all profiles and tasks, then run DSDSuperUser (permission allowed) finally installation completed. Then I rebooted my phone and that's it?

Sometimes in notification bar it says "Deep sleep prevented. Log written" but when I go checkout /sdcard/DSD all files are still "null"

p/s: in case you're wondering, yeah I did place /dsdbin and /DSD on /sdcard.

cheers :D
[Android Apps and Games] nobnut:
Hi Chief,

That is strange. The reports will only be written when deep sleep has been prevented, but yours is saying that it was prevented.

You can try what I did.

Leave your phone with the screen off and unplugged with some media playing for over 10 minutes. Turn the media volume down if you are at work ;)

Then after >10 minutes, check again.
[Android Apps and Games] :
thanks nobnut, will try it out asap :D
[Android Apps and Games] brandall:
Hi truemagic - can you set up a 'variable list' task and attach it to an icon on your homescreen (in the same way as DSDAdhoc). The task will just have a 'variable list' action in, nothing else. Seeing what variables are left uncleared will may give me a clue as to the problem. Have you definitely not installed any V9 tasks by accident?

Don't forget you'll need to untick the media profile in Tasker before you do this!

You are a gent! And truly committed :)

You sound almost disappointed!

WHOOP! Thanks for the info you provided:

'Total partial waklock time: 5m 48s 0ms' <- that is actually a system output! Wasn't very helpful when doing a search on 'wakelock' :mad: I need to segment it and insert the correct spelling... but it's effort!

Don't worry about pasting the batteryinfo.txt - I only use it in the script to split some data. I need to delete it once I've finished as standard.

dsdtis.txt is populated in various tasks and transferred to %CPUDSD - it's then set back to null. This is done so IF %CPUDSD matches null I can start a loop to read the file again in case there is a delay in the data which is currently set to 150ms. If it doesn't work, you'll get a time in state error.

Hopefully (tempting fate now) if this version functions as it should, have you still got the wake-up behaviour that brought you to this thread originally? I saw a 'fixed' ROM had been released for the SGSII - has that addressed the issue for you? Want to focus on properly isolating this issue for you next...

Thanks for holding the forte! :cool:
[Android Apps and Games] :
ok brandall, I will try that.

meanwhile, i'm seeing "Error, looping task" in notification bar..i made sure no leftover tasks or profiles from v9n :D

Sent from my GT-I9000
[Android Apps and Games] :
user variables :

%DSMNL: %DSMN

%DSDDOS: 1

%CPUDSD: EOF

%DSDLOG: 1

Sent from my GT-I9000
[Android Apps and Games] brandall:
Thanks truemagic - I see what's happened here, I hadn't allowed for %CPUDSD being set to 'end of file' - I'll need to deal with that in V11!

Consequently the task failed and left the 'task still running' marker of %DSDDOS active - so nothing is looping don't worry.

Please use the variable editor and clear those three variables and you should be up and running again!
[Android Apps and Games] nobnut:
Really? I don't need to do this, it reports correctly for me without doing so :p

I understand.

Yes, I still have it. I believe it is probably Google Maps (Latitude). But I haven't actually looked at the wakelock counts properly to verify.

The issue for me is with regard to DSD thresholds. I haven't yet reset any of mine but basically want to be informed of any and every wake incident at all during sleep potential. I do not have any problems with sustained periods of awake, but I want to catch 'every' incident of the device waking briefly.

Should I just follow your previous instruction and adjust DSDNotify accordingly (80% > 100%)? Or are there other thresholds I should change also?

Thank you.

EDIT: I also don't want the 10 minute delay before 'recording' begins unless you suggest a reason to keep it that way :)

EDIT 2: The reason that I want to catch everything is that under current thresholds, my intermittent wakes are not captured. Even though the phone is often awoken, because the instances are so brief, they do not total the 20% required to trigger a report. The only way I can see them is to trick DSD by running Media in the background to prevent sleep. Example screenshot attached showing frequent wake instances but no DeepSleepDetective report being written.
[Android Apps and Games] nobnut:
Just expanding on EDIT2 above, here's a suggestion for you to ponder...

How about, in the fullness of time, there are perhaps two or three DSDNotify tasks included. The user must disable 2 of the 3, allowing only one to run.

These could be low, medium and high sensitivity. The low might track only significant instances of waking, the medium catch slightly more and the high sensitivity level catches everything and the kitchen sink.

I am not sure how the naming of these might be managed to allow one to be chosen over the other two and then changed at a later date. But nothing is impossible, right? ;)

Good idea or a load of old pants?

EDIT: Just given this some more thought... only one task would be needed perhaps. Dependant upon the value in a text file (L/M/H), using an 'if' command, different sensitivity levels could be set, rather having to manually edit task properties. (I have the Tasker novice and ease of use of DSD in mind).
[Android Apps and Games] brandall:
I assume you've not included your media player in this profile then??

I'm with you - When I started this project, that was initially the priority, but ironically for you, your testing expertise to help discover this threw up so many issues with the logic that it's taken a back seat! That'll teach you to be so thorough! ;) I really hope V10 proves to be stable and accurate enough now so I can concentrate on catching these buggers, as it's become apparent that they may well operate in milliseconds, rather than waking the device, making a cup of tea, reading the paper and doing the job they woke the device up to do; leaving an obvious footprint of 18 minutes... They're sneaky little blighters... :mad:

So, at present, I'm catching wakelocks that are holding after 10 seconds of display off time and I only flag them if they use a large amount of resource. The resource they use reduces proportionally the longer the device deep-sleeps for, so the thresholds are in place so not to flag an unnecessary issue of PWL holding for 80% of display off time, it that time was only 3 seconds - that would be expected behaviour whilst the device did its teeth, tidied its room and got ready for bed... so to speak...

That is the obvious one, but I will look at adding to the text of the notification the wakelocks that were detected regardless if the report shows 99% of DSP - that way you/the user can decide whether to investigate further.

You can of course reduce that - the only reason it's there is to stop a new user looking for answer to their wakelock issues every 20 seconds for the first couple of minutes of running - The device needs a bit of 'normal' behaviour before reports start to head towards becoming 'proportional'. IF V10 is stable, I may well up this to about 5 hours, just to make sure the data gathered is not unnatural due to the DSD being installed!

All you can do for now is adjust the threshold to say 95% - that way you will always get a DSD report - it's the information in those to do with the sleep times that you need to keep an eye on. My version has a lot more data, which I couldn't include as it would only make sense to me - I've gotta sort out the formulas and then convert them into shell commands to run in the script - I'll then be able to demonstrate retrospectively what PWLs occurred during the previous sleep and for how long - this will be reported regardless of thresholds...

Anyway, I really waffled there didn't I - but thought I'd give you a good explanation so you hang in there and don't flit off to another thread.. because I will find out!! And moonlighting is certainly not permitted! Any questions, let me know...
[Android Apps and Games] nobnut:
I haven't touched it. I always run with your stock settings for at least 24 hours before I fiddle with settings.

Meh. I had a look at other threads and they are full of ignorant folk with little or no understanding of politeness ;)
[Android Apps and Games] brandall:
I understand what you are saying, but once I sort the previous waffling issues above, it will be a case of:

"Whilst your device slept for 3 hours, the application '????????' held a wake lock on 11 occasions totalling 81ms. This is proportional to less than 1% of DSP."

Would that be what you are after??
[Android Apps and Games] brandall:
When you start your music player, does the variable %DSDMED set to 1 ?
[Android Apps and Games] nobnut:
It's not really a case of what I'm after. I am thinking about what the average user might find useful.

But I think 'yes' roughly to the above. I'm asking myself "what is the average user wanting from Deep Sleep Detective?". I think possibly a ranked list of the apps etc causing wake, kind of like a worst offenders hall of shame e.g.

During last period of potential sleep:

Maps | 12 incidents | 10 seconds of wake

ABC widget | 4 incidents | 8 seconds of wake

XYZ app | 8 incidents | 4 seconds of wake

Not at all disimilar to your example above :)

EDIT: The offending apps could be 'frozen' in Titanium to verify results before either being removed, or having their settings adjusted... or even removed from DSD recording activities.
[Android Apps and Games] nobnut:
Yes Sir. Indeed it does.
[Android Apps and Games] brandall:
Yup - that would be super... Unfortunately, the formulas and data manipulation to achieve that are pretty intense... I can only sit down and attempt to solve it when I'm not off my head on drugs - which is rarely. :eek:

It's very commendable that you are thinking of the average DSD user rather than yourself. Your selflessness is an example to us all ;)

Ok, so if you switch the screen off for ten seconds and then back on again, do you get a notification saying the media was playing so no DSP ??
[Android Apps and Games] nobnut:
I can only start to imagine :(

Not exactly. I get a notification saying Sleep < 10 mintues so no report written.

I do get an equivalent report however when plugged in to USB saying no DSP because of USB plugged in.
[Android Apps and Games] nobnut:
I want to reinforce that I am no way whatsoever challenging you or getting fed up, or bored with this.

I think the work you are doing is great and I am a huge fan. I am happy testing whatever comes my way with good grace.

I firmly believe that unless someone can do better, then they should not criticise. If they can do better, then it is bad form to criticise anyway.

I appreciate all of this. I hope my previous willingness to stick with this thread is testament to that. I will be judged by my future actions in continuing to do the same :)

EDIT: That having been said, I am starving and shooting round the corner to KFC for a highly nutritious meal (and to ogle the cute Polish chick working there ;))
[Android Apps and Games] brandall:
I hadn't considered it for a moment and I appreciate the compliment :)

Your testing has been priceless and I hope I have thank you sufficiently within the boundaries of my five a day.

Your latest discovery:

Typo in action #6 & #7 of DSDDispOn - The IF statement should read %DSDMED not %DSPMED....

Hence the lack of a correct notification and reporting continuing when it should stop... Please can you change so it works correctly - You'll need to untick the media profile in Tasker for all future media tests.

Thanks again!
[Android Apps and Games] nobnut:
I have made the changes and tested for > 10 seconds, both with and without the Media profile ticked.

Unfortunately, regardless, the notification shows "No report generated - DSP < 10 minutes" :o

Be back soon.
[Android Apps and Games] brandall:
Hmmm.... are you sure the settings stuck when you saved...?

EDIT: Thank the lord for the EU... and KFC too I suppose..
[Android Apps and Games] brandall:
Can you do the below for me please:

Hopefully that will diagnose the issue...

EDIT: Can you also let me know the output you get from this terminal command please:

/data/DSD/./toolbox uptime
[Android Apps and Games] nobnut:
Stuck like glue (screenshot just taken)

She wasn't working today :(
[Android Apps and Games] bgx:
With the Media Var thats doesn't work correct. Because when I turn on the Musik and go to the Homescreen the musikapp lost his focus and the media variable is set to zero!!!

Is there a way to fix this issue? I had a similar task for autorotation but there is the same issue and I haven't found a fix for this!
[Android Apps and Games] nobnut:
Correct me if I am wrong, but how can those uptime figures be correct? V10 hasn't been released for 23 hours yet and you need to reboot in order for DSD to work properly.
[Android Apps and Games] brandall:
Well spotted nobut!! Yes bgx, can you reboot please and see if the problem persists... Also, I'm not exactly sure what you mean by loses focus? The variable %MUSLEEP = 0 isn't to do with DSD...

Damn it! x 2

Can you do a test for me please and set up a profile/event/variable %NOCOUNT is set - a one action task for a vibrate action. Want to see if %NOCOUNT sets correctly when the display is off - can you 'flash' when you turn the screen back on too please to see if it's still populated...?

EDIT: I'm sure there's a joke about chicken, Polish girls and breasts, but I just can't piece it together...

EDIT2: I'm out of + thanks for you spotting that!
[Android Apps and Games] nobnut:
I have done the test and get the vibrate on display off. I can't get the flash on screen on however. I have set Flash, Text NOCOUNT If %DISPON ~ 1

EDIT2: I tried it as 'Set' also.

I have probably done it wrong though :o

EDIT: I have heard that joke, the punchline is "...and then she pulled an artichoke out of her rabbit's ****".
[Android Apps and Games] nobnut:
Hmmm. No joy still. The same is happening.

Attached however is the now fundtioning log contents notification which you might be able to use.
[Android Apps and Games] brandall:
Well at least the popups are working!

V3 will be up a bit later, that will solve most of the bad maths and non-numeric errors - I hope your display on/off trigger works...
[Android Apps and Games] nobnut:
I was called away from work and didn't get to give it a go unfortunately. I'm tied up tonight but will be all over it tomorrow morning.

Sent from my Motorola StarTac using Voodoo
[Android Apps and Games] brandall:
Great, thank you :) I'll have a flawless V3 waiting for you!

Possibly..................
[Android Apps and Games] brandall:
V3 Up!

Change Log

[B][U]V3[/U][/B]
* Removed 'append' from action #1 of DSDShutdown to avoid looping data corruption
* Corrected error in IF statement in the task DSDIntMaths
* Added 400ms wait task after locale fetch in #2 of DSDDO
* Ad-hoc tasks added so information can be viewed at any time
* Restructured A LOT of the tasks
* Included more information in report files
* Lots more I've forgotten

IMPORTANT READ BEFORE FIRST RUN!!!!!!

Thanks to nobnut and his testing, I've been able to establish that the SuperUser requests initially cause issues by preventing the tasks from completing and therefore corrupting the data - which goes on to cause more errors. We need to get these all out of the way at once. Please follow these instructions:

1) Open the task DSDSuperUser - keep pressing 'test' until no more SuperUser requests are appearing. This will leave all the commands free to run in the tasks.

2) Reboot your phone

3) Once booted, you will receive an error that the data was corrupted. This is as expected (as there isn't any). Ignore it.

4) Open the task DSDShutdown - Drag the Variable Set action in position 4 above the STOP action in position 3. Done.

Ad-hoc

I've added an ad-hoc task into V3, so you can check the statistics at any time. Easiest way to launch it is via an icon from your desktop using a Tasker 'run task' widget, available in the widget options on your launcher. DSDAdhoc should be triggered first, which in turn will trigger DSDAhMaths and information will appear on your display. The files are in a separate download in post #3
[Android Apps and Games] nobnut:
Update:

I deleted everything and started again... this time by waiting and waiting in between DSDSuperUser 'Tests', I have managed to get 8 SU prompts and not 4 as above (any idea how many there should be?)... report to follow...
[Android Apps and Games] brandall:
Thank you so much nobnut! :D

I'll reply fully shortly, but please be aware, the deepsleepdetective.txt file should ONLY be populated during testing and then ONLY if the deep sleep was less than 80% of the display off time (if potential to sleep was possible).

I assume SU requests should be one for each? Unless it's somehow categorises them...?

I'll be back very shortly!

Oh, you probably wouldn't get the boot error as you'll have existing variables with data in. If you have no contexts of your own that trigger from a variable being populated, then you can do a 'variable list' action to see what data tasker holds and a 'variable clear' action with nothing populated to delete it all...

brb
[Android Apps and Games] brandall:
Looking at the deepsleepdetective file you posted, not all of the data has populated correctly, which is probably down to not getting 8 SU requests the first time. I've added that to the instructions = thank you.

In the task DSDNotify in action #6 (I'm running V4, so this may not be the right number), there is IF %DSCON < 80. This is the threshold to say that an error should be flagged and the deepsleepdetective file written. You can adjust this to < 100 if you want to see the information it gathers.

If you change that, you then need to change the IF statement further down that says IF %DSCON > 79 which will give you the everything is ok notification.

It's good to see your DisplayOff times are being triggered and being populated in the boot report - I was worried that might be the biggest problem! It's not there in the shutdown report, but perhaps with a little running time that includes some DSP time, it'll populate again...

The '4average:0.87' in the uptime file is a little worrying... Not sure what that is or how it got there!? I'm wondering if it's something to do with running the command in quick succession via DSDSuperUser... We'll see...

The DSDAdhoc task is there for you to use whenever you like now - I launch it from an icon on my launcher - it's pretty informative to what's going on...

Thanks again - I don't have any errors now apart from the odd result of over just over 100% for interval sleep times - recording the figures it is using for analysis!
[Android Apps and Games] nobnut:
Thanks, I have changed 80 to 100 to try and find out what's what. I am wondering however what to change the %DSCON > 79 value to... I am guessing 99?
[Android Apps and Games] brandall:
Adhoc .zip uploaded to post #3 - can't believe I didn't included that! It was getting late.... Will read your replies now and edit this post...

Best make it 1000 in case of strange results!

Ok, do you have Terminal Emulator installed? If so, can you go to it and type in uptime and post the output pleae (if you hold the screen and press select all - it appears to do nothing, but does work).

Do you have the latest version of busybox?

I've only glanced at the detective file and it isn't populating correctly, but it appears your battery monitor is rather ironically using the battery!

name expire_count wake_count
"sec-battery-monitor" 0 22

I've messed up and not unticked 'append' in action #1 in DSDShutdown.... Oops! Please can you untick it. The fact that there is data there shows that the boot task is failing for some reason. In the reverse to the first run process, can you variable clear %DSBOOT and then drag it below the STOP action, so it is not populated on reboot - can drag back afterwards....

Edit: Also, can you delete deepsleepdetective.txt - DSD-BootReport.txt and DSD-Uptime.txt please, so I know we are getting fresh data...
[Android Apps and Games] nobnut:
Done

Done

export PATH=/data/local/bin:$PATH
$ export PATH=/data/local/bin:$PATH
$uptime
09:23:34 up 19 min, load average: 2.90, 1.99, 1.74
$

I have 1.18.4 installed.

I am special :p

I have unticked append. DSD-Shutdown reordered.

Sorry, should I add in an extra variable or edit an existing one? I am still new to Tasker :o pretend you are talking to an idiot (you won't be far wrong). I won't be offended.

Done.

EDIT: Report after reboot to follow once you have instructed me regards to the variable question in red text above.
[Android Apps and Games] brandall:
You seem pretty on the ball to me!

In the main Tasker screen, press menu, more, run an action. Select variable, variable clear and type in %DSBOOT. You can also run your variable list action from there to see if you have loads and loads of data stored in Tasker (and clear them out if you want).

I'll edit this post will full reply shortly!