Badly in Need of ACC / Smart Charging / Battery Charge Limit... - Google Pixel 4a Questions & Answers

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?

Related

Q: Xoom wont recognize battery stats

Just yesterday my xoom stopped recognizing my battery stats. Reads 0%. It charges but won't give me an actual reading of my battery. Installed circle battery widget and still gave me a 0 reading...
stevefromyellowstone said:
Just yesterday my xoom stopped recognizing my battery stats. Reads 0%. It charges but won't give me an actual reading of my battery. Installed circle battery widget and still gave me a 0 reading...
Click to expand...
Click to collapse
if you are rooted and have clockworkmod installed you could try wiping battery stats within the clockworkmod settings?
Thanks for letting me know. Forgot to say in the OP that I'm not rooted. I've been shying away since due to the wiping of the device. Might have to do that anyway for a factory reset, to see if that might help.
stevefromyellowstone said:
Thanks for letting me know. Forgot to say in the OP that I'm not rooted. I've been shying away since due to the wiping of the device. Might have to do that anyway for a factory reset, to see if that might help.
Click to expand...
Click to collapse
i have had a look around and it seems you need to have root access - you could try this
1. Run down your device’s battery until it turns itself off
2. Turn it back on and wait for it to turn off again; this may be straight away of after a few minutes
3. Remove the battery for at least 20 seconds
4. Replace the battery and charge until full and then for at least another hour – while the device is off
5. Delete you batterystats.bin file using one of 3 methods (requires root): Terminal Emulator – type su then press enter, next type ‘rm /data/system/batterystats.bin’ (without quotes). Using a Battery Calibration App (from market) – there are many choices available, they just delete your batterystats.bin file. In market, search for battery calibration. Make sure to read review and provided info in case of device incompatibilities. Manually – if for any reason the previous two methods didn’t work you may want to try deleting the file manually. Using a file manager with root access (such as Root Explorer) navigate to ‘data/system/batterystats.bin’. Delete ‘batterystats.bin’
6. Your device will now creates itself a new batterystats.bin file with a correct 100% battery reading
7. Run down the battery until it turns itself off
8. Turn on the device and charge for at least 8 hours
9. Unplug the device, turn off and charge for another hour
10. Unplug the device, turn on and wait for 2 mins
11. Turn off and charge for another hour
12. Use the device as normal
original post can be found here http://goo.gl/PVPvp
or just root and install cwm and wipe battery stats - hope this helps
No Go Rooted this weekend and still 0% battery. Wiped stats with CWM and deleted the bin file, tried different calibration tools. Still same problem. Charges though, and the indicator light changes once fully charged, but still flying blind...

[MOD] Tasker Watchdog & Data Control

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.

Battery Level stuck at 20%?

