yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] brandall:
@ pulser_g2

I've had a pretty good read here, there and round and about and all I can find that appears to be close to what might be needed is:

Obviously the bit in bold is key, but also the red text then suggests that at that point, you can still set something to do something "set a display driver to completely power down". So would a simple log snippet/terminal command 'dumpsys power' be permitted?

I'm as yet uneducated enough to know about the above and wonder if the power down request from the user space doesn't trigger if a wakelock is already registered, or if the request comes in regardless, but is suspended until the wakelock is released? If it's the latter, then that is the moment I'm after.

You may well have already gathered/knew all of the above, but it did me good to write it, so I know what I'm doing!! I think I need some sleep... :eek:

Let me know your thoughts...
[Android Apps and Games] brandall:
I'd probably suggest Perl - I know of a user on here who is pretty good with it - Borrowing others knowledge is the way forward! Do you write scripts yourself, or is it installed just to run them??

Wondering if also using SL4A might put off the average Tasker user.. At the moment it's pretty much a plug-and-go for them. I shall ponder...
[Android Apps and Games] nobnut:
Might Gscript simplify this for those who could be put off?
[Android Apps and Games] nightranger73:
I'm a little in scripting too (python) but I don't think could go that further

Sent from my GT-I9100

If you find this post usefull please press the "Thanks" button
[Android Apps and Games] brandall:
Thank Nobnut, I'll check it out later. Any bugs to report? What does your DSP % usually come in at?

Me neither - time to call in a favour...
[Android Apps and Games] nobnut:
No bugs to report :)

My DSP seems to be around 62-66%.

But these figures are distorted. I have had my phone on charge for most of the last few days (on charge at home, into the car where it is on charge, then in to the office where it is on charge). My working cycle is somewhat erratic, sometimes I am near a charger, in which case I always use it. Other times I cannot charge for love nor money.

I guess it goes to show the different purposes for which DSD will be used when finished. Your question leads me to believe that you have a bias more towards achieving as high a deep sleep ratio as possible. I am more keenly interested in getting to know the processes going on inside the phone, particularly those which prevent sleep/cause wake. I would use this information to make an informed choice and determine a balance between phone functionality and battery life (e.g. if I know that app 'x' causes wake, I can decide whether to keep it). I don't really care about DSP%, as without the supporting information (apps causing wake), it is an arbitrary figure.

Clearly there is a link between the two but in themselves, they are very different functions provided by DSD :)
[Android Apps and Games] brandall:
Glad to hear there are no bugs :) I can focus on the reporting side completely now, so this information will be yours soon - I'm on the case.

First stage is to establish what wakelocks are in place as soon as the device enters DSP. If you have a moment for some testing for me, can you paste the below into a Locale action in DSDSuperUser so to get permission, then after into the very bottom of DSDDisplayOff below the perform task DSDDO action - that action currently has STOP ticked, could you untick that please to make sure it continues. Apply out of Tasker.

With your device unplugged from a power source, can you start the media player and then switch the screen off. The media should continue to play? Then, wait about 20 seconds and switch the screen back on - Making sure the display doesn't switch off again, navigate to wakelock.txt on the storage card and hopefully it will be populated with data.... Hopefully...

@! dumpsys power | grep PARTIAL_WAKE_LOCK > /sdcard/wakelock.txt

Can you post the output if possible please!

Thanks in advance...
[Android Apps and Games] nobnut:
Hi, I've just tried that. The file is written but is empty :(

I tried rebooting and repeating the test and...

