I'm trying to write a tasker script for Extreme Power Saver while at work. Secure settings has a feature, but doesn't seem to work. I'm hoping I can just have tasker execute a terminal (command line) script to activate EPS.
I accomplished this by launching an activity via secure settings. I can't detail exactly how I did it at the moment but it wasn't difficult, just tinker with the secure settings plugin. If I have some free time tomorrow, I'll explain in more detail.
TidusWulf said:
I'm trying to write a tasker script for Extreme Power Saver while at work. Secure settings has a feature, but doesn't seem to work. I'm hoping I can just have tasker execute a terminal (command line) script to activate EPS.
Click to expand...
Click to collapse
I just tried this and it seams to work.
http://forum.xda-developers.com/htc...wer-saving-t2808839/post53988422#post53988422
jsaxon2 said:
I just tried this and it seams to work.
http://forum.xda-developers.com/htc...wer-saving-t2808839/post53988422#post53988422
Click to expand...
Click to collapse
I saw that. but I don't want to have another app just for one command, when I use tasker already for 3 others. I want to keep it all together.
I've been using tasker to start epsm for months.
My setup I have is profile for screen off, run task Epsm
Tasks
Epsm
Run shell script
am start -a android.intent.action.MAIN -n com.htc.htcpowermanager/com.htc.htcpowermanager.extremepowersaver.ExtremePowerSaverConfirmActivity
And be sure to check run as root obviously.
Enjoy
And yes that can be ran in terminal however since you already use tasker you can automate it however you like
Thought I would elaborate a bit on this.
You can us the
am start
command to launch any app activity.
If you need to find what activity any app has just check their manifest inside the apk.
The only thing I haven't been able to figure out that I really would like to is to shut it off via terminal.
If you think of it logically the epsm is just a launcher so you can kill it via kill-server or force-stop command which will in fact bring you back home to your standard launcher however non of the setting will revert.
Same for if you instead just launch the default launcher via am start.
So if you can isolate exactly what triggers are sent (which I haven't isolated just yet(well I have but haven't been able to emulate via shell)) let me know if you have any progress or ideas.
:edit
i knew if i just sat down for a minute without distractions i would get it
easier and cleaner way to do it would be with the broadcast call
so to enable
Code:
am broadcast -a com.htc.intent.action.HtcPowerSaver.ExtremeAutoModeOn
to disable just
Code:
am broadcast -a com.htc.intent.action.HtcPowerSaver.ExtremeAutoModeOff
sent from space
runandhide05 said:
Code:
am broadcast -a com.htc.intent.action.HtcPowerSaver.ExtremeAutoModeOn
Click to expand...
Click to collapse
Thank you. I have a profile that checks for BUSY activities in my google calendar (such as my work schedule), so I just hit SCRIPT and put in the code (and checked run as root). works great. Thank you very much for your assistance with this.
TidusWulf said:
Thank you. I have a profile that checks for BUSY activities in my google calendar (such as my work schedule), so I just hit SCRIPT and put in the code (and checked run as root). works great. Thank you very much for your assistance with this.
Click to expand...
Click to collapse
No problem. I'm about to sit down and find the intent for the normal power saving profile as well because I find myself slightly annoyed waiting for extreme power saving mode to exit. So maybe a profile for extreme during off peak hours and just power saving during peak usage hours
for normal power saving mode its
am broadcast -a com.htc.intent.action.HtcPowerSaver.AutoModeOn
and Off for off of course
sent from space
Related
I've been banging this dilemma against search boxes for a couple days now and just can't figure out how to accomplish this gracefully. My goal is to have a profile based on power state to sign in and out of Google Talk. I just got the HTC Thunderbolt last week and after testing battery under various conditions I found that GTalk was causing over 5%/hour power consumption when running compared to less than 1%/hour when not running with normal phone usage.
So I have a context with the Power Source = Any and a the Locale Execute task (can't figure out how to replicate this in the native Component Intent task):
Code:
/system/bin/am start -a android.intent.action.MAIN -n com.google.android.talk/com.google.android.talk.SigningInActivity
This works great to start GTalk when the phone is plugged in to AC/USB power.
Now my problem is how to gracefully sign out of GTalk when the device goes back to battery power (and rely on GTalk Offline Emails to manually sign-in as needed). There is no SigningOutActivity and I don't even know if using am start command is appropriate for this. Watching logcat during a manual signout procedure did not illuminate what might be occurring in the background and how I would accomplish this.
This might help: http://www.jeffmixon.com/programmatically-sign-google-talk-android/:
Code:
am start -a android.intent.action.MAIN -n com.google.android.talk/com.google.android.talk.SignoutActivity -d content://com.google.android.providers.talk/accounts
How would you put this into Tasker? Would it go in as a script?
Have you ever tried having your phone lay on a table for some time and when you come back to pick it up, it had almost burned through the table because of the battery heat do to an app running the CPU on a constant 100%?
Or have you tried waking up two hours to late for work, because you alarm did not go off do to the phones battery running dry during the night?
Bad applications or problems with some back-end processes is a problem for most people. To get some help with this problem, I have been running the Watchdog app for the last 3 years. It is a great application that will alert you whenever an app or a process is running wild in the background. However there is one issue with this app. It only alerts you when there is a problem. This does not help much if you are to far away from the phone, if your phone is in silent mode or if you are sleeping.
I wrote the developer of the app to see if there was any plans for making a tasker plug-in so that profiles can be made to handle this. I have yet to get an answer. In the mean time, I have made a complete watchdog profile for tasker that does what the watchdog app does, only this profile will auto terminate any wild processes if the screen is turned off. If the screen is on, it will to what the watchdog app does and alert you of the problem. It could be that you was playing a game or running a benchmark, so auto terminate while the screen is on, would not be a good idea.
The profile however, will drain more battery than the watchdog app does. Because of this I have set the check interval for 15 minutes instead of the 5 minutes I used on the app. This reduces the drain to about the same amount.
And to save even more power, I have included a Data control profile that will turn off data/wifi/sync when the screen is off, as long as you are not connected to a power source or if you are downloading, uploading or streaming. In this case the profile will wait until this state changes before turning off anything. And while off, tasker will alow sync (email and such) once every 15 minutes.
Both profiles is included in the attached download below.
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
You can run the update script from the Busybox Installer thread to make sure that your phone will work with this profile.
Changelog (2012-11-18)
Reduced the time from where the screen turns off, to the time Data/Sync is disabled
Data/Sync will now turn back on when the screen is unlocked rather than turned on. No need to waste power if you just want to check the time or notifications (Which can be done from lock screen in Android 4.x)
Fixed the 15 minutes data check when the screen is off. It only executed once after the screen was turned off
_______________________
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Alte.78 said:
Wow! Your watchdog implementation looks great! Will adopt it on my phone over the weekend.
Now I have only one battery-drain-controlling dream left - being able to find out the apps holding the wakelock for too long to kill them automatically. The reason for this is that sometimes I find battery drain to go from usual 1% per hour to 10% per hour just because some badly written app has not released the wakelock.
Click to expand...
Click to collapse
Are you talking about BetterBatteryStats? I know that it tells you exactly how long since a point in time (which can be manually customized) that certain programs/tasks hold wakelocks.
But not sure about any kind of specific stratification that displays only programs that hold the lock too long to kill them automatically (assuming that's what you are wanting?).
And OP, these sound great - I'm importing them as we speak :highfive:
dk_zero-cool said:
Important!
The watchdog profile will need a proper busybox installed with proper symlinks for sed, grep and awk. It will also need a toolbox that supports top and ps with arguments.
_______________________
Click to expand...
Click to collapse
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
2am said:
I got all excited when reading about this until I read the Important section. After watchdog everything started getting confusing . I know I read somewhere about busybox but the other terms are all new to me...could someone explain it with a little more details on what I have to get/set up in order for this to work??
Click to expand...
Click to collapse
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
dk_zero-cool said:
The profile is using some linux commands to get a list of all current processes and their CPU usage. These commands needs to be available in order for the profile to work.
If you are using a custom ROM, then you are most likely to have all what is needed. Especially if you are using a more current custom ROM.
In order to test this, download a terminal app or enter an ADB shell (Hope you know what this is) and see if the command line
Code:
top -n 1 | sed -e 1,7d | grep -e '[0-9]\+%' | awk '{print $3}'
returns anything. If it does (Except errors), then you will have all that is needed.
Alternatively you could check my Better Busybox Integration thread which will make sure that your phone is setup to work with this.
Click to expand...
Click to collapse
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
2am said:
well I entered that command and got
invalid argument "-n". and then a bunch of other lines after that...and I checked your other thread and there's even more code language ...ugh, I think this is one of those threads that I need to leave alone because it's too much for me to handle...sucks too cause your set up sounds really awesome...thanx for trying to help me though
Click to expand...
Click to collapse
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
dk_zero-cool said:
I will make a more simple command fix for you tomorrow that will make your phone work with this without having you enter any code.
Click to expand...
Click to collapse
ah thank you soo much!!!
2am said:
ah thank you soo much!!!
Click to expand...
Click to collapse
I have updated the Busybox Installer script to make sure that it will work on newer devices other than MTD, and I have added a custom toolbox binary that will contain the proper options for these profiles.
Just check the first post at the buttom in the Important section. Fallow the link, download the installer and run it in your recovery. After that you can import the profiles from this thread into your Tasker application.
I created a simple Python script that brings up a menu to select different brightness levels by way of opening up the /sys/class/leds/backlight/brightness file and writes whatever value that you want to set the level at. An example would be 255 would be the max brightness and of course 1 would be almost no light. I like using this script because it allows me to set the brightness way lower than the stock lowest without use of an app like Screen Filter. There's a couple other scripts I wrote for toggling the keyboard and soft button leds too and I have the same issue with them.
This script will only work if I beforehand goto that specific file in Root Explorer and enable the read and write permissions for Others. Once I reboot the device though, those are always reset to disabled. If I run the script without enabling these of course I'll get a permission denied error.
How would I go about making those settings stick? I'm thinking I might have to incorporate some Java somewhere in the Python to do this but I'm not sure. I haven't learned Java yet
Can anyone give me some advice or some kind of direction? I will greatly appreciate any help and will thank you with hitting the Thanks button
you can write a start-up script that will chmod the file/s when the device is turned on.
chevyowner said:
you can write a start-up script that will chmod the file/s when the device is turned on.
Click to expand...
Click to collapse
Thanks so much for your advice....now I can kill two birds with one stone....not only will I achieve my objective but also learn some about those other scripts you speak of
Hey, I was curious if anyone knew a way to make it so that extreme power saving mode would automatically kick in when I turned my screen off. Now I know this may not be helpful for some people but as this is my personal phone I really don't need emails to be pushed to me right away and what not.
I've searched throughout tasker to find a way to do this but I cannot find a way for the life of me.
Any ideas or suggesting a would be appreciated and helpful. Thanks!
Sent from my HTC6525LVW using XDA Premium 4 mobile app
MattCropley said:
Hey, I was curious if anyone knew a way to make it so that extreme power saving mode would automatically kick in when I turned my screen off. Now I know this may not be helpful for some people but as this is my personal phone I really don't need emails to be pushed to me right away and what not.
I've searched throughout tasker to find a way to do this but I cannot find a way for the life of me.
Any ideas or suggesting a would be appreciated and helpful. Thanks!
Sent from my HTC6525LVW using XDA Premium 4 mobile app
Click to expand...
Click to collapse
You could just use Greenify and hibernate the GMail app.
dadams312 said:
You could just use Greenify and hibernate the GMail app.
Click to expand...
Click to collapse
Well it's not just the email app. I was just using that as an example. It's just when it's on extreme power saving mode my phone can last for days. And I often forget to turn it on when I'm done with my phone. I wish it was possible to use it with tasker. It be so easy just to turn screen off and it automatically kick in
Sent from my HTC6525LVW using XDA Premium 4 mobile app
There has got to be a way... I'll play with it and let u know
Edit
so i got it to work pretty simple too. and of course you can add any additional variables. such as only do during certain hours and so forth, or if you seriously want it in extreme power saving mode all the time that the screen is off, then its rather simple.
open tasker,
add profile for event, click display, and display off
click new task for this case name it EPSM or what every you'd like
click the + and select action category script, then Run Shell
under command enter this
Code:
am start -a android.intent.action.MAIN -n com.htc.htcpowermanager/com.htc.htcpowermanager.extremepowersaver.ExtremePowerSaverConfirmActivity
and check the box for "use Root"
back out ensure you now see a profile for Display Off and its on and the task is set to EPSM and we are all good.
now when every you screen is off the phone will enter extreme power saving mode.
turn screen back on and you will be in EPSM, and just click exit to get out,
**
a few notee / things to point out, is that you could also add a timer, so that if the display is off, for X amount of time then it triggers the script, or only run between the times of 11 pm - 8 am... the possibilties are endless.
Have fun with this.
I mean like when the power button was pressed or when it went to sleep or when an app was used any kind of log activity really
As long it's not turned off Android logs each activity, where it doesn't matter whether Android is rooted or not: you can view the log via performing a LOGCAT.
xXx yYy said:
As long it's not turned off Android logs each activity, where it doesn't matter whether Android is rooted or not: you can view the log via performing a LOGCAT.
Click to expand...
Click to collapse
When I open a logcat app it shows the logcat from the moment I opened the app forward. I want to see it a few hours backwards.
Then you need to enable "Developer Oprions" (search around these forums for a HowTo, it's been documented enough), increase the size of the log buffer and enable the trace(s) you need. Fair warning, it's not for the "just-being-curious/nosy" amateur kind of people, it's best to do your homework before you jump into the deep end.
Size of a logcat's ring-buffer ( main, system, crash ) is determined by the kernel, found in */drivers/staging/android/logger.c.
To temporarily set the size of all buffers you e.g. would run
Code:
adb logcat -G 16M
If you need to change the value by the Android shell in a way that survives a reboot, you can use the property persist.logd.size like this
Code:
adb shell "setprop persist.logd.size 16M"
what requires Android is got rooted