How disable auto shutdown when battery level drops until 0%? - Android Q&A, Help & Troubleshooting

Android 10 (Havoc OS), have root access.
And, maybe u know how set fake battery level?
I try change file "capacity" at /sys/devices/platform/battery/power_supply/Battery, but OS don't allow me do it.

Hi,
please try:
(adb shell) dumpsys battery set level 5
(to set battery level to 5 until reboot or reset)
or
(adb shell) dumpsys battery set ac 1
(adb shell) dumpsys battery set status 2
(to set battery status to charging until reboot/reset)
No root access needed.
Skip „adb shell” if running from on-device terminal.
Reset (restore to actual values) by using:
(adb shell) dumpsys battery reset
Your device will shutdown anyway, but much later, depending on kernel values I think.
Mine Oneplus One shuts down at ~2.7V, while Nexus 5 only goes to 3.1V.

Thank you, @bugmento !
All this may seem silly, but it is life or death on a device with a "battery-ectomy" where you have removed the battery and wired in 4V in as a power supply.
The system keeps on thinking that you're discharged because no electrons ever go into the "battery", i.e. the fixed power supply.
If you actually have a battery, you can fudge the numbers at your own peril.
I've seen that level numbers over 10,000,000 cause the percentage level to get reported as zero percent.
If you have a wired device (head unit, battery-ectomied device), do this.
Code:
$ dumpsys battery set present 0 -f
# dumpsys battery unplug -f
$ dumpsys battery set level 99 -f
$ dumpsys battery
"unplug" means to never update the number. It will say " (UPDATES STOPPED -- use 'reset' to restart)".
99 is a nice number and you can see if it has changed somehow.
Edit: I'm still beating my head against this...

In short what I'm doing here and what is the purpose of this. I was able to mod Samsung Galaxy J3 in a way to be used as a 3D printer klipper firmware server by removing the battery and 3D printed a custom one, in which I placed a DC to DC step down module to use the 24v from the 3D printer and step it down to 4v to power on the phone and it all works great! If interested in doing this can share more details, stl for the custom battery and links to the step down module I used. The phone boots and runs perfectly! I run debian linux in container in linux deploy app in which I installed all the needed software to run klipper (klipper, moonraker and mainsail), installed custom driver to connect the printer serial to the micro usb on the phone and all works great!
My problem is that the phone battery level indicator slowly shows like the phone is discharging but it isn't in reallity because it is hardwired to stable voltage from the dc step down module I used. Currently installed android 6 (cyanogen mod 13.0-j3xnite) because the newer versions of android are pain in the a*s to run linux without android to cut it's services and hibernate it, so I'm looking a way to force or trick android think it's battery level stays the same or fake the numbers on it because I'm worried if the level goes down to 0 maybe android will try to shut it down.... I haven't experienced it because it "discharges" at very slow rate but I'm also worried to run a long print on the printer because of this. As you my assume I have root and bla bla... Searched the interned how to force android to set custom battery level but there are only fake apps how to trick friends or your bos that your phone doesn't have battery. Maybe I will need help from a developer how to trick android kernel to show custom or static battery level, or to use some magisk / xposed module for this. Please help me, highly appreciated! When I try "dumpsys battery set level 99" android says batter service not found... Please help and thank you for your time!

Renate said:
Thank you, @bugmento !
All this may seem silly, but it is life or death on a device with a "battery-ectomy" where you have removed the battery and wired in 4V in as a power supply.
The system keeps on thinking that you're discharged because no electrons ever go into the "battery", i.e. the fixed power supply.
If you actually have a battery, you can fudge the numbers at your own peril.
I've seen that level numbers over 10,000,000 cause the percentage level to get reported as zero percent.
If you have a wired device (head unit, battery-ectomied device), do this.
Code:
$ dumpsys battery set present 0 -f
# dumpsys battery unplug -f
$ dumpsys battery set level 99 -f
$ dumpsys battery
"unplug" means to never update the number. It will say " (UPDATES STOPPED -- use 'reset' to restart)".
99 is a nice number and you can see if it has changed somehow.
Edit: I'm still beating my head against this...
Click to expand...
Click to collapse
Did you found a solution? I really need this! Thank you!