still empty :(

I double & triple checked the '@! dumpsys power | grep PARTIAL_WAKE_LOCK > /sdcard/wakelock.txt'

EDIT: I retested using other apps instead of the media player (Pro Amp in my case), I tried Quadrant and Copilot. The media did carry on playing during screen off.

EDIT2: Gotta go for 10 minutes be back soon.
[Android Apps and Games] brandall:
Doh! Could you try just 'dumpsys power' in the terminal and see if you get an output please.

Can't see how this could cause the home screen widgets to malfunction... It's only an output command, so nothing changed anywhere....? :confused: Hope they are working again!

If you do get an output in the terminal, can you then try music on, screen off, wait 10 seconds, screen on, wait 10 seconds, screen off, wait 10 seconds, screen on - check file! Thank you thank you!

EDIT: Good news! (well, that I'm not too blame anyway....!)
[Android Apps and Games] nobnut:
I will redo the tasker tasks and try again... will post back results.

In the meantime output from 'dumpsys power' in terminal below:

export PATH=/data/local/bin:$PATH
$ export PATH=/data/local/bin:$PATH
$su
# dumpsys power
Power Manager State:
mIsPowered=true mPowerState=7 mScreenOffTime=30927 ms
mPartialCount=0
mWakeLockState=
mUserState=SCREEN_BRIGHT_BIT SCREEN_ON_BIT
mPowerState=SCREEN_BRIGHT_BIT SCREEN_ON_BIT
mLocks.gather=
mNextTimeout=1214596 now=1208631 5s from now
mDimScreen=true mStayOnConditions=0
mScreenOffReason=1 mUserState=7
mBroadcastQueue={-1,-1,-1}
mBroadcastWhy={0,0,0}
mPokey=0 mPokeAwakeonSet=false
mKeyboardVisible=false mUserActivityAllowed=true
mKeylightDelay=6000 mDimDelay=47000 mScreenOffDelay=7000
mPreventScreenOn=false mScreenBrightnessOverride=-1 mButtonBrightnessOverride=-1
mScreenOffTimeoutSetting=60000 mMaximumScreenOffTimeout=2147483647
mButtonOffTimeoutSetting=6000
mLastScreenOnTime=1178831
mBroadcastWakeLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
mStayOnWhilePluggedInScreenDimLock=UnsynchronizedWakeLock(mFlags=0x6 mCount=0 mHeld=false)
mStayOnWhilePluggedInPartialLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
mPreventScreenOnPartialLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
mProximityPartialLock=UnsynchronizedWakeLock(mFlags=0x1 mCount=0 mHeld=false)
mProximityWakeLockCount=0
mProximitySensorEnabled=false
mProximitySensorActive=false
mProximityPendingValue=-1
mLastProximityEventTime=0
mLightSensorEnabled=true
mLightSensorValue=100.0 mLightSensorPendingValue=-1.0
mLightSensorScreenBrightness=69 mLightSensorButtonBrightness=0 mLightSensorKeyboardBrightness=0
mUseSoftwareAutoBrightness=true
mAutoBrightessEnabled=true
mMaxBrightness=255
mOldTemperatureIndex=0
mScreenBrightness: animating=false targetValue=69 curValue=69.0 delta=3.45

mLocks.size=0:

mPokeLocks.size=0:

#
[Android Apps and Games] nobnut:
No joy still. I reset the two tasks, applied su permission and re ran the test as per your new instructions.

The file was still empty :(
[Android Apps and Games] brandall:
Thanks - I'm glad you got an output! In the output section above, is where the partial wake lock information appears for me. Can you try the following please...

In the terminal execute dumpsys power - make sure the command is there waiting by pressing up and you'll need to execute it quickly next time.

Turn the music on, go back to the terminal, switch the screen off briefly and back on again and immediately execute dumpsys power again - hopefully you will see the media player entry then....?

EDIT: hmmm ok... Will ponder if the above doesn't work....
[Android Apps and Games] brandall:
WHOOP!! Thank god for that... From this output I'm pretty sure I've solved my wakelock issue - 'MAIL_SERVICE' kept my device awake all afternoon yesterday and the circumstances of having an exchange server currently synching hourly, it's led me to this known fault. I hope this puts an end to my battery woes, just in time for me to get a new device anyway! :mad: I didn't read the whole thread, but I don't know if it could apply to the ROM you are running. For me, the wakelock disappears if you turn wifi on....

%WHOOP2! Ok, so now I have to understand why the music wakelock isn't being written to the text file. Can you add a '>' to the locale action, so it reads '@! dumpsys power | grep PARTIAL_WAKE_LOCK >> /sdcard/wakelock.txt' - that way it will append the data and won't overwrite anything useful. I'm wondering if I need to wait a certain amount of time before the locale command is executed? Perhaps your device is just too quick...? Could you add a wait time of 5 seconds above the execute action and then run the music on, screen off, wait 20 seconds, screen on test again please....

We're getting there! Really do appreciate all of this.
[Android Apps and Games] nobnut:
I added the 5 second wait and the '>'... re ran the test and nothing more was written to the file. Is there anything else you suggest I should run instead of Music?

EDIT: I've tried a few apps but can't get anything written.

EDIT2: Regarding your thoughts re MAIL_SERVICE. Indeed, Pulser suspected as much a while ago now and consequently most people using Pulser's ROM have switched to the AOSP mail app rather than the Samsung effort.

I use Enhanced Email.
[Android Apps and Games] brandall:
Let me think...., you could run somekind of backup or download a file... Anything really that wouldn't stop just because you turned the screen off.... Nothing else springs to mind and my phone is currently nandroiding, so I can't look down my apps!

EDIT: Using the quick return to the emulator and executing dumpsys power - do you see them then??
[Android Apps and Games] brandall:
Ok, I'll investigate further in regard to when the wakelock trigger is set - it may be that it normally doesn't register for 30 seconds. This method is a little haphazard, so I'll come back to you with something a little more scientific.

My next step (once the above works) is to get a user friendly output - You'll see above that the wakelock is attached to pid=2798. In the terminal, if you do a ps command and then scroll down until you find pid=2798 it will tell you what process it relates to. I need to write the logic for that somehow....

I need a coffee... thanks +1
[Android Apps and Games] nobnut:
Good one. This is all getting quite exciting now.

I'm going for a lie down with a damp towel on my head ;)
[Android Apps and Games] brandall:
Ha! I think you're boss might have something to say about that....

I think I best do some work too...
[Android Apps and Games] chamonix:
Your are very welcome. I am currently having a look at that code for two reasons:

- I want to see if there is more interesting data than the one shown, especially about apps having set wakelock

- I an looking at the changes from Froyo so see if there is a way to get the good old com.android.settings.battery_history.BatteryHistory working on Gingerbread (that's the dialog enabled by spareparts showing wakelock topX on Froyo)

My first task will be to try to isolate that/those dialogs in a separate app and then start tweaking.

If interested I'll keep you posted.

Cheers
[Android Apps and Games] brandall:
Very interested, please do keep me posted. If you stumble upon a way to output the wakelock information to a file that would be just what I'm after.........
[Android Apps and Games] azj:
The market thought I had the latest version of busybox so I uninstalled and re-installed it. Same problem.

I do have a toolbox but I do not have an uptime in /system/bin.

I had troubles opening/extracting the speedtest zip file with 7zip. I had to use the standard windows zip functionality. The speedtest task runs in about 3 seconds. I did have to try running it several times before getting the superuser popup to allow it to run.

Since speedtest displays the uptime correctly why doesn't uptime work in the terminal? Because uses busybox uptime rather than toolbox uptime?
[Android Apps and Games] nobnut:
When you say you have the latest version of Busybox (1.18.4 -stable or 1.19 - unstable), do you mean Busybox Installer? Have a look at my screenshot. I have marked my installed Busybox version. This is not the same as Busybox Installer from Market.
[Android Apps and Games] azj:
I have 1.18.4 installed just like you.
[Android Apps and Games] nobnut:
Sorry if you are doing this already, but are you typing

su

[Press enter]

toolbox uptime

[Press enter]
[Android Apps and Games] azj:
Yes. I just tried it again with the same results.

I type su enter and prompt changes from $ to #

I type toolbox uptime and get an error uptime: no such tool
[Android Apps and Games] nobnut:
Forget the 'su' and try just 'uptime'.
[Android Apps and Games] pulser_g2:
Which device and rom?

Sounds like it forgoes toolbox in favour of busybox, which isn't as good in terms of uptime command output ;)
[Android Apps and Games] nightranger73:
At this time I think we should rely on the same solution used by titanium backup: inject a common busybox/toolbox version on the script folder and execute this one instead of /system/xbin one.

This way we get a common playground... just a thought

Sent from my GT-I9100

If you find this post usefull please press the "Thanks" button
[Android Apps and Games] pulser_g2:
Agreed. If it is to be something noob proof, we have to find a toolbox that works on all sensible devices, and either fetch or include it, for use...
[Android Apps and Games] azj:
uptime and busybox uptime work with or without having done su first. As before, toolbox uptime fails either way.

This is on a original Motorola Droid, stock (but rooted) 2.2.2. No custom ROM.
[Android Apps and Games] nobnut:
+ 1

Sent from my Motorola StarTac using Voodoo
[Android Apps and Games] brandall:
I'm out and about folks, so will catch up on posts later.

New version of Tasker beta out that may fix the inbuilt read files issue...

Laters.
[Android Apps and Games] azj:
The new Tasker beta hasn't helped with my time_in_state file read problem.
[Android Apps and Games] nobnut:
Latest beta doesn't appear to have unlocked any goodness for me either.

EDIT: As the sun sets slowly in the West, I bid you all a fond farewell... until tomorrow.
[Android Apps and Games] strictlyrude27:
Use a script :) Something in perl:

use strict;
use warnings;

if (-e "/file/name"){ # -e checks for file existence
do_this_to_file();
}
elsif (-e "/other/file/name"){
do_this_other_thing();
}

Processing of course is dependent on the file itself; easiest but slowest thing to use is a regular expression. If the file is obviously delimited, say with spaces, you could always use a split() instead here. Regexps are a bit annoying to write, and all these system files are very regular in how they communicate information, so I think a split() is good enough. (split() in perl performs exactly like Variable Split in Tasker - it just takes an input string and splits it into an array based on the delimiter.)

I'll start paying attention to this thread to offer scripting help.

with the kernel UI I showed you before, brandall, this is how I'm checking for various files. I haven't really read this thread, but I can write you the script you'd need to process various file formattings.
[Android Apps and Games] strictlyrude27:
in perl:

use strict;
use warnings;

# Read in the $PID we wanted from a file..
open my $PID_FILE< "<", /location/of/file/to/read.txt
or die "Couldn't open /location/of/file/to/read.txt: $!";

my $pid = <$PID_FILE>; # slurp in the pid from the file. i assume that the pid and pid ONLY are written to this file.
chomp; # remove the newline if one exists
close $PID_FILE;

# catch the results of a ps with the PID number we cared about
my $process = `ps | grep $pid`; # backticks just execute the command in the system shell, then copy the results of that command.
# WILL BREAK IF SOMEHOW THE PID SHOWS UP ON MULTIPLE LINES.. we can apply a regexp
# to this to ensure that we only keep the line with the actual PID on it.
chomp $process;

# split result into array - last element of array is the process name
my @process = split /\s+/, $process;

# write out process name to a file
open my $PROCESS_NAME, ">", /location/of/file/process.txt
or die "Couldn't open /location/of/file/process.txt for writing: $!";

print {$PROCESS_NAME} $process[-1]; # again, last element of array is the process name
close $PROCESS_NAME;

I realize that this is doable with a shell script and Perl is kind of like sand blasting a soup cracker, but it gets the job done. If you have any questions about syntax, just ask.
[Android Apps and Games] brandall:
I've used my quota of 5 thanks for the day Strictly, otherwise you'd be +1!

In case anyone was wondering why I said I'd probably use Perl as the Interpreter because I know a user who knows about it ^^^^^^^^^^

Will go back through other posts shortly - gutted new beta didn't correct file reading issues..... ARGH! :mad:
[Android Apps and Games] waydownsouth:
The only downside is the dependency on sl4a & the perl interpreter... but, with Pent planning native shell commands, it may be a little easier in a shell script?

More than happy to help with that... :)

@strictlyrude - "like sandblasting a soup cracker" that's gold... :D
[Android Apps and Games] strictlyrude27:
:)

Shell commands and shell scripts would be ideal. It sucks to depend on SL4A and an interpreter, but it's extended Tasker for me so much that I can't imagine life without anymore. Almost all of my complex profiles depend on it.
[Android Apps and Games] waydownsouth:
True that, I've got a fair few Python scripts that run via Tasker too.

& having access to the Android API is a big plus...
[Android Apps and Games] brandall:
Thanks chaps - So, from what I've already learnt from Pulser, I have a symlink uptime file that references the toolbox symlink, that references the binary...

My question would therefore be, how do I 'package' the actual binary out of my device (because it provides the required output) that contains the 'regular' commands 'uptime' and 'ps'. I will also be using 'dumpsys power', but I think that command is separate to toolbox?

I had to include the entire post, just because your one previous to this was only ten minutes before... That's a pretty good 'off the top of my head in 10 minutes' post there Strictly... Well, I'm impressed anyway! :cool:

I hold my hands up - I don't understand the 'dependency' issue - I can only assume you mean it's reliant on another 'app' to launch and control it?? Thanks for the offer waydownsouth (WDS) - You know I'll be calling it in! Need inbuilt execute ASAP... I don't know if Pent prioritises the 'power users' or if his target market is more directed at "my wifi turns on when I'm near home! WHOOP!" <-- no disrespect to such users of course; that's where we all started.

You make it sound like multiple shell commands can be run in succession.... I'd assumed this was the case (a few months ago) but after Google'in for hours, only came up with '&&' as an extension to 'do something else now' <-- Really hope I'm wrong... I could do with multiple line commands right now...

It's a classic already....

Really appreciate everyone's input into this - only sorry I'm limited to 5 thanks per day, which nobnut claims all of as he's an early bird.... (although well deserved)

On that note, I should get my ass to bed - The Ultimate Alarm Clock goes off in 3hrs 50 minutes... That's something to look forward to...

Big thanks again.
[Android Apps and Games] 4silvertooth:
what is wrong.

--------------------------------

|| 06-07-2011 || 07.23 ||

|| DSP: 5 hrs 55 mins @ -528%||

|| %CPUDS of Uptime ||

--------------------------------

Active Tasker Profiles:

--------------------------------

|| ,DSDNotify,DSDDO, ||

--------------------------------

up time: 1 days, 13:13:03, idle time: 08:54:11, sleep time: 1 days, 00:18:25

PowerManagerService

ApmCommandThread KeyEvents qcril radio-interface

name expire_count wake_count

"rpc_server" 0 3

"rpc_reply" 0 3

"rpc_read" 0 3

"rpcrouter_smd_xprt" 0 890

"alarm" 0 661

"alarm_rtc" 203 597

"rpc_read" 0 890

"power-supply" 0 453

"rpc_reply" 0 90

"rpc_read" 0 890

"rpc_read" 0 156

"rpc_read" 0 154

"rpc_read" 0 890

"event1-1436" 0 35

"gpio_kp" 0 35

"rpc_read" 0 890

"usb_bus_active" 0 6

"rpc_read" 0 6

"rpc_read" 0 4

"power-supply" 0 181

"mmc_delayed_work" 252 890

com.android.inputmethod.latin

com.google.process.gapps

net.dinglisch.android.tasker

com.bel.android.dspmanager

org.zeam.core

android.process.acore

com.google.android.apps.plus

com.android.vending

com.google.android.googlequicksearchbox

net.dinglisch.android.ipack.glossysilverhd

com.cyanogenmod.stats

android.process.media

com.google.android.apps.uploader

com.android.defcontainer

com.opera.mini.android

com.android.email

de.elmicha.app.LocaleExecute

com.noshufou.android.su
[Android Apps and Games] pulser_g2:
Ok if you want multi line commands, why not store shell scripts in /data/local, check it's in $PATH, then run

sh /data/local/script1.sh arguments

;)

