yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] nreuge:
Actually, I think to continue with my method described above, i.e. charging at night up to 99%, then charge stopped by this app (I would have prefered up to 100%...) to disable the cycles 99<->100% for sure. But I will use a very slow charger (500mAh of an USB port for instance). Thus, the duration of the battery fully charged will be minimized.
[Android Apps and Games] post-mortem:
Please read this article:

BU-409: Charging Lithium-ion
[Android Apps and Games] suvam69:
Well the charging went upto 96% and then stopped it seems. But I limited it to 80% . Can anyone help.

RR FINAL OREO

LENOVO P2
[Android Apps and Games] vagsvag:
I can confirm tried at xiaomi mi a2 and working. Thx 4 this nice app.
[Android Apps and Games] ChemoNL:
Last night I decided to give this app another go on my OnePlus 6.

And to my surprise it started to function as it should. Where before it only works once and then I needed to reset the app, since last night it works like a charm.

It stops charging at my desired level and stop until the desired lower limit is reached. Tested it with multiple rides in my car, connecting my phone to Android auto. AA works, charging is disabled as it should.

Thanks Dev for saving my battery
[Android Apps and Games] ssechaud1982:
I've tried many times to get this working on my M8 One and Nexus 9 on LOS 14.1 but it never seems to work. /sadface
[Android Apps and Games] jimger:
Which config etc did u use?

It used to work perfectly to my xiaomi Redmi 3s and note 4 phones but not quite good on oneplus 6
[Android Apps and Games] ChemoNL:
I was cheering to soon, after a day and a half or so it stopped working. even after a reboot the charging wasn't stopped if the percentage is between the thresholds
[Android Apps and Games] jimger:
I see. Yeah it is hit and miss in my opinion. I have also pie stock with unlocked bootloader and magisk root
[Android Apps and Games] Developer23:
alternate reference

Thanks for the alternate links.
[Android Apps and Games] DualJoe:
I'm using batt_slate_mode on i9506 (los15.1). Charging stops properly at 91 but the phone doesn't go into deep doze as long as the cable is still plugged in so charging over night usually ends up with 83 or similar. This doesn't happen on default charging. The other modes don't work properly either.

Any ideas how to fix doze behavior?
[Android Apps and Games] post-mortem:
What is your lower charge limit set to?
[Android Apps and Games] DualJoe:
30.

I don't want it to re-charge. It should properly go into doze mode how it's meant to be done. I tried 'forcedoze' app already but doesn't help. I will also test with 'usb developer mode' disabled next time. But i doubt anything of this will help.
[Android Apps and Games] VR25:
Do you have the paths </sys/class/power_supply/usb/online> or <...present>?
[Android Apps and Games] DualJoe:
Yes, i have this one.
[Android Apps and Games] VR25:
Check whether doze works normally while plugged in (not charging) after setting online/present value to 0.
[Android Apps and Games] DualJoe:
It goes automatically to '0' when BCL sets '/sys/class/power_supply/battery/batt_slate_mode' to '1' (no charging).
[Android Apps and Games] VR25:
Ok, does doze work as desired with the control file set to </sys/class/power_supply/battery/store_mode>?
[Android Apps and Games] DualJoe:
Will check it (i've done it before but can't remember anymore - something was worse on store mode).

I will also test manually stopping (at 90%) again. Maybe its some sort of quick drain of a dead cell (bad battery). The constant leakage only occurs above 80% (or right after charging) if i remember correctly.
[Android Apps and Games] panopticum:
great app, works on a Galasy S4 with Lineage 15.1 which is used just for BT music on a desk.

and on my OP6 with Android 9.0.2 using Magisk.

this find made me happy, ty!
[Android Apps and Games] Markuss12:
A really nice app. I will try it for sure!
[Android Apps and Games] VR25:
Looking forward to this. Magic Charging Switch also benefits from your report.

Thanks
[Android Apps and Games] hgmichna:
Help! App running wild.

Of course this happens when I need my phone (OnePlus One, latest official LineageOS 15.1) most. I am travelling in Africa.

I got the 6-seconds-charge-6-seconds-no-charge disease again, often with the variation:

6 seconds charge