thewhisper said:
Did you found a solution?
Click to expand...
Click to collapse
Yes, I found the perfect solution, but I'm not sure how universal it is:
Code:
cp /data/local/tmp/one /sys/devices/platform/battery/FG_daemon_disable
The one file is just the "1" character because echo / tee was being difficult.
"FG" is "fuel gauge", not "foreground".
This sets the battery level at 50% and never annoys you.

Related

[Q] Losing 40% after bstats.zip

On several occasions, after applying bstats.zip when at 100%, my phone shows only 60% battery afterr applying the zip.
Is this normal?
Also, as you might guess, having some general battery problems:
Rapid loss of battery reserve
Phone running "hot" when no visible programs are running
Difficulty getting phone back to 100%, even after several hours of charging.
Are there any suggestions on utilities to show
1) whether battery is holding a charge,
2) what programs are using up battery?
Badger51 said:
On several occasions, after applying bstats.zip when at 100%, my phone shows only 60% battery afterr applying the zip.
Is this normal?
Also, as you might guess, having some general battery problems:
Rapid loss of battery reserve
Phone running "hot" when no visible programs are running
Difficulty getting phone back to 100%, even after several hours of charging.
Are there any suggestions on utilities to show
1) whether battery is holding a charge,
2) what programs are using up battery?
Click to expand...
Click to collapse
This is definitely not normal. There are several things to try:
1)in terminal emulator, type"su" then hit return to get superuser access, then run the command "dumpsys power". near the bottom is a command "mLocks.size=0"
This will list any wake locks, which drain battery by preventing the phone from going into deep sleep. (In the example, 0 means no wake locks)
2)try a different kernel, maybe an undervolted one. I recommend imnuts' 50uv pbj kernel found here:
https://sites.google.com/a/imnuts.net/android/kernels
(try the 4th one down in the list)
thanks
will give that a try...
wake locks
The following is captured from the emulator screen, there is more above it, but this appeared to be the section on wake locks:
mLocks.size=3:
PARTIAL_WAKE_LOCK 'MAIL_SERVICE' activated (minState=0, uid=10212, pid=2731)
PARTIAL_WAKE_LOCK 'CoreReceiver getWakeLock' activated (minState=0, uid=10092, pid=2731)
PARTIAL_WAKE_LOCK 'NetworkLocation Check Location' activated (minState=0, uid=1000, pid=2731)
Not sure if it's good news or bad news..
Working to install the other kernel, as well.
It looks like you might be using an email client other than the stock one that is keeping your phone awake. If so, try uninstalling or disabling it for 24 hours and use your phone.

[Q] Android with a month of battery life?