Hello, there has been a problem with my pixel 3 since yesterday where my phone seems to be stuck at 20%. I have tried various methods to fix this which include:
Draining till phone shuts off then charged overnight while off
Flashed stock rom multiple times by cmd and by google's browser flashing
Opened the phone to unplug and plug battery connector
Various calibrator apps, rooted and tried resetting sys/power supply/battery/batt-reset-soc (however i dont think this was usable at all)
HOWEVER... I can see true battery stats in TWRP. I have no clue what's going on. can anyone help me please? The problem might have initially started when i rooted or unrooted magisk before everything tho i've never experienced this and can't really understand how and why this is happening since twrp shows correct figures. BTW the stats in battery configure apps are always the same, 20% 26.2C temp 3.69V.
I am experiencing the same issue. A week ago, after a random reboot the battery level got stuck at 57%. I was on rooted Android 12 since November and flashed the Factory Image released in January a few days before the issue.
Since I was having a bad Android 12 experience anyway (random phone freezing, restarts of Google Maps on my Android Auto car stereo, Spotify being killed in the background when taking photos), I reverted to Android 11 two days ago, but unfortunately the battery issue persists.
For now I am using a Tasker Run Shell command to parse /etc/sys/class/power_supply/battery/capacity, which returns the correct percentage.
marcnetic said:
I am experiencing the same issue. A week ago, after a random reboot the battery level got stuck at 57%. I was on rooted Android 12 since November and flashed the Factory Image released in January a few days before the issue.
Since I was having a bad Android 12 experience anyway (random phone freezing, restarts of Google Maps on my Android Auto car stereo, Spotify being killed in the background when taking photos), I reverted to Android 11 two days ago, but unfortunately the battery issue persists.
For now I am using a Tasker Run Shell command to parse /etc/sys/class/power_supply/battery/capacity, which returns the correct percentage.
Click to expand...
Click to collapse
I looked up the file in root explorer and it actually does show the correct percentage when opened with text editor. How do I use this command in tasker. I tried but i couldn't make it work with the code. Can you show me some instructions on how to do so?
Arslan.KitKat_bro said:
Can you show me some instructions on how to do so?
Click to expand...
Click to collapse
Sure! I think the info that was missing, is that you need cat to parse the file. The actual command of the Run Shell action would then be cat /etc/sys/class/power_supply/battery/capacity and you can store its result in a variable.
Anyway, here is the TaskerNet link to my project. It reads the battery capacity and (what I believe is the correct) temperature every two minutes and updates a notification that shows the approximate battery level as its icon. The original (wrong) battery icon in the status bar is hidden. Also, a thin line visualizes the battery percentage just below the status bar.
marcnetic said:
Sure! I think the info that was missing, is that you need cat to parse the file. The actual command of the Run Shell action would then be cat /etc/sys/class/power_supply/battery/capacity and you can store its result in a variable.
Anyway, here is the TaskerNet link to my project. It reads the battery capacity and (what I believe is the correct) temperature every two minutes and updates a notification that shows the approximate battery level as its icon. The original (wrong) battery icon in the status bar is hidden. Also, a thin line visualizes the battery percentage just below the status bar.
Click to expand...
Click to collapse
Thank You so much. I can't believe I found a workaround for this. I really liked pixels but seeing this happening in their os will really impact how much I would recommend pixels to others. I really can't thank you enough!
Arslan.KitKat_bro said:
I really can't thank you enough!
Click to expand...
Click to collapse
No problem, glad to be able to help!
Arslan.KitKat_bro said:
I really liked pixels but seeing this happening in their os will really impact how much I would recommend pixels to others.
Click to expand...
Click to collapse
I haven't been able to figure out yet, if this issue is really OS-related. A few days ago, my USB connection got unstable, too. This happened multiple times before, but cleaning out the USB port always helped. Unfortunately not this time, although I even used contact spray. In comparison to earlier issues, where the USB connection worked or just didn't work, now it just randomly toggles its connection state. I'm not sure yet, if I should swap the USB port (and the battery) or just accept, that my hardware keeps failing and look for a new device.

Improve idle drain by tweaking Android Doze parameters

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.

Running phone without battery

Hi,
I have a question about runnig my old Samsung (XCover 3 - SM-G388F) without battery.
I have connected wires (usb cable connected to charger) dierctly to pins under cover and it works fine. The problem is that system counts the battery load percentage down and when it reaches 0% the phone is shutting down. When I boot it up system shows again 100% and counts down.
Is there a way to bypass this (phone is rooted if it helps)? I need it runnig 24/7.
ok, my mistake
I was trying to serach an answear before I posted and didn't find anything.
But when I posted this question I got "suggested" thread with answear
"Here's how to fix the battery percentage going down:
-You have to be rooted
-Use the terminal emulator app
-Type SU (switches from $ to #)
-Type this command to keep the phone at 100%
dumpsys battery set level 100
-Type this command to tell the phone that the charger is plugged in
dumpsys battery set usb 1
Everytime you reboot it reverts to stock settings. So I use a tasker script that runs the above commands on every boot."
I leave it here for other
Chears
wouldnt it be possible to keep the battery in and just prevent it from charging ?
I tried that with an app called "Battery Charge Limit" but from time to time the phone was shutting down.

Categories

Resources