a fraction of a second no charge

6 seconds charge

6 seconds no charge

repeat at nauseam

Or, alternatively:

6 s charge

6 s no charge

a fraction of a second charge

6 s no charge

repeat at nauseam

But it gets worse.

I switched off Enable Battery Charge Limit, the on-off sequence continued.

I force-stopped the app, the on-off sequence continued.

I uninstalled the app, the on-off sequence remained.

I updated LineageOS, hoping that replacing the kernel might cure the problem, but the on-off sequence remained.

How is that even possible?

I had to reinstall the app in the hope that changing some setting might help, but none did. I did not touch the control file selection, because it had by now become obvious that the app has the power to effectively render the phone unusable, which it apparently has already done, because with the constant on-off switching I am no longer able to maintain charge while navigating. Battery state of charge is decreasing in this mode, until the battery is empty.

Of course I can power down Android and charge the phone, but then I cannot use it while charging. Sometimes it charges continuously when I enable the battery charge limit, but when it reaches the set limit, the on-off cycle starts again. It is unnerving, particularly while one drives through difficult terrain, using the phone to navigate. The app also crashed a few times, and I always sent the crash report.

What I am looking for now is first and foremost a method to remove the app entirely. If uninstalling the app leaves the function active then there must be something I cannot uninstall. What could that be? Does the app leave some code behind that cannot be removed by ordinary means?

Any help and any idea is greatly welcome.
[Android Apps and Games] guest4711:
ForceStop and uninstall should be enough. To be sure you could also reboot afterwards (and have a look at the control files - they should change their contents according to the state of your power supply again).
[Android Apps and Games] DualJoe:
I'd love to help but after some more tests i think my problem is not related to BCL at all. Even without the app the battery drains around 10% in 1 hour after charging/stopping manually at 90%. I rather think the battery goes down or its a rom problem. Thanks anyway.
[Android Apps and Games] iluvatrix:
May I know what does (Always handle power events) do? Thanks
[Android Apps and Games] hyborian:
On my Asus phone and Xiaomi 4A, it has this file charging_enabled. The module works perfectly, thanks.

On my Xiaomi Note 4X MTK (2 of them), the charging_enabled file is not found in /sys/class/power_supply/battery/. So the module does not work, it just keeps on charging past the limit.

Any suggestions ? Thanks
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

Any idea, anyone, how to explain the behavior after the app was already uninstalled and the device rebooted and even after the system was updated?

I am still experimenting, but keep getting erratic behavior.
[Android Apps and Games] hansxl:
No idea, but maybe dirty flashing your rom again can solve it?:confused:
[Android Apps and Games] guest4711:
Perhaps it is time to change the battery?
[Android Apps and Games] Cuma Orang Biasa:
Works on my old device, Lenovo A6000 Special Edition with AOSP ROM 9.0

Thanks :good:
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

May I ask how you arrived at the idea that flashing the ROM twice might solve this problem?
[Android Apps and Games] hansxl:
Yes you may, I considered the possibility that dirty flashing could restore the situation before installing and uninstalling battery charge limit ....
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

The battery still has about 90% of its original capacity and works very well during the whole day. I doubt very much that the battery causes any charging problems.

---------- Post added at 12:59 PM ---------- Previous post was at 12:52 PM ----------

Is it conceivable that this app leaves code behind when it is uninstalled?

If so, where can I find that code and delete it?

My problem is rather severe, as described in my first posting above. My phone, a OnePlus One, has become nearly unusable, because it turns charging on and off in 6-second intervals, but mostly off, so the battery goes down while navigating.

If the app is at fault, then this would be a very severe defect. It would mean that the app destroys phones or at least forces users to install everything from scratch.
[Android Apps and Games] Arief Darmawan:
Guys, any tips for prolong the battery life for our devices?

Gonna be helpful.
[Android Apps and Games] post-mortem:
If something was modified by this app, and it was not removed on uninstall, then reflashing the existing ROM should get rid of whatever residual was left behind. If that doesn't fix it, then a factory reset and clean flash (or nandroid restore) would be in order. If that still doesn't fix it, then the problem is hardware, not software.