Hi all!
I'm working on a cool University project here in Russia.
We have to make a mobile device that works for about a month without any charging.
Device should only wake up every day at 23:55 and send POST request to server to tell that "I'm doing science and I'm still alive.".
We've started with an Android device, ZTE racer and installed Cyanogen firmware.
We've made an application that:
enables AIRPLANE_MODE
asks AlarmManager to wake up at 23:55 every day
at 23:55 it disables AIRPLANE_MODE for a minute, aquires a wake lock for a minute
then sends "I'm doing science and I'm still alive." to server
and enables AIRPLANE_MODE again to save battery.
Right now we are getting 5-10 days of battery life.
I suppose that we could extremely increase battery life by:
removing some applications from firmware including "phone" and others
shutting down some services right in kernel sources. (In fact, we just need gprs and nothing else. We don't need Wifi, eccelerometer, GPS, ...)
decreasing CPU speed from application
I have couple of questions:
Is it theoretically possible to have 1 month of bettery life for an Android device? (I know that Kindle have more than 2 months of battery, so why we can't?)
Does anybody have an Android-based book reader? How long could it live in sleep mode and wifi turned off?
If device has no 3rdparty application installed, and it's sleeping in AIRPLANE_MODE... Who could possibly eat battery at that time?!!
Could you please give any kind of advice for our problem?
Thank you very much in advance!
I'd say yes it's possible to get that much battery life... Some suggestions from the top of my head:
Undervolt and/or underclock the processor (like you said), but do this from the kernel, rather than an application.
uninstall any unecessary system apps/turning off services (like you said)
Assuming your script/application is checking the system time of the phone to know when to wake, try having it just run an internal timer instead... I don't know how much battery life that would take, but I imagine that checking against its own timer would save battery vs requesting the time from the phone itself.
Assuming you haven't already, Try having so the display NEVER TURNS ON without physical input (i.e. pressing a button on the phone). The screen is a massive battery drain.

[Q] How to get rid of s5p-ehci?

Hi all,
I experience problems with kernel wakelock, named "s5p-ehci". In random moment it's getting seized my phone and the phone stops sleeping. It looks like:
all other kernel wakelocks and partial wakelocks take less than 1 min of activity, whereas s5p-ehci is active during hours. So, for instance, if s5p-ehci is active at night - I am loosing about 4% of charge per hour (phone deep sleep time is 0%).
Temporary solution is to reboot the device: so s5p-ehci's activity time is between seconds and minute, later it gets crazy again and is active constantly. I did not succeed to find some relation between it and applications or system processes.
I am not an Android developer, but since there is no other kernel for my device (Meizu MX2) I'm eager to TURN OFF this damned s5p-ehci... Please, tell me, how to do it:
either via build.prop or via linux command or changing some configs.
I have tried to use other firmware, wiped my phone and tried to work without my apps, but all in vain: so I still don't know, WHY this s5p-ehci is on Earth getting so active so long all of the sudden. It has nothing to do with USB, because my phone is not plugged with cable when it happens
Nafiganado said:
Hi all,
I experience problems with kernel wakelock, named "s5p-ehci". In random moment it's getting seized my phone and the phone stops sleeping. It looks like:
all other kernel wakelocks and partial wakelocks take less than 1 min of activity, whereas s5p-ehci is active during hours. So, for instance, if s5p-ehci is active at night - I am loosing about 4% of charge per hour (phone deep sleep time is 0%).
Temporary solution is to reboot the device: so s5p-ehci's activity time is between seconds and minute, later it gets crazy again and is active constantly. I did not succeed to find some relation between it and applications or system processes.
I am not an Android developer, but since there is no other kernel for my device (Meizu MX2) I'm eager to TURN OFF this damned s5p-ehci... Please, tell me, how to do it:
either via build.prop or via linux command or changing some configs.
I have tried to use other firmware, wiped my phone and tried to work without my apps, but all in vain: so I still don't know, WHY this s5p-ehci is on Earth getting so active so long all of the sudden. It has nothing to do with USB, because my phone is not plugged with cable when it happens
Click to expand...
Click to collapse
Since it persistent across different versions of the software, I'm wondering if it is not hardware related, like the USB is shorting out or messed up (yes, I read that it wasn't plugged in during the main issue, but doesn't mean it is not the root cause). Have you tried using https://play.google.com/store/apps/details?id=com.uzumapps.wakelockdetector to see if maybe it can narrow down the source of your issues?
es0tericcha0s said:
Since it persistent across different versions of the software, I'm wondering if it is not hardware related, like the USB is shorting out or messed up (yes, I read that it wasn't plugged in during the main issue, but doesn't mean it is not the root cause). Have you tried using https://play.google.com/store/apps/details?id=com.uzumapps.wakelockdetector to see if maybe it can narrow down the source of your issues?
Click to expand...
Click to collapse
Hi,
yes, i've used Wakelock detector app as well as its advanced colleague - BetterBatteryStats. So that's how I've found out about "s5p-ehci" wakelock. And I can see there is no other reason of phone insomnia, besides s5p-ehci.
All other apps and processes consume CPU moderately. When s5p-ehci activity is moderate - phone sleeps well. When it gets berserk and is active during several hours - phone does not sleep at all during whole this time (deep sleep is 0%), instead works on minimal frequency (300MHz), however, it's about 40% of battery draining per night.
If it's a hardware issue - I wonder who can help me with that investigation. Services do not deal with such cases, since there is no permanent problem signs. In my case the process can behave properly during a day. Then, all of a sudden, it's getting active and some its activity lasts hours! Then it's getting back to normal again. I've looked at kernel log and system log. There is a lot of various events happening there: something is going on, then device sent to sleep, then again something is going on, then wakeup, in various cases wakeup reasons are different, I was unable to find some relevant info... I would send this log to anyone who could help me to find source of the problem.
I've rolled back to Android 4.1 firmware and installed custom kernel.
Here situation is better, but what I have discovered:
phone seems not to detect when it's being plugged off from charger - no matter, USB cable from computer or wall socket wire. s5p-ehci does not go away and sucks off my battery. What only helps is manually resetting EHCI power: setting 0 in ehci_power file. As a result, something is reset, ehci power is on again, but this sucker goes away and after that everything is fine until next charge. But I need to find a root of the problem!
Going on investigation - too view info in Internet...

[GUIDE] Disable Cellular Radio On AOSP Based Roms (WiFi Only)

I brought my old LG-G3 back to life to use strictly as a media player with a prop edit to disable the cellular radio (I was using my old Samsung GS3, but it finally died after all these years!). Running LOS 09/01 nightly w/xdabbeb's 35b bootstack and everything is buttery smooth. Performance is really top notch for this device running LOS 14.1 - no complaints here. If anyone wants to use their device as a mini tablet (wifi only/disable radio) this is what you do via a root adb shell on a pc:
Code:
adb shell
Code:
su
Code:
setprop persist.radio.noril 1
That command removes the cellular radio portion from the OS. There will no longer be a signal bar in the status bar. Wifi will still work so the device is basically now a mini tablet. You will gain a major increase in battery life. A couple of things to note:
-Root required. Flash Lineage's SU addon (I couldn't get Magisk to work, and I no longer use SuperSU so I can't comment on that). Enable root for apps & adb in Developer Options.
-The radio is disabled, but the OS is still built as a phone. In the Battery section it'll still show "phone idle" as draining battery. Ignore it, it's a false reading.
-On this device there is an odd side effect where the GPS becomes disabled too. Apparently LG ties some GPS hardware to the device's RIL. This doesn't happen on other phones for future reference. It doesn't bother me, I would have turned location off anyways - after all, I'm just listening to music from my 128gb microSD. The GPS will still be available in the system, but it simply will not find any satellites. Just turn off the GPS so it's not searching and draining your battery.
-You can also do it from a terminal app or Lineage's built in terminal (you have to enable the terminal in Developer Options).
-To revert and restore the radio, do the same thing, but replace the "1" with a "0" in the command.
-The radio disable will remain when dirty flashing an update (no need to run the command again).
-If you play any Kanye West, your phone will make a vomit sound and immediately self destruct....you've been warned!
-Revert Command:
Code:
setprop persist.radio.noril 0
Just curious - how is this better than disabling mobile networks and leaving the phone in airplane mode?
syborg said:
Just curious - how is this better than disabling mobile networks and leaving the phone in airplane mode?
Click to expand...
Click to collapse
Disabling mobile networks still causes the system to ping and look for telephony related services (aka battery consumption). Airplane mode would be a better comparison, though the data signal is still "alive" on the system. Doing this removes your RIL completely. So services that would normally ping won't because there is no RIL/data and those services will only begin pinging when on Wifi (like a data only tablet). This method is the more battery friendly than airplane mode.
annoyingduck said:
I brought my old LG-G3 back to life to use strictly as a media player with a prop edit to disable the cellular radio (I was using my old Samsung GS3, but it finally died after all these years!). Running LOS 09/01 nightly w/xdabbeb's 35b bootstack and everything is buttery smooth. Performance is really top notch for this device running LOS 14.1 - no complaints here. If anyone wants to use their device as a mini tablet (wifi only/disable radio) this is what you do via a root adb shell on a pc:
Code:
adb shell
Code:
su
Code:
setprop persist.radio.noril 1
That command removes the cellular radio portion from the OS. There will no longer be a signal bar in the status bar. Wifi will still work so the device is basically now a mini tablet. You will gain a major increase in battery life. A couple of things to note:
-Root required. Flash Lineage's SU addon (I couldn't get Magisk to work, and I no longer use SuperSU so I can't comment on that). Enable root for apps & adb in Developer Options.
-The radio is disabled, but the OS is still built as a phone. In the Battery section it'll still show "phone idle" as draining battery. Ignore it, it's a false reading.
-On this device there is an odd side effect where the GPS becomes disabled too. Apparently LG ties some GPS hardware to the device's RIL. This doesn't happen on other phones for future reference. It doesn't bother me, I would have turned location off anyways - after all, I'm just listening to music from my 128gb microSD. The GPS will still be available in the system, but it simply will not find any satellites. Just turn off the GPS so it's not searching and draining your battery.
-You can also do it from a terminal app or Lineage's built in terminal (you have to enable the terminal in Developer Options).
-To revert and restore the radio, do the same thing, but replace the "1" with a "0" in the command.
-The radio disable will remain when dirty flashing an update (no need to run the command again).
-If you play any Kanye West, your phone will make a vomit sound and immediately self destruct....you've been warned!
-Revert Command:
Code:
setprop persist.radio.noril 0
Click to expand...
Click to collapse
Even if this is an old thread, it was exactly what I searched for. It works perfect and pushes my "S6 Edge-iPod" to new battery levels. Holds days and drops only a few percent. (Running Android 11 custom Rom)
Thank you for giving that information, I googled a long time to finally find this.

Amazfit Pace disable Wifi to improve battery life

Hello all,
I read that is better to disable Wifi to get more battery life on that smartwatch. On the net there is some tutorial about that, using ADB drivers and Minimal ADB and Fastboot: tapping the foolowing commands:
adb devices
adb kill-server
adb root
adb shell mount -o rw,remount,rw /system
adb shell mv /system/lib/firmware/wifi /system/lib/firmware/wifi_off
adb reboot
I execute commands ok, until command four; I have a failure in the command "adb shell mount -o rw,remount,rw /system": mount: Operation not permitted.
I read that in chinese rom it works, but my watch is international ROM I think. My question are:
1- How can I execute this command without failure?
2- Do I have to unlock the bootloader first?
My rom is readonly mode and I cannot disable wifi I think.
3- Anyone achieved to disable wifi?
Thanks a lot!!
Yes, you need to unlock your bootloader and also root (as you can see by the commands). Personally I wouldn't recommend this, it's like using a cannon ball to kill a fly. WiFi isn't the common cause of excessive battery drain, in most cases the cause is corrupted or bad data stored on watch and because it tries to use WiFi it drains battery, so you are not fixing the cause either. You could also simple factory reset the watch and do not connect to WiFi, this way probably it won't use it later. There are other things you can do to find what's the culprit, and you don't need adb, root or unlocking the bootloader.
Can you not just use
adb shell svc wifi disable
?
You could try PaceOn, it gives WiFi control and has a service that alerts you to BT and WiFi connections.
I'm not sure how much battery cost is incurred by running PaceOn, but it could be worth trying as it give control direct from the watch, eschewing the need for a computer, cable and ADB.
@Quinny899
no, whenever something needs wifi, it just turning back on and getting back to work again.
Agree with lfom & shadowcaster666 on some of the points made here.
Just share my personal configuration.
One-time settings on the watch:
- Set Auto Upload off
- Set Auto Airplane on (00:00-23:59)
- Install PaceOn
Then, use PaceOn to control wifi/bluetooth connections when needed.
Also turn on PaceOn CXN service to see exactly when the watch makes wifi/bluetooth connections.
I have used PaceOn for many months and I can say its battery consumption is negligible.
lfom said:
Yes, you need to unlock your bootloader and also root (as you can see by the commands). Personally I wouldn't recommend this, it's like using a cannon ball to kill a fly. WiFi isn't the common cause of excessive battery drain, in most cases the cause is corrupted or bad data stored on watch and because it tries to use WiFi it drains battery, so you are not fixing the cause either. You could also simple factory reset the watch and do not connect to WiFi, this way probably it won't use it later. There are other things you can do to find what's the culprit, and you don't need adb, root or unlocking the bootloader.
Click to expand...
Click to collapse
I'm almost sure wifi is the culprit of my stratos battery drainage issue. What would be the best way to identify corrupted or bad data stored on my watch? My watch is only one week old I've just set up wifi at home to update to the latest firmware.
gustavosoares said:
I'm almost sure wifi is the culprit of my stratos battery drainage issue. What would be the best way to identify corrupted or bad data stored on my watch? My watch is only one week old I've just set up wifi at home to update to the latest firmware.
Click to expand...
Click to collapse
Battery guide/tips: https://forum.xda-developers.com/smartwatch/amazfit/ultimatre-guide-battery-drain-issues-t3791829
Or you can just use "Amazfit PACE Tuner" - it has control for both WiFi and Bluetooth. No need for root or unlocked bootloader.

Categories

Resources