Related
I originally found the fix in the SuperCharger Thread when I found that my Flush-O-Matic script wasn't working properly on my Sony Z1.
See original posting here.
zeppelinrox said:
Hey I realized yesterday that Flush O Matic doens't work properly on newer kernels.
Well it works, but it doesn't wait for the screen to go off before flushing.
A little googlie told me that the newer kernels no longer have the /sys/power/wait_for_fb_sleep file.
Normally, FOM will try and read it's contents (but it's unreadable) and it just hangs until the device goes to sleep.
When it goes to sleep, that file can be read and the script gets "unhung" and flushes.
And when the file is missing, well FOM will just spit out errors (check the log) and dump cache without uh... waiting for the fan to be turned on...
BUTT (yeah, thats a big butt!) I fingered out another way for newer kernels... heh.
Check it via PC... with the screen on do this
Code:
adb shell
su
while [ "`cat /sys/class/graphics/fb0/dynamic_fps`" ]; do sleep 1; done; echo " OK Flush Time!"
Who's your daddy!? LOL
While the screen is on it should hang there until you turn off the screen.
When the screen goes off, it will pronounce what "time" it is...
I'll probably do sleep 10 instead of sleep 1 tho to minimize battery suckage.
Click to expand...
Click to collapse
This fix would be applicable to various scripts on xda that will get outdated due to the missing wait_for_fb_sleep/wake files on some device/kernel combinations.
Currently effected hardware, that I'm aware so far: some Sony, Moto and Nexus devices using kernel version 3.3 or above.
These scripts change things or do things depending on whether the screen turns off or turns on.
Examples are cpu governor scripts or other screen state scaling scripts.
As mentioned above, it had effected my FOM script which dumps caches at a user defined interval.
However, when the time is up, it will actually wait until the screen is off if the screen happens to be on at the time.
So if you have a misbehaving script due to the missing /sys/power/wait_for_fb_sleep/wake files, you should have 2 other files that you can use.
1. /sys/class/graphics/fb0/dynamic_fps
2. /sys/class/graphics/fb0/show_blank_event
File contents with screen off:
Code:
[email protected]:/ $ cat /sys/class/graphics/fb0/dynamic_fps
[email protected]:/ $ cat /sys/class/graphics/fb0/show_blank_event
panel_power_on = 0
[email protected]:/ $
File contents with screen on:
Code:
[email protected]:/ $ cat /sys/class/graphics/fb0/dynamic_fps
60
[email protected]:/ $ cat /sys/class/graphics/fb0/show_blank_event
panel_power_on = 1
[email protected]:/ $
So when the screen is off, dynamic_fps is empty but has a value (60 in my case) when the screen is on.
I preferred to take advantage of that file.
However some may like to use the contents of show_blank_event and check whether panel_power_on = 0 (off) or panel_power_on = 1 (on).
Of course, a script will have to check and decide whether to use the wait_for_fb_sleep file or use the new way.
So a fixed script will look something like:
Code:
if [ -f "/sys/power/wait_for_fb_sleep" ]; then
echo "Android is now `cat /sys/power/wait_for_fb_sleep`!"
else while [ "`cat /sys/class/graphics/fb0/dynamic_fps`" ]; do sleep 10; done
echo "Android is now sleeping!"
fi
So if that code is ran when the screen is on, when the screen is off, the output would be Android is now sleeping! and it won't matter if you have the wait_for_fb_sleep file
Alternately, to do something when the screen turns on...
Code:
if [ -f "/sys/power/wait_for_fb_wake" ]; then
echo "Android is now `cat /sys/power/wait_for_fb_wake`!"
else while [ ! "`cat /sys/class/graphics/fb0/dynamic_fps`" ]; do sleep 10; done
echo "Android is now awake!"
fi
Of course, when the screen comes on, the output will be Android is now awake!
I used sleep 10 so that it doesn't do any needless work.
Of course sleep 1 would give an instant reaction but isn't very battery or cpu friendly.
You can decide for yourself how long is a good sleep interval between checks.
Anyhow, hope that helped
Nice! Will try on my VU
sent from my LG-P895 using Tapatalk bajakan
Thank you
I wanted this to implement a small idea of mine ,also scanned through the 11k+ lines from supercharger script but couldn't find screen off thingy
Yeah,finding a small line in FastEngineFlush.sh also was hard
But this post helped!
The reason why your are called a XDA Scripting Genius! :good:
Really useful!
Madaditya said:
I wanted this to implement a small idea of mine ,also scanned through the 11k+ lines from supercharger script but couldn't find screen off thingy
Yeah,finding a small line in FastEngineFlush.sh also was hard
But this post helped!
The reason why your are called a XDA Scripting Genius! :good:
Really useful!
Click to expand...
Click to collapse
Whats your idea?
And yeah, even the flush script is rather complex lol
zeppelinrox said:
Whats your idea?
And yeah, even the flush script is rather complex lol
Click to expand...
Click to collapse
LOL yeah.
Wanted to make a background script that turns your data connection off on screen off + one minute and enables data on screen on.
Something close to Stamina mode in Sony Devices.
Reason,i face considerable battery drain on Custom roms,and a xperia user always misses Stamina mode
Madaditya said:
LOL yeah.
Wanted to make a background script that turns your data connection off on screen off + one minute and enables data on screen on.
Something close to Stamina mode in Sony Devices.
Reason,i face considerable battery drain on Custom roms,and a xperia user always misses Stamina mode
Click to expand...
Click to collapse
Nice idea!
Whats the command to disable data?
zeppelinrox said:
Nice idea!
Whats the command to disable data?
Click to expand...
Click to collapse
svc data enable/disble
for wifi:
svc wifi enable/disable
Madaditya said:
svc data enable/disble
for wifi:
svc wifi enable/disable
Click to expand...
Click to collapse
Oh nice.
You learned me something lol
I couldn't find /sys/class/graphics/fb0/show_blank_event or /sys/class/graphics/fb0/dynamic_fps or /sys/power/wait_for_fb_wake/sleep. Instead i am using this /sys/class/leds/lcd-backlight/brightness. 0 will mean screen is off, any other value for screen on. Thanks You could add this in OP
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
Deleted
So I've been browsing for the past 2 hours on wifi and these are my stats.
Battery: 2200 mAh
SoC: Extremely Power Hungry MT6591
Brightness: Adequate
Now at 35%, the phone was being used pretty much constantly (chrome, a movie in mx player, imgur, 2 hours on whatsapp, light CoC)
Here are the results.
19%. And this is the max I could manage. Going to plugin now.
Testing out now...Thanks!!
---------- Post added at 12:10 PM ---------- Previous post was at 12:02 PM ----------
Adithya FRK said:
Blue Blood Modified Battery Profile (SOT) for L Speed + GovTuner
NOTE: This profile and the configurations for GovTuner is entirely based upon the need for more SOT or 'screen-on-time'. Performance improvements are not the 'primary' objective, but there are some.
Name: Sorry but I couldn't make up a better one. LOL.
This profile will try its best to give you a better screen on time taking into consideration there will be some decrease in performance (some visible, some not).
Installation Instructions
Part 1 - L Speed
1. Download the .zip file attached.
2. Open it with any file manager/archiver and you should see the profile file.
3. Goto your SD Card -> LSpeedBackup (create folder if it doesn't exist) and paste the file inside the .zip there.
4. Open L Speed -> Backup -> Restore: Blue Blood.
L Speed's done.
Part 2 - GovTuner
1. Visit GovTuner's XDA thread and download the latest zip file.
2. Flash the zip file and install 'Terminal Emulator' from playstore.
3. Open 'Terminal Emulator', and type 'su' and enter. Grant the SuperSU request and you will now be in a root shell.
4. Now type 'govtuner' and enter.
5. Choose battery profile by typing '1' and touching enter.
6. After activating battery profile, enter 'i' and enter '2' as the value.
7. Now you can press the 'X' on the top right hand corner to close the window.
GovTuner is now all setup.
You are pretty much ready now. Enjoy your extra SOT!!
I SERIOUSLY RECOMMEND USING AppOpsXposed, Greenify, Amplify and Powernap with this to get rid of the idle drain because in the end that too translate to a better SOT. :highfive: (The below results are obtained with the help of those applications too)
My phone which is an extremely battery hungry thing needs to be charged atleast 3 times a day to last from morning to night. With this I've managed to get away with just 1 charge for 14 hours (4-4.5 hours of SOT vs 1-2 hours).
Please do reply back with your experiences. I'm waiting for some happy faces. :fingers-crossed:
Also criticisms. :angel:
Credits: Debuffer (GovTuner), Paget96 (L Speed)
Click to expand...
Click to collapse
Any alternatives to AppOpsXposed, Amplify and Powernap that don't require Xposed?? Already use Greenify and Servicely.
jeraspie28 said:
Testing out now...Thanks!!
---------- Post added at 12:10 PM ---------- Previous post was at 12:02 PM ----------
Any alternatives to AppOpsXposed, Amplify and Powernap that don't require Xposed?? Already use Greenify and Servicely.
Click to expand...
Click to collapse
You can use AppOps from play store which doesn't need xposed. Alternatives to Powernap? Naptime works. Amplify doesn't have an alternative to my knowledge sorry
Hey, thanks for sharing this! Much needed for my phone htc desire 816 (a5dwg) running lineage 7.1.1 and at any rom, it is hungry. I mean literally I've purchased a new original 2600mAh battery for this reason. Still the problem persists. Today only, I've charged the phone to full and kept it on airplane and silent (took the phone to school ), and found that after 3 hours, battery is 20-25% reduced. I'm a little noob that's why I'm asking you that "what are the steps that should be followed / apps to be installed to maintain the battery like yours
Thanks in advance ?
singhjot0020 said:
Hey, thanks for sharing this! Much needed for my phone htc desire 816 (a5dwg) running lineage 7.1.1 and at any rom, it is hungry. I mean literally I've purchased a new original 2600mAh battery for this reason. Still the problem persists. Today only, I've charged the phone to full and kept it on airplane and silent (took the phone to school ), and found that after 3 hours, battery is 20-25% reduced. I'm a little noob that's why I'm asking you that "what are the steps that should be followed / apps to be installed to maintain the battery like yours
Thanks in advance ?
Click to expand...
Click to collapse
Glad I can help. Something is keeping your phone awake all that time that its's not going to deep sleep. That's mostly Google to blame but let's start with the basics
Before that don't call yourself a noob. You got a custom ROM running, most people I know can't even do that.
To fix Idle Drain
First find if you have Idle drain.
Install Better Battery Stats and open it, grant root etc. Now plug the phone to the charger and hit refresh. Now unplug the charger, turn the screen off for a minute or so.
Now turn it on, you should see the device state. If it says Deep Sleep 0%, then the below things can help you.
Disable background Wi-Fi scanning.
Your phone scans for WiFi even when you turn it off. The steps below are based on my Lollipop 5.1, but I believe it's the same on 7.1 too.
Goto Settings -> Wifi -> The three buttons on the top right -> Advanced
There disable 'Network Notifications', 'Scanning Always Available' and 'Keep Wifi awake during sleep'.
Greenify
You must already be using this.
As a rule of thumb, greenify any app which requires an internet connection, those keep waking the system over and over again. Just make sure you don't add any core system apps.
If you have Facebook's app installed, remove it. It's the biggest battery hogging app ever happened (i don't agree that's made) in human history. Use it in chrome. Or any wrapper apps from Play store: Metal, Friendly are a few options.
If you have xposed installed,
Powernap
Set it to endurance mode and that's all. Whitelist amplify, greenify and lspeed. You can whitelist more apps later if you feel the need.
Amplify
This is a must in reducing wakelocks. Unfortunately I can't write the whole procedure here because it's been done before. Check this.
http://forum.xda-developers.com/android/general/guide-extreme-battery-life-t3095884
Still, every phone is unique. After following that thread, IF your device still isn't sleeping (after trying the below too), try blocking more wakelocks. Do a search if you are not sure of a particular wakelock. It will take some time, but it will be worth it.
AppOpsXposed
You can disable some of Google's data collection and analytics whatever stuff using this. Follow this nice thread. It helps massively.
https://forum.xda-developers.com/crossdevice-dev/sony/existenz-hacks-tweaks-battery-life-t3516705
If you have managed to get that deep sleep in BetterBatteryStats almost 90% of the time the screen was off, then congratulations you have fixed your Idle drain.
Reply back with your experiences. :fingers-crossed:
Adithya FRK said:
Glad I can help. Something is keeping your phone awake all that time that its's not going to deep sleep. That's mostly Google to blame but let's start with the basics
Before that don't call yourself a noob. You got a custom ROM running, most people I know can't even do that.
To fix Idle Drain
First find if you have Idle drain.
Install Better Battery Stats and open it, grant root etc. Now plug the phone to the charger and hit refresh. Now unplug the charger, turn the screen off for a minute or so.
Now turn it on, you should see the device state. If it says Deep Sleep 0%, then the below things can help you.
Disable background Wi-Fi scanning.
Your phone scans for WiFi even when you turn it off. The steps below are based on my Lollipop 5.1, but I believe it's the same on 7.1 too.
Goto Settings -> Wifi -> The three buttons on the top right -> Advanced
There disable 'Network Notifications', 'Scanning Always Available' and 'Keep Wifi awake during sleep'.
Greenify
You must already be using this.
As a rule of thumb, greenify any app which requires an internet connection, those keep waking the system over and over again. Just make sure you don't add any core system apps.
If you have Facebook's app installed, remove it. It's the biggest battery hogging app ever happened (i don't agree that's made) in human history. Use it in chrome. Or any wrapper apps from Play store: Metal, Friendly are a few options.
If you have xposed installed,
Powernap
Set it to endurance mode and that's all. You can whitelist apps later if you feel the need.
Amplify
This is a must in reducing wakelocks. Unfortunately I can't write the whole procedure here because it's been done before. Check this.
http://forum.xda-developers.com/android/general/guide-extreme-battery-life-t3095884
Still, every phone is unique. After following that thread, IF your device still isn't sleeping (after trying the below too), try blocking more wakelocks. Do a search if you are not sure of a particular wakelock. It will take some time, but it will be worth it.
AppOpsXposed
You can disable some of Google's data collection and analytics whatever stuff using this. Follow this nice thread. It helps massively.
https://forum.xda-developers.com/crossdevice-dev/sony/existenz-hacks-tweaks-battery-life-t3516705
If you have managed to get that deep sleep in BetterBatteryStats almost 90% of the time the screen was off, then congratulations you have fixed your Idle drain.
Reply back with your experiences. :fingers-crossed:
Click to expand...
Click to collapse
Thankyou so much, will try this surely ?
Adithya FRK said:
Glad I can help. Something is keeping your phone awake all that time that its's not going to deep sleep. That's mostly Google to blame but let's start with the basics
Before that don't call yourself a noob. You got a custom ROM running, most people I know can't even do that.
To fix Idle Drain
First find if you have Idle drain.
Install Better Battery Stats and open it, grant root etc. Now plug the phone to the charger and hit refresh. Now unplug the charger, turn the screen off for a minute or so.
Now turn it on, you should see the device state. If it says Deep Sleep 0%, then the below things can help you.
Disable background Wi-Fi scanning.
Your phone scans for WiFi even when you turn it off. The steps below are based on my Lollipop 5.1, but I believe it's the same on 7.1 too.
Goto Settings -> Wifi -> The three buttons on the top right -> Advanced
There disable 'Network Notifications', 'Scanning Always Available' and 'Keep Wifi awake during sleep'.
Greenify
You must already be using this.
As a rule of thumb, greenify any app which requires an internet connection, those keep waking the system over and over again. Just make sure you don't add any core system apps.
If you have Facebook's app installed, remove it. It's the biggest battery hogging app ever happened (i don't agree that's made) in human history. Use it in chrome. Or any wrapper apps from Play store: Metal, Friendly are a few options.
If you have xposed installed,
Powernap
Set it to endurance mode and that's all. You can whitelist apps later if you feel the need.
Amplify
This is a must in reducing wakelocks. Unfortunately I can't write the whole procedure here because it's been done before. Check this.
http://forum.xda-developers.com/android/general/guide-extreme-battery-life-t3095884
Still, every phone is unique. After following that thread, IF your device still isn't sleeping (after trying the below too), try blocking more wakelocks. Do a search if you are not sure of a particular wakelock. It will take some time, but it will be worth it.
AppOpsXposed
You can disable some of Google's data collection and analytics whatever stuff using this. Follow this nice thread. It helps massively.
https://forum.xda-developers.com/crossdevice-dev/sony/existenz-hacks-tweaks-battery-life-t3516705
If you have managed to get that deep sleep in BetterBatteryStats almost 90% of the time the screen was off, then congratulations you have fixed your Idle drain.
Reply back with your experiences. :fingers-crossed:
Click to expand...
Click to collapse
I've installed "L Speed" and greenify from play store
& I've shred my stats. Pls look and suggest improvements
singhjot0020 said:
I've installed "L Speed" and greenify from play store
& I've shred my stats. Pls look and suggest improvements
Click to expand...
Click to collapse
Can you also post a screenshot of your battery stats
Adithya FRK said:
Can you also post a screenshot of your battery stats
Click to expand...
Click to collapse
Sorry, I've switched to stock to check battery capabilities but still problem persists
Battery droppes from 100 to 83 in 30-35 minutes
in govtuner change the gov to ondemand, i guess u use perfomance.
What can I do, I got a notification that L speed us eating my battery...but if optimized will not work as it should right?
Today update my Rom and got error. Not working because if use 3th party kernel ini.t emulator...but I'm not using one.
Sir_gpm said:
What can I do, I got a notification that L speed us eating my battery...but if optimized will not work as it should right?
Today update my Rom and got error. Not working because if use 3th party kernel ini.t emulator...but I'm not using one.
Click to expand...
Click to collapse
What ROM are you using?
FreedomOS for oneplus 3t.
@Adithya FRK
Choosing battery profile from govtuner is the same as choosing it from Lspeed CPU menu, right? Or is there some significant change between the two?
ninjanmizuki said:
@Adithya FRK
Choosing battery profile from govtuner is the same as choosing it from Lspeed CPU menu, right? Or is there some significant change between the two?
Click to expand...
Click to collapse
Both are the same. See post #2 of GovTuner's official thread here - https://forum.xda-developers.com/an...mod-gov-tuner-project-29th-june-2016-t3407828
But don't enable both of them at the same time.
After 1 whole month of tweaking with various functions of L Speed, finally found a combination to improve the battery even more.
BlueBlood v2.1 (Download link in Post #1)
Tested on L Speed Beta from Play Store.
Adithya FRK said:
After 1 whole month of tweaking with various functions of L Speed, finally found a combination to improve the battery even more.
BlueBlood v2.1 (Download link in Post #1)
Tested on L Speed Beta from Play Store.
Click to expand...
Click to collapse
Sir, can u share your KA settings, such as your govenor, i/o
Sent from my ASUS_Z00A using Tapatalk
I tried so many way and failed to work smart charging on Latest Stock ROM. Did anyone able to work "Advanced Charging Controller (ACC)"?
I have used ACC for a while now. What problem are you facing?
I use the latest stock ROM with blu_spark kernel and the charging switch located at /sys/kernel/debug/google_charger/input_suspend
IntenseColor said:
I have used ACC for a while now. What problem are you facing?
I use the latest stock ROM with blu_spark kernel and the charging switch located at /sys/kernel/debug/google_charger/input_suspend
Click to expand...
Click to collapse
Can I use Battery Charge Limit App with "/sys/kernel/debug/google_charger/input_suspend,0,1"?
Why are you in badly need of "smart charging"?
Would also like an answer on this can't seem to get any of the acc settings to stick and it always charges past the % I set
In a terminal emulator on your phone run:
Code:
su
echo 80 > /sys/devices/platform/soc/soc:google,charger/charge_stop_level
This will make your phone stop charging at 80%. You can change the percentage by changing the number next to echo in the code above.
If you want to make this persistent, place the command as a script (a sample is attached) in
Code:
/data/adb/service.d
using a root browser. Note: you may need Magisk installed for this to work.
greatest125 said:
In a terminal emulator on your phone run:
Code:
su
echo 80 > /sys/devices/platform/soc/soc:google,charger/charge_stop_level
This will make your phone stop charging at 80%. You can change the percentage by changing the number next to echo in the code above.
If you want to make this persistent, place the command as a script (a sample is attached) in
Code:
/data/adb/service.d
using a root browser. Note: you may need Magisk installed for this to work.
Click to expand...
Click to collapse
How can i go back to default value after that?
Rafiul Bari Chowdhury said:
How can i go back to default value after that?
Click to expand...
Click to collapse
When you reboot, it automatically resets to the default value. This is why I run a script at boot.
You can also go back to the default value at any time by entering the following commands in a terminal emulator on your phone:
Code:
su
echo 100 > /sys/devices/platform/soc/soc:google,charger/charge_stop_level
greatest125 said:
When you reboot, it automatically resets to the default value. This is why I run a script at boot.
You can also go back to the default value at any time by entering the following commands in a terminal emulator on your phone:
Code:
su
echo 100 > /sys/devices/platform/soc/soc:google,charger/charge_stop_level
Click to expand...
Click to collapse
Thank you so so much. I have got everything.
greatest125 said:
In a terminal emulator on your phone run:
Code:
su
echo 80 > /sys/devices/platform/soc/soc:google,charger/charge_stop_level
This will make your phone stop charging at 80%. You can change the percentage by changing the number next to echo in the code above.
If you want to make this persistent, place the command as a script (a sample is attached) in
Code:
/data/adb/service.d
using a root browser. Note: you may need Magisk installed for this to work.
Click to expand...
Click to collapse
Well, either this script isn't working the way I thought it would or I did something wrong... but I think it's the former.
So I put that battery.sh script in /data/adb/service.d yesterday set the permissions & rebooted. I let the battery run down below 80% overnight and this morning I plugged it back in around 60%. Didn't charge at all, back didn't get warm & also didn't get the "Charging Rapidly" display on the always on display. Let it sit for at least an hour and it didn't charge a lick. Removed the script, rebooted, and voila charging again.
Obviously didn't do what it was supposed to... darn it
andyxo said:
Well, either this script isn't working the way I thought it would or I did something wrong... but I think it's the former.
So I put that battery.sh script in /data/adb/service.d yesterday set the permissions & rebooted. I let the battery run down below 80% overnight and this morning I plugged it back in around 60%. Didn't charge at all, back didn't get warm & also didn't get the "Charging Rapidly" display on the always on display. Let it sit for at least an hour and it didn't charge a lick. Removed the script, rebooted, and voila charging again.
Obviously didn't do what it was supposed to... darn it
Click to expand...
Click to collapse
Interesting... you have Magisk installed and you are trying this on a Google Pixel 4a? If so, a reason why this might not be working could be a permission issue. Using your root browser of choice, navigate to /data/adb/service.d and change the permissions of the script to 744. Please see the attached screenshot for more details (I use this root browser). After changing the permissions, drain your battery and try again. \
Hope this helps!
andyxo said:
Well, either this script isn't working the way I thought it would or I did something wrong... but I think it's the former.
So I put that battery.sh script in /data/adb/service.d yesterday set the permissions & rebooted. I let the battery run down below 80% overnight and this morning I plugged it back in around 60%. Didn't charge at all, back didn't get warm & also didn't get the "Charging Rapidly" display on the always on display. Let it sit for at least an hour and it didn't charge a lick. Removed the script, rebooted, and voila charging again.
Obviously didn't do what it was supposed to... darn it
Click to expand...
Click to collapse
It worked perfectly for me.
greatest125 said:
Interesting... you have Magisk installed and you are trying this on a Google Pixel 4a? If so, a reason why this might not be working could be a permission issue. Using your root browser of choice, navigate to /data/adb/service.d and change the permissions of the script to 744. Please see the attached screenshot for more details (I use this root browser). After changing the permissions, drain your battery and try again. \
Hope this helps!
Click to expand...
Click to collapse
Thanks kindly for your very detailed instructions post... indeed it seems to have been a permissions issue as previously I had all the squares checked off, not just the five in your screenshot. It has been working fine the past two days so hopefully I got it squared away now
Just curious to know though if it's normal (with this added .sh file) that with the phone still plugged in that the "Always On" Display says "80% - Charging rapidly" even though the charging has stopped at 80%?
And once the charging has stopped at 80% I am assuming that it's okay to just leave it plugged in for a while before heading out as the phone has stopped charging. Reason being, I don't want to hover over the phone thinking oh jeez, it's hit 80% now so I gotta unplug it right away to prevent battery damage. Cheers
andyxo said:
Thanks kindly for your very detailed instructions post... indeed it seems to have been a permissions issue as previously I had all the squares checked off, not just the five in your screenshot. It has been working fine the past two days so hopefully I got it squared away now
Just curious to know though if it's normal (with this added .sh file) that with the phone still plugged in that the "Always On" Display says "80% - Charging rapidly" even though the charging has stopped at 80%?
And once the charging has stopped at 80% I am assuming that it's okay to just leave it plugged in for a while before heading out as the phone has stopped charging. Reason being, I don't want to hover over the phone thinking oh jeez, it's hit 80% now so I gotta unplug it right away to prevent battery damage. Cheers
Click to expand...
Click to collapse
I honestly have no idea. I assume when it hits 80, the battery stops accepting charge although the "Rapidly Charging" label continues to be shown. Anyone have an idea why?
Hey xda-Community!
I recently wanted to reduce my idle drain and searched for ways to edit Android Doze settings, because I remembered seeing a tutorial that said you can change deviceidle-constants, that dictate how Doze works (how fast it kicks in, how long it kicks in, light/deep doze).
I tried all those old tutorials, but I quickly realized the old ways to change the parameters are deprecated, so I asked people on android.stackexchange.com and someone actually gave me the answer (thanks Andrew) (https://android.stackexchange.com/questions/247680/is-device-idle-constants-deprecated-in-android-12).
This works from Android 12 on and is achieved using a shell.
Commands:
Note: When using an adb shell, you have to put "adb shell" before those commands. I'll just put the bare commands here, you add what you have to add.
Checking the settings:
You can check your current Doze settings (and statistics) with "dumpsys deviceidle".
Changing a setting;
Every parameter has to be set individually. It's not that bad tho, as you only have to do this once.
Syntax is: "device_config put device_idle [KEY] [VALUE]".
One example: "device_config put device_idle light_after_inactive_to 30000"
You can check "dumpsys deviceidle" to see what keys there even are. To help you out, here's an explanation of what each key actually sets. You can also get a visual sense of how the light mode and the deep mode work (not my work, thanks to easz from github).
Spoiler: My recommended settings
First; reset parameters with: "device_config reset trusted_defaults device_idle"
light_after_inactive_to 30000
light_pre_idle_to 120000
light_idle_to 300000
light_idle_factor 2
light_max_idle_to 900000
light_idle_maintenance_min_budget 30000
light_idle_maintenance_max_budget 180000
inactive_to 900000
sensing_to 0
locating_to 0
motion_inactive_to 0
idle_after_inactive_to 900000
idle_pending_to 60000
max_idle_pending_to 120000
idle_pending_factor 2
idle_to 900000
max_idle_to 21600000
idle_factor 2
wait_for_unlock true
I also wrote a windows batch script (works via adb, you have to rename the .txt file to .bat) and a bash file that changes the parameters to my recommendations. See attachments.
will these settings persists even after a reboot? or upgrading rom?
maxs8007 said:
will these settings persists even after a reboot? or upgrading rom?
Click to expand...
Click to collapse
yes, these will stick after a reboot. Not sure about upgrading, but I would guess that it'll stay, because we don't actually modify anything on the system partition
@Doomkopf for me those settings won't stick.
For testing purpose I just applied those yesterday morning:
adb shell device_config put device_idle motion_inactive_to 300000
adb shell device_config put device_idle light_after_inactive_to 180000
This morning they are back to stock values. Any ideas? :S
Utini said:
@Doomkopf for me those settings won't stick.
For testing purpose I just applied those yesterday morning:
adb shell device_config put device_idle motion_inactive_to 300000
adb shell device_config put device_idle light_after_inactive_to 180000
This morning they are back to stock values. Any ideas? :S
Click to expand...
Click to collapse
I set mine like 6 weeks ago, it's still set. I miss many information, what phone do you use, what ROM, how you check if it's still set etc
Doomkopf said:
I set mine like 6 weeks ago, it's still set. I miss many information, what phone do you use, what ROM, how you check if it's still set etc
Click to expand...
Click to collapse
Hi, oh well here are some more infos:
Pixel 6 Pro
Latest Android 13 Stock ROM
Kirisakura Kernel
I check via "adb shell dumpsys deviceidle".
I set it all your settings on friday and today (monday) there are back to stock values.
Previously I tried settings my own settings on wednesday morning and had stock values on the next day already as well :S
Utini said:
Hi, oh well here are some more infos:
Pixel 6 Pro
Latest Android 13 Stock ROM
Kirisakura Kernel
I check via "adb shell dumpsys deviceidle".
I set it all your settings on friday and today (monday) there are back to stock values.
Previously I tried settings my own settings on wednesday morning and had stock values on the next day already as well :S
Click to expand...
Click to collapse
That doesn't sound good I'd check right after setting it, so you can see if it was changed at all (which I assume). If it indeed gets set and unset again, you could check this github repo (https://github.com/easz/doze-tweak) at "Caveat".
Those values got reset in the past already, but as it didn't happen to me, I thought Google stopped doing that. Maybe that old workaround still works Otherwise, you'll have to flash a custom rom I guess xD
EDIT: I also recommend looking at values easy to distinguish. For example, "sensing_to" and "locating_to" were nonzero before, now they are zero (for me), so these values are easy to compare for me. The values you need to look at are at the most upper part of the output, but I guess you already knew that
Doomkopf said:
That doesn't sound good
Click to expand...
Click to collapse
Did you ever mess with any other settings using device_config before? Like the number phantom processes, empty or cached processes, ActivityManager tweaks or anything else? Because I assume you did (and using Android 10 or higher) and disabled the settings sync back to the defauls.
Did you ever use the below command?
device_config set_sync_disabled_for_tests persistent
What does the below commands says?
device_config is_sync_disabled_for_tests
Perhaps it says true? If yes that's why your settings aren't changing.
crok.bic said:
Did you ever mess with any other settings using device_config before? Like the number phantom processes, empty or cached processes, ActivityManager tweaks or anything else? Because I assume you did (and using Android 10 or higher) and disabled the settings sync back to the defauls.
Did you ever use the below command?
device_config set_sync_disabled_for_tests persistent
What does the below commands says?
device_config is_sync_disabled_for_tests
Perhaps it says true? If yes that's why your settings aren't changing.
Click to expand...
Click to collapse
You quoted the wrong man
@Utini How'd it work out? If my last response doesn't help, maybe this one helps u
Doomkopf said:
You quoted the wrong man
@Utini How'd it work out? If my last response doesn't help, maybe this one helps u
Click to expand...
Click to collapse
No, logically I quoted the correct man Just wanted to indirectly tell others about the above trick / setting
Doomkopf said:
Hey xda-Community!
I recently wanted to reduce my idle drain and searched for ways to edit Android Doze settings, because I remembered seeing a tutorial that said you can change deviceidle-constants, that dictate how Doze works (how fast it kicks in, how long it kicks in, light/deep doze).
I tried all those old tutorials, but I quickly realized the old ways to change the parameters are deprecated, so I asked people on android.stackexchange.com and someone actually gave me the answer (thanks Andrew) (https://android.stackexchange.com/questions/247680/is-device-idle-constants-deprecated-in-android-12).
This works from Android 12 on and is achieved using a shell.
Commands:
Note: When using an adb shell, you have to put "adb shell" before those commands. I'll just put the bare commands here, you add what you have to add.
Checking the settings:
You can check your current Doze settings (and statistics) with "dumpsys deviceidle".
Changing a setting;
Every parameter has to be set individually. It's not that bad tho, as you only have to do this once.
Syntax is: "device_config put device_idle [KEY] [VALUE]".
One example: "device_config put device_idle light_after_inactive_to 30000"
You can check "dumpsys deviceidle" to see what keys there even are. To help you out, here's an explanation of what each key actually sets. You can also get a visual sense of how the light mode and the deep mode work (not my work, thanks to easz from github).
Spoiler: My recommended settings
First; reset parameters with: "device_config reset trusted_defaults device_idle"
light_after_inactive_to 30000
light_pre_idle_to 120000
light_idle_to 300000
light_idle_factor 2
light_max_idle_to 900000
light_idle_maintenance_min_budget 30000
light_idle_maintenance_max_budget 180000
inactive_to 900000
sensing_to 0
locating_to 0
motion_inactive_to 0
idle_after_inactive_to 900000
idle_pending_to 60000
max_idle_pending_to 120000
idle_pending_factor 2
idle_to 900000
max_idle_to 21600000
idle_factor 2
wait_for_unlock true
I also wrote a windows batch script (works via adb, you have to rename the .txt file to .bat) and a bash file that changes the parameters to my recommendations. See attachments.
Click to expand...
Click to collapse
Hi, currently I am using Naptime by Franco with ADB permissions. I'm not sure, but it should work by using the following options (maybe not only these, but I don't know well if there are other places where Doze options are stored):
inactive_to=2592000000,
motion_inactive_to=2592000000,
light_after_inactive_to=0,
light_pre_idle_to=30000,
light_max_idle_to=86400000,
light_idle_to=43200000,
light_idle_maintenance_max_budget=30000,
light_idle_maintenance_min_budget=10000,
min_time_to_alarm=60000,
min_light_maintenance_time=10000,
wait_for_unlock=0,
quick_doze_delay_to=86400000
It's working very well (I get 2% drain in 8 hours of sleep), but I wanted to try and improve it further, because the App tells you when and how much Doze is enforced and when maintenances are performed.
In my case, from my understanding, I don't need maintanances so often, or maybe I don't need it at all, because all the apps of which I need notifications are in non-optimized battery mode.
For reference, during night it performs 4-6 maintenances circa.
Coming to the point, I wanted to ask you I can use you settings even if they have further options like:
sensing_to 0
locating_to 0
and if I can make your settings even more extreme on some values.
For further reference, I have disabled through adb the "motion_engine", any system gesture and I have the Location always disabled (through UI shortcut, not ADB or advanced options).
NovaProspekt70 said:
Hi, currently I am using Naptime by Franco with ADB permissions. I'm not sure, but it should work by using the following options (maybe not only these, but I don't know well if there are other places where Doze options are stored):
inactive_to=2592000000,
motion_inactive_to=2592000000,
light_after_inactive_to=0,
light_pre_idle_to=30000,
light_max_idle_to=86400000,
light_idle_to=43200000,
light_idle_maintenance_max_budget=30000,
light_idle_maintenance_min_budget=10000,
min_time_to_alarm=60000,
min_light_maintenance_time=10000,
wait_for_unlock=0,
quick_doze_delay_to=86400000
It's working very well (I get 2% drain in 8 hours of sleep), but I wanted to try and improve it further, because the App tells you when and how much Doze is enforced and when maintenances are performed.
In my case, from my understanding, I don't need maintanances so often, or maybe I don't need it at all, because all the apps of which I need notifications are in non-optimized battery mode.
For reference, during night it performs 4-6 maintenances circa.
Coming to the point, I wanted to ask you I can use you settings even if they have further options like:
sensing_to 0
locating_to 0
and if I can make your settings even more extreme on some values.
For further reference, I have disabled through adb the "motion_engine", any system gesture and I have the Location always disabled (through UI shortcut, not ADB or advanced options).
Click to expand...
Click to collapse
Hey; please don't quote the whole post, it doesn't really tell me anything
I don't really understand: What do you want to know from me/what is your question? ^^
Yes, you can make some values more extreme, but you said you already did (less maintenance, more idle)
Doomkopf said:
Hey; please don't quote the whole post, it doesn't really tell me anything
I don't really understand: What do you want to know from me/what is your question? ^^
Yes, you can make some values more extreme, but you said you already did (less maintenance, more idle)
Click to expand...
Click to collapse
Hey, I'm really sorry, I'm new on XDA.
I wanted to know why you have some options valued that I don't, like for example:
light_idle_factor 2
sensing_to 0
locating_to 0
and if using them might improve even more my doze.
Also, even if I have Naptime installed, which already improved things by a lot, I wanted to know if some of my values could be improved further to avoid useless maintenances (like I said I have between 4 and 6 maintenances during night, but I barely need 1).
NovaProspekt70 said:
Hey, I'm really sorry, I'm new on XDA.
I wanted to know why you have some options valued that I don't, like for example:
light_idle_factor 2
sensing_to 0
locating_to 0
and if using them might improve even more my doze.
Also, even if I have Naptime installed, which already improved things by a lot, I wanted to know if some of my values could be improved further to avoid useless maintenances (like I said I have between 4 and 6 maintenances during night, but I barely need 1).
Click to expand...
Click to collapse
Doomkopf said:
You can check "dumpsys deviceidle" to see what keys there even are. To help you out, here's an explanation of what each key actually sets. You can also get a visual sense of how the light mode and the deep mode work (not my work, thanks to easz from github).
Click to expand...
Click to collapse
I linked a xda post that explains every value in detail (first link in second quote/my post);
locating_to and sensing_to: By the pictures (also in second quote/my post), you can see how deep doze works; before going into IDLE mode of deep doze, it goes through a sensing phase (motion detection starts) and locating phasing. Default behavior of doze is to not go sleep when you move the device. This skips this phase (time for detecting motion with sensor is 0). Same with locating; when android notices that you move the device (train, car, ...) via gps (or wifi triangulation, etc) it doesn't go to sleep. This also skips that phase
light_idle_factor 2: This multiplies light_idle_to with 2 everytime if goes thorugh a idle/maintenance cycle until it reaches light_max_idle_to. So this basically doubles your light idle time every cycle until it reaches a max duration (which you can set, I also did in my recommended settings)
In that overview you could also think about how to tweak your values so you get less maintenances during night, as you wanted. Basically you have to make both (deep and light) idle_to's longer. I recommend to increase light idle_to first (more light idle, less maintenance), before going too deep on deep sleep - sometimes your phone needs to do backups at night, etc. Dont be afraid to set a "too large" maintenance window, your phone won't suddenly start to draw much power for nothing. You just have a few seconds/minutes less deep sleep (which is ok, little percentage). Give it something like 2 minutes per night, if you're afraid a backup will take longer, you can even go for 3-4 minutes per night.
Doomkopf said:
I linked a xda post that explains every value in detail (first link in second quote/my post);
locating_to and sensing_to: By the pictures (also in second quote/my post), you can see how deep doze works; before going into IDLE mode of deep doze, it goes through a sensing phase (motion detection starts) and locating phasing. Default behavior of doze is to not go sleep when you move the device. This skips this phase (time for detecting motion with sensor is 0). Same with locating; when android notices that you move the device (train, car, ...) via gps (or wifi triangulation, etc) it doesn't go to sleep. This also skips that phase
light_idle_factor 2: This multiplies light_idle_to with 2 everytime if goes thorugh a idle/maintenance cycle until it reaches light_max_idle_to. So this basically doubles your light idle time every cycle until it reaches a max duration (which you can set, I also did in my recommended settings)
In that overview you could also think about how to tweak your values so you get less maintenances during night, as you wanted. Basically you have to make both (deep and light) idle_to's longer. I recommend to increase light idle_to first (more light idle, less maintenance), before going too deep on deep sleep - sometimes your phone needs to do backups at night, etc. Dont be afraid to set a "too large" maintenance window, your phone won't suddenly start to draw much power for nothing. You just have a few seconds/minutes less deep sleep (which is ok, little percentage). Give it something like 2 minutes per night, if you're afraid a backup will take longer, you can even go for 3-4 minutes per night.
Click to expand...
Click to collapse
Thank you very much, very helpuful!!
Based on your information, I think I understand better how Naptime works. It increases the parameters of Light Doze making them similar to those of Deep Doze, and also increases the duration.
Wouldnt it be easier to just create a routine or mode ?
Like when I am around my work place I have set it to turn wifi off so it dont keep scanning for wifi and stuff.
I personally feel with Samsung most things can be controlled within their phone and developer settings and not to mention their add on apps like Good Guardian and Good lock.
tfn said:
Wouldnt it be easier to just create a routine or mode ?
Like when I am around my work place I have set it to turn wifi off so it dont keep scanning for wifi and stuff.
I personally feel with Samsung most things can be controlled within their phone and developer settings and not to mention their add on apps like Good Guardian and Good lock.
Click to expand...
Click to collapse
I do use Samsung Routines to Enable Offline Mode and Battery Saving at night, which along with Naptime gives me 2% used battery in 8 hours over night, but during the day I can't find a good usage for it.
tfn said:
Wouldnt it be easier to just create a routine or mode ?
Like when I am around my work place I have set it to turn wifi off so it dont keep scanning for wifi and stuff.
I personally feel with Samsung most things can be controlled within their phone and developer settings and not to mention their add on apps like Good Guardian and Good lock.
Click to expand...
Click to collapse
I don't know what it would be easier as; this method?
This basically just configures doze to better fit your needs. It already had values in it before and it was activated before. You can (and should) do all this and still create a routine or mode additionally.
Doze is android's main internal battery saving feature, so tweaking it goes a long way.