Read this: https://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries
[Android Apps and Games] dilidani:
Hello guys, my battery stats dont reset above 90%, even after deleting the app and reboot. What to do?
[Android Apps and Games] post-mortem:
The Android OS automatically resets the battery stats when you unplug the charger with the battery level at 90% or higher. When you go to settings and check the battery usage chart, it should basically be empty.
[Android Apps and Games] dilidani:
Sure, I know, but my stats keep on the state, like before charging, showing 3 hrs screen time, for example. So, it doesn't start from zero, even above the 90% mark of charge. :/

Update: I had a wild idea of charging my phone in powered OFF state and voila! Strange bug is gone, all works as intended now! :)
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

I have found the culprit. This app does not uninstall itself completely. It leaves code behind that still impeded proper charging on my phone. I found the file in the data partition, apparently containing code, and deleted it. After that my phone's charging behaved normally.

Obviously there must be a second piece of code that calls and executes this file. Due to my superficial knowledge of how Android's internals work, I could not find that other code. From the strange, erratic behavior I surmise that that other piece of code is there multiple times, possibly because I installed and uninstalled the app multiple times.

I can think of two causes, incompetence (defective code) and malevolence (spyware), but since the defect draws attention to itself on my phone, I think we can rule out malevolence. Few black-hat hackers would be stupid enough to write Trojans that alert the user to their existence. So I will not ring the alarm bell too loudly and will not report the app to Google for now.

I bet, instead of writing a proper Android service that does its work in the background and that would be uninstalled through the normal Android API, the author took the dangerous shortcut to abuse the app's root rights to write its background code directly into the data partition and, on top of this, failed to write reliable uninstall code.

That said, I cannot be sure whether all phones with this app are affected. The defect might only materialize under certain conditions, which were present on my phone, but hopefully not on all phones.

Could somebody please corroborate my findings? I used ES editor to search /data/data for files that contained "batt" and found one among about five hits that contained the string "batterychargelimit" or similar in its file name. After uninstalling the app, this file was still there and apparently doing something.

It does not look like a plain text file, so I surmise that it contains code. Deleting this file solved my acute problem. My phone (OnePlus One with LineageOS 15.1) now charges normally again.

I would be even happier if somebody in the know could point me to the code that calls and runs that file. I will also check the logs for entries that point to the failure to find the file, but I am currently moving through remote places in East Africa and am happy enough that I can now use my primary phone for navigation again. (Here, failure to navigate properly can lead to death.) I will do it later after arriving back home, if nobody here finds those calls.
[Android Apps and Games] post-mortem:
Did you record the names, or at least the location, of the files?
[Android Apps and Games] minhtuan990:
thank you
[Android Apps and Games] celoxocis:
what's the best mV one should start charging?

I know people say around 20-25% buts that's not a proper indication for mV.

like phones reaches 4200mV at 73% instead of 80% (my phone obviously has a bigger battery 5100mah).

I know that cutoff (auto shutdown) is somewhere at 3200mV (android hard coded default). so I'm guessing it should be somewhere around 3600-3700mV.

the battery university study doesn't properly say when.

15% for me is about 3700mV.
[Android Apps and Games] mauiblue:
I found this app after reading about how to prolong battery life on smartphones. It took a a couple of days to finally figure out which set up would work on my HTC U12+. I was pleasantly surprised today to see that my phone stopped charging at 80% and maintained that battery capacity. Aloha and mahalo to the dev!
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

Sorry for my late reply, but I was in a remote area in Africa and had only an extremely poor internet connection. I'm back home now.

The location was /data/data/ . I did not record the file name, but as I wrote, you can search for "batt" in the file name. I think it contained "batterychargelimit" or something very similar, so it was obvious that it was a leftover file that did not get uninstalled when uninstalling the app.

Look for yourself. You will find that file. My inclination towards installing the app again is not very strong.

What I would like to find is the place from which that file, or whatever else remains, is called. It is conceivable that the calls cause problems.

If you feel like it, you can uninstall the app and check whether that file remains.
[Android Apps and Games] Ihe87:
Hey,

is it possible to add a day- & nightprofile with the possibility to set various "Recharge at" on different times?

Otherwise a great App!
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