If you want to know what binaries to dump, send me the following:

1. A list of the commands to be run

2. The output of "which command" (ignore any arguments, just the actual executable name)

3. Output of ls -l in /system/bin and xbin

I'll then tell you what files to use
[Android Apps and Games] brandall:
Hi 4silvertooth, at the moment the logic is struggling with usb/power/displayon/displayoff/incall and the combinations of them. I suggest the data has become corrupt due to this. I'm working on fixing this in V7.

I notice that the task DSDDO is showing as active though, which it shouldn't unless your screen time-out is set to a very short time period.

If you open the task DSDDeviceBoot, make sure no tasks are running (the kill all button if it's there) and then press 'test' - this should reset your data.

If this persists, let me know - but for now, if you could try to unplug and replug the usb when the screen is on, it seems to cause less confusion.
[Android Apps and Games] brandall:
Brilliant - appreciated again. I had no idea you could execute a script in this way... I'm going to educated myself on Google later.

I'll ponder over which commands I'll need by the time V99 is out and get the list over to you! :)
[Android Apps and Games] bgx:
In my log I have it also! What means this? What app is sec-battery-monitor ?
[Android Apps and Games] nobnut:
Just seen the DSD profile on the Tasker Wiki profiles page. Thanks for the testing credit!

Sent from my HTC Flyer using vodka
[Android Apps and Games] brandall:
Hi bgx, I don't know... I don't have such a process that I can find, so I can't trace what it's related to. Neither does Google supply any results which is odd...

If you go back to post #223 where Nobnut and I discuss an execute command that will be included in the next release, there are instructions for where to include it and what to do to try and catch it in the output.

We need the PID=##### output to trace where it comes from - my guess of course is the inbuilt gingerbread battery stats, but I don't have this show up for me...

Good luck!

All well deserved :)
[Android Apps and Games] pulser_g2:
What he's after sounds like the built-in battery monitor stuff.
[Android Apps and Games] brandall:
Yes - notice from the signature he has an SII also...

V7 is now catching the wakelocks (present at display off), matching them to the app/process and returning what they are in the detective report. So in a few days when I have it ready it'll state the cause without the user having to hunt about...

I'll have my list of required binary ready at the same time :) - thanks in advance!
[Android Apps and Games] waydownsouth:
@brandall

this may be of interest:

dumpsys alarm

seems to have a whole lot of info that could be of use?