I went through the painful procedure of a factory reset to get rid of all traces of the app. Unfortunately, my charging problems are still there.

This means that the uninstall defect is unrelated to my problems and that the cause is likely a hardware failure.

I would still recommend to fix the uninstall defect urgently. It looks very fishy if an app leaves code behind after uninstalling.

Not to mention that this stole a day from my life. (A factory reset on my phone takes about a day of work.) Without the leftover code file I would not have had any reason to suspect the app and would have assumed a hardware defect in the first place.

Isn't it amazing how much damage a programming error can do?
[Android Apps and Games] guest4711:
Yes, it is. And it is very good to learn from this experience. To stay on a way until its dead end is not always the best decision.
[Android Apps and Games] post-mortem:
Are you sure that other apps don't also leave references behind when uninstalling? Isn't the uninstalled handled by the OS?
[Android Apps and Games] hgmichna:
Erratic behavior even after uninstalling

There is a lot of sloppy programming around, particularly in Windows. But in Android an uninstalled app should leave no trace. To my knowledge Android handles that properly, provided the app is programmed according to the rules.

I believe it is difficult or impossible for an app to leave anything behind if it does not have root rights. With root, of course, everything is possible.
[Android Apps and Games] guest4711:
Do you think it would be a good idea to delete all pictures taken with a camera app from your phone if you uninstall the camera app? Or all files downloaded if you uninstall the browser app? Certainly not, and so it is not so impossible to leave some data on phone if you uninstall an app...
[Android Apps and Games] Apex Predator:
FYI the app SD Maid has an uninstall watcher function which will monitor uninstalls and let you know if any remnants are left behind.

It's made by an XDA dev, you can search for the thread here. Very reputable app.
[Android Apps and Games] hgmichna:
Incomplete uninstall

Thanks, very interesting.

I have severe doubts though that that app can detect that another app writes files, using root access rights. That is pretty much impossible.
[Android Apps and Games] georgiapi:
Great Apk, Doing very well on my OP6.

Can we get a dark mode?
[Android Apps and Games] ChemoNL:
What settings do you use? Because on my OP6 after the first charge cycle the app stops working.
[Android Apps and Games] maximosm:
I have the same phone s2 with lingea OS 14.1 but the app not working. Can anyone help?
[Android Apps and Games] georgiapi:
What do you mean the stops working? If you plug it in again it will charge over your limit?

Once when I restarted the phone I had to fire it up but it didn't repeat it. Its running pretty reliable. I am rooted stock ROM magisk.
[Android Apps and Games] ChemoNL:
Yes.

After the first cycle the limits are ignored. And I am also using stock rom with magisk.

So I am quite curious which settings you use to make it reliable
[Android Apps and Games] mv0hra:
Would it be possible to have the phone switch off when battery level reaches 5% rather than 0%.

---------- Post added at 10:11 PM ---------- Previous post was at 09:56 PM ----------

Not working correctly for my Oneplus6. Basically it vibrates when it gets to the limit and keeps on vibrating as it continually goes from charging to discharging. The top and bottom limits are 80% 74%.

Anyone know why? [MENTION=6898873]sriharshaarangi[/MENTION]
[Android Apps and Games] Rambdal:
whats mean "recharge below"
[Android Apps and Games] post-mortem:
When the battery level drops below this number, charging will resume.
[Android Apps and Games] psycholyzern:
Is it working fine on Pie?
[Android Apps and Games] guest4711:
It depends on the kernel. On my i9505 (jflte) with buffcore everything is fine.
[Android Apps and Games] ddback:
Sigh, for some reason it doesn't work for me.

Essential Ph1, rooted, Nougat.

Sometimes it'll stop charging at the set limit, but it never respects the lower limit - it will start charging whenever it's plugged in.

BCL has root perms.

Any idea what to look at to figure this out?

Thx
[Android Apps and Games] whitedavidp:
Note 3, Stock Android 4.4.2 (rooted, of course)

Never mind, I found another post in the thread. I assumed that 0 would disable and 1 enable. It is the opposite. Thanks alot!

Hello. I have been looking for something like this for a while now. Thanks!

I installed on my Note 3 (N900 - international version). I set it up to use the Samsung file batt_slate... I can see the file it there and if I cat it in a terminal, it always is saying 0 - even if I uninstall and re-boot. So wondering if this is indeed the right file and, if not, what is?

Thanks for any help.
[Android Apps and Games] Bluffer94:
I'm using stock rom on my pixel 3 and it seems that battery statistics doesn't get wiped when limit is reached, option is activated in app. Is there anything I can do to use this feature?

Gesendet von meinem Pixel 3 mit Tapatalk
[Android Apps and Games] brackenhill_mob:
When I run the app on my Pixel C running Lineage v16 I get a message box saying my device is not supported and when I click on OK the app exits.

How do I get access to the settings page to create my own control file as I can on my supported phone?

I've found the settings and want to test them before publishing them here for others to use.

Thanks
[Android Apps and Games] guest4711:
Did you try to edit /data/data/com.slash.batterychargelimit/shared_prefs/settings.xml?
[Android Apps and Games] brackenhill_mob:
Ah, I wondered what that file was for. Thanks
[Android Apps and Games] brackenhill_mob:
I don't have that file on my Pixel C. I've reinstalled it just to be sure.

I can copy and edit from my phone, but how are others supposed to help widen the number of devices if there is no way to access settings or to create this file?

Not trying to be awkward ...!
[Android Apps and Games] guest4711:
Here's the one I found on my i9505:

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<int name="min" value="60" />
<boolean name="enable" value="true" />
<boolean name="notificationSound" value="true" />
<boolean name="auto_reset_stats" value="true" />
<int name="limit" value="65" />
<string name="charge_on">0</string>
<string name="ctrl_file">/sys/class/power_supply/battery/batt_slate_mode</string>
<boolean name="notificationLive" value="true" />
<string name="charge_off">1</string>
</map>

Perhaps it will help you as a guide how to enter the values you found for your device (ctrl_file should be the key you'll need).
[Android Apps and Games] freakerload:
Is there a way to get an app or tasker script to work without root?
[Android Apps and Games] brackenhill_mob:
Thanks
[Android Apps and Games] sauyadav:
Anybody managed to get this work on OnePlus 6T. For me curving won't stop with default settings.
[Android Apps and Games] jerry18:
I had to set control file to: charging_enabled (Universal) on Lg G6.

Otherwise charging won't stop after reaching desired battery level.

Anyway I noticed big battery drain after charging completed.

For example when battery reach max level (in my case 95%) and I left it still in charger (for like 6 hours about) then battery was on 78% only.

Anyone noticed this behaviour or do I have to set apk differently (for example: Automatically reset battery stats is off)?
[Android Apps and Games] post-mortem:
What is your lower limit ("Recharge below")? Battery stats is unrelated.
[Android Apps and Games] jerry18:
lower limit is set to 50%
[Android Apps and Games] post-mortem:
Set the lower limit to something higher. Also, it's perfectly okay to have many, short charging cycles. You can set the limits to go from 80-85%, for example. Personally, I use 57-60% (charge under 57%, stop charging at 60%). The closer you let the battery get to 100%, and the longer you let it stay that way, the worse it is for the long-term lifespan of the battery.

Aside from all that, if you want to find out why you have so much battery drain overnight, use BetterBatteryStats. You can post your results somewhere in that apps forum, and people will tell you what's causing the battery drain.
[Android Apps and Games] jerry18:
Yeah something has to cause battery drain. I gonna investigate it yet and post here the result after. Anyway wasn't it be better to charge battery once to desired value instead of keeping it charge in presets 'short' range more often in one go (I mean for better battery life)? ...well for all of you without battery drain this case usually won't happen.

That's why I set lower limit so low.
[Android Apps and Games] hgmichna:
Stressing and ageing a Li-ion battery

The number of cycles does not matter to Li-ion batteries. What matters is the voltage and the time span of high voltage.

Below 60% or 3.92 V the battery lasts almost forever, like thousands of cycles or 4 or more years.

Other things to avoid are high temperatures, particularly charging at high temperatures, and discharging to very low levels. Quick charging is also not very healthy, simply because the voltage (and the temperature) is higher, even below 60%.