yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] dasbooter:
Hey ya I have the same problem with Samsung s4. I have an always plugged in s4 I use as part of my home automation brain. Of course constantly charging while discharging the battery caused it to fail and quite badly. I dont really want to automate the process of burning down my house if you know what I mean lol. I think in tasker that you can run a shell script

am force-stop com.my.app.package

you will need the name of this package though. There are different ways to get the package name but perhaps the creator could just give it to us. Of course if he eventually has the time maybe he could implement this in his app in a more elegant way. Force stopping an app is a hack and may cause unexpected consequences. I will try to implement something in tasker and get back with my success or failure. Thanks for the info and anybody else who has a better idea of what to do with these devices that "trickle charge" when there plugged in please let us know. I dont even know which behavior is desirable the trickle charging at less than maximum 80% or 90% or having it cycle up and down in the regular charge discharge cycle.
[Android Apps and Games] Emre67511:
deleted
[Android Apps and Games] winjer:
Running Superman ROM on a Galaxy s7 gs930f. I set to charge to 90 but it stops at 70. Tried both control files available to me (store_mode and batt_slate_mode) and didn't seem to make a difference. Logcat doesn't show anything happening at 70 with the suggested filter. Added a new issue:

https://github.com/sriharshaarangi/BatteryChargeLimit/issues/56
[Android Apps and Games] post-mortem:
The package name is com.slash.batterychargelimit

I addressed this point in a previous post here.
[Android Apps and Games] chickentuna:
I have a Xiaomi redmi note 4x running RR 5.8.5 and the app works just fine however, the app is broken in Oreo. It doesn't automatically launch when I plug my charger. Reverted back to nougat RR 5.8.5 because of this.

The Oreo rom I'm talking about is AOSP Extended and the control file (both in Oreo and Nougat) is battery_charging_enabled. I've tried changing the control file but it still doesn't work. What do I need to provide to get this fixed?
[Android Apps and Games] post-mortem:
Try to manually edit various files while charging in Oreo, and see if you find one which does the job. It may be that charging is accomplished differently in Oreo, and these control files don't accomplish the same thing as in Nougat.
[Android Apps and Games] Emre67511:
choose batt_slate_mode in the app and then reboot your device. had the same issue.

I think when store_mode was enabled 1 time you have to reboot to disable it again
[Android Apps and Games] ashutoshmn:
you sure about that? Cuz the thing is, after the app stops charging say at 80% while still plugged in, start some app that monitors current and what you find is that there is no discharging of the battery or in other terms the phone is directly powered off charger.

Please correct if wrong.

Also, can you please explain the concept of trickle charge in this context only?
[Android Apps and Games] Emre67511:
what I assumed is true. I tried editing the store_mode file and also deactivated the service and changed the control file but it is not possible to set the store_mode manually back to 0 except a reboot

but I don't know if this is a issue of the app or of the rom

edit: changing permissions also don't works the file just resets every time when I refresh the folder
[Android Apps and Games] post-mortem:
This may depend partially on the hardware and partially on the ROM. When the control file is edited to prevent further charging, some devices will allow the device to be powered directly from the external power source, as if there is no battery installed. Other devices will behave as if you've unplugged it, and it will run off the battery. Whether because the latter is true or because of high power draw, if the battery level discharges below the lower threshold, the app will change the control file back to allow charging again.
[Android Apps and Games] dasbooter:
Thanks I did peruse that article but wasn't sure the situations described there applied to an always plugged in device. I know that charging while discharging is typically not good for a battery. I just wasn't sure which scenario was better letting the battery drain to 80% with NO voltage going to the battery than charging to 90% or the current situation I'm observing wherein a small voltage is applied not charging the battery but keeping it almost even. I use older android devices in place of light switches with widgets on the screens to turn on and off lights for people who don't like using voice commands with my Google home. I had no luck in removing the battery from the mix by soldering a battery circuit to a power source and applying it to the phone. This always plugged in situation previously caused my batteries to fail and produce combustible battery soup that bulged the back off of the phone. Any ways thanks for the pointers and open to any ideas. Hope I helped that other guy out.
[Android Apps and Games] post-mortem:
Honestly, I don't think this has been studied extensively enough, with all the confounding variables accounted for, to come to a definitive conclusion.

But why would you need to solder anything? Can't you just remove the battery and leave the device plugged in to a power source?
[Android Apps and Games] hgmichna:
How to charge a Li-ion battery

What?
[Android Apps and Games] post-mortem:
He means to try to charge a battery while simultaneously drawing current from it.
[Android Apps and Games] hgmichna:
Charging logic

A bathtub has a tap to add water and a drain to remove it, so you could, if you ever wanted to, add water at the same time as letting it drain out.

A battery is different. It has only one connection (two wires/contacts), through which electricity can either flow in or out, but not both at the same time.

Therefore the original worry that simultaneous charging and discharging could damage the battery makes no sense, because simultaneous charging and discharging is simply not possible.

What is possible, and some phones apparently work that way, is that the phone draws exactly as much electric current from the charger as it uses. This means that the battery gets none of it. The current simply bypasses the battery.

Most other phones cannot do this, so with the app active you get a charge-discharge cycle. As long as the voltage remains moderate, particularly at charge levels not higher than 60%, this does not noticeably stress the battery either, so no worries. Settings up to 80% are good compromises.

Li-ion batteries get stressed only at high voltages, i.e. approaching 100% charge or 4.2 to 4.3 V. They also don't like excessive heat.

And they don't like deep discharges, but those are automatically prevented by the charging electronics. Thus the only way to damage a Li-ion battery in a phone through a deep discharge would be to discharge it to the switch-off limit and then not charging for many months. The very slow self-discharge would then kill the battery.

I think this should be all there is to know about Li-ion batteries.
[Android Apps and Games] Je5hu4ver:
That is prretty awesome. Any idea why by default they only do 80%?

I mean will charging it up to 95%/100% rek the battery or what?

Will it start to exapnd?
[Android Apps and Games] guest4711:
To know the theory see http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries
[Android Apps and Games] Infy_AsiX:
What you're concerned about is related to what's called Parasitic Load. This article is an informative summary about it http://batteryuniversity.com/learn/article/how_to_charge_li_ion_with_a_parasitic_load. The top part of the article is useful but read particularly in your case the first five paragraphs under the section Parasitic Load.

Putting that info into basic terms for your usage. Use a slower charger, stop charging for several percent after reaching the limit. The limit is set lower but the article does not go into what's the ideal lowered voltage limit. You'll need to look that up further. I do recall this article https://qnovo.com/why-battery-vendors-are-hitting-the-wall/ demonstrating voltage related damage and 3.9 seems to be highest where there's the least risk. This fits with that Prolonging article post-mortem linked previously, where shown in Table 4 that 3.9V has the highest cycles.

Indeed it would seem. Paragraphs 3 to 5 under that aforementioned Parasitic Load section as well as the Summary conclusion echo your sentiments.

That's wrong based on how Parasitic Load charging exists.

From that article "Another method is keeping the cell at the 4.20V/cell level. This would be the simplest technique but most Li-ion manufacturers do not approve of this method for safety and longevity reasons.". It explains further, which I used to describe the setup for dasbooter.

I didn't really realise that the "AC power is divided into charging the battery and operating the device.". It apparently is possible for the current to redirect to the device only, but as mentioned above it's not as ideal.

Cold temperatures too. Also a smaller Depth of Discharge wears less than a higher DoD, another consideration for health. It's complicated engineering there's a lot more to it still.
[Android Apps and Games] hgmichna:
Charging logic

Parasitic load means that the charger is connected to both the battery and the load, which makes it more complicated to determine when the battery is full.

In the case of a smartphone the phone is always drawing some varying current, charging or not. To call it "parasitic" is a bit strange in this case, as it is perfectly normal for a smartphone to do hard work while being charged, and the "parasitic" load can be quite high. When the screen is on, it can be around 300 mA. Putting some extra load on the GPU can raise that current even further.

Therefore phones have a somewhat more sophisticated charging logic. They measure not only the voltage, but also the current directly at the battery terminals, so the "parasitic load" has no effect on the charging logic, apart from the charging current not being constant.

If you want proof of this, just install the Ampere app and look at the current it displays. That is the current that actually goes into the battery, i.e. charger current minus "parasitic load".

As long as we are running the Battery Charge Limit app and set it to a moderate value not above 80%, these things become less critical anyway. We don't have to worry any more about the fine limit between fully charging and slightly overcharging.
[Android Apps and Games] Infy_AsiX:
I already use CoolTool or DevCheck to overlay for real time monitoring, they can get current_now.

Yes, but my suggestions were directed in response to dasbooter's full-time plugged "combustible battery soup that bulged". However the resource explains what practice is best and that can have some relevant application to any Li-ion batteries.
[Android Apps and Games] post-mortem:
And I suppose that's another point we should mention, that all this discussion is only applicable to Lithium ion battery technology, and not to lithium polymer or other battery types which are currently not used in mobile devices.
[Android Apps and Games] Aria.A97:
[MENTION=6898873]sriharshaarangi[/MENTION] Works on S6. Great app, something I always wanted :D

If you are open to suggestions: Automatic reset stats should reset stats when it hits the upper limit. With current method it resets after battery has drained for a few percents, that will cause problems with other battery monitoring apps (BBS shows negative values for example)
[Android Apps and Games] Infy_AsiX:
Lithium polymer is a type of Li-ion battery.

"One of the most common misconceptions is that polymer batteries are different. In fact, they are one of the common types of lithium-ion batteries, assembled and packaged in a flat, pouch-like shape. Their core design is based on the standard lithium-ion chemistry. They are called “polymer” batteries because they tend to use an electrolyte that is gel-like than liquid-like. The outer package is a thin foil that holds the internal structure together."

https://qnovo.com/different-battery-shapes/
[Android Apps and Games] HikingMoose:
And Pixel users in here? I've been trying to get the app to work for Pixel XL that I just got to replace my 6P under the extended warranty, and can't get the app to work anymore. On the 6P it would stop charging as it's supposed to, but it couldn't reset the battery stats. But on the pixel XL, it can't do either.
[Android Apps and Games] Unreasonable_User:
Seconded. Pixel XL is no go currently. Tried with stock Nougat and stock Oreo.
[Android Apps and Games] mochamoo:
Thirded. Am only seeing some less than ideal workarounds so far. Tasker one seems promising once I have time to figure that out.
[Android Apps and Games] Droid_JD:
Pixel XL here. I believed it worked for me, but I had the phone on with navigation active. With screen off I've had no success.
[Android Apps and Games] HikingMoose:
I can confirm the control file for the Pixel XL is the same as other HTC devices such as the HTC one m7. It's in >sys/class/power_supply/battery/charger_control. I found a post by Syntr@nic who said he'd found it, and all I did was check our Pixel to see if it was the same and it is.

[MENTION=6898873]sriharshaarangi[/MENTION], is it possible to get that added to the app?
[Android Apps and Games] HikingMoose:
I still don't understand why the dumpsys command to wipe the stats doesn't work on Android 8.0. the stats appear to be in the same place, but they don't get wiped.
[Android Apps and Games] aamadorj:
Battery Charge Limit is resetting battery stats just fine on Nitrogen OS O, which is based on AOSP 8.0.0_r17.
[Android Apps and Games] RedSkull23:
Try installing this Magisk module; it's from an user, [MENTION=1939077]edjocute[/MENTION], that solved the dumpsys permission issue that i (and many others) was facing on my Honor 6X
[Android Apps and Games] HikingMoose:
It wouldn't reset the stats on my 6P in stock. And on the Pixel XL, the app can't stop the charging or reset the stats. Manually trying to reset the stats in terminal yields the same result.

I'll give that a shot. Ideally, I need to get the main function of the app working. It's the most useful all I use on Android. Been using it for about an year,

and it's rough not having it.
[Android Apps and Games] RedSkull23:
I totally understand you, i was pretty upset when that reset stats button wasn't working. After this, it didn't missed a shot anymore. Try it and let me know if it'll works.
[Android Apps and Games] HikingMoose:
Well, I have it a shot and figured it would work. But.... it didn't. Crap. Thank you though!

The app works perfect on a 6P with Nougat. Not great on Oreo though - but can work to stop charging if you do a clean install. But the Pixel on Oreo is a no go at all! Hmm.
[Android Apps and Games] Takriss:
Hello!

Thanks for this very useful app. Version 1.0.4 working on Redmi 3S Prime with Xperience rom based on Nougat. Mode: generic.
[Android Apps and Games] HikingMoose:
I may have found the issue. It appears that we have numerous control files. If I get a chance, I'll plug in and try each one separately and see which one works, if any.
[Android Apps and Games] Bobbaloo:
I'm using it on Oreo. Works fine here. 6p, Nitrogen. Reset stats, limit charge, all good... Good to hear from ya moooster! Enjoy the pixel XL.
[Android Apps and Games] RedSkull23:
Damn, i thought it could. I'm sorry, maybe it's possible to add a workaround for Pixel devices, try writing directly to edjocute to see if he's willing to help, if possible!
[Android Apps and Games] guanto96:
Hi, the app doesn't work with the Nexus 5.

Aicp 12.1 (android 7.1.2) with blue_spark kernel and magisk
[Android Apps and Games] mochamoo:
Yes, seems there are a few files that it "could" be but don't know which. Worked great on 6p with Oreo (although I usually use accubattery for stats so not sure if it was resetting those ok). Not working at all on pixel xl so an relying on accubattery to beep at me when it hits 80% and also for stats. Miss being able to plug in the xl overnight and not worry that it was overcharging. Would also leave the 6p plugged in when at my desk without worry

Am wondering if it has anything to do with the a/b partitions? Clearly it is a bit over my head.
[Android Apps and Games] Infy_AsiX:
Examining \system\etc\thermal-engine.conf may reveal what file stops charging when overheated.
[Android Apps and Games] mochamoo:
BTW, just came across this. It is what I was referring to in my recent post as wanting to try. Maybe tomorrow. Haven't used Tasker before but worth a try I think.

https://xdaforums.com/showthread.php?t=3668059
[Android Apps and Games] soseono:
Edited because I found out that the beeping at the charge level was the setting that beeps when power source was plugged in/out. The phone must have thought that when this app limits charge, I’m unplugging power and hence beeped notification alert. It was driving me nuts and I’m glad I found the culprit.

When I searched this forum thread, I found some people asking for notification alert when charge limit reached. When you add the feature, would you please add an enable/disable option? I charge at night and am not happy that I’m waking up due to the notification alert despite Do Not Disturb. Anyway, now that I’ve found the culprit I can finally go back to sleep...

By the way, thanks for the awesome job, dev! Please keep up the good work!
[Android Apps and Games] hgmichna:
Sleep at night

You can switch your phone to quiet mode while you sleep. There is a "Do not disturb" button in the quick settings, for example. You can even set quiet times that do not require any further action every evening.
[Android Apps and Games] soseono:
I do have DND set up but this notification sound was still sounding through no matter what. I found the culprit though. It was the setting that sounds notification when power is plugged in and when unplugged. When the app changes the power setting, the phone must have thought that I unplugged the phone and sounded the alarm. I just tested by disabling the setting and am happy that the sound is no more.

I edited my original post accordingly.
[Android Apps and Games] hgmichna:
Yes, I think that is exactly correct.

The sound possibly got through because it is an alarm, and the normal "Do not disturb" blocking lets alarms through, unless explicitly set up otherwise.

Nearly off-topic now, but for the sake of completeness …
[Android Apps and Games] ssechaud1982:
Tried v1.0.4 on both HTC M8 and Nexus 9 on LineageOS and charging is not disabled after reaching the limit. /sadface
[Android Apps and Games] arses:
Works perfect on HTC U11 ViperU rom.

Thanks for your great app.
[Android Apps and Games] HikingMoose:
I don't understand why it doesn't work for 90% if HTC devices, but over in a great while someone says it's works for theirs. Weird.
[Android Apps and Games] borderite:
1.0.4 works with Nexus 6P but does not work with Galaxy S3 on Lineage OS

Thanks a lot for creation of Battery Charge Limit. The version 1.0.4 works perfectly on Nexus 6P. Unfortunately, however, it does not work with Galaxy S3 on LineageOS (using batt_slate_mode). Here is my observation on Galaxy S3:

1. Once the desired level is reached, it correctly sets batt_slate_mode to 1. It seems that this shuts off the charging power, if you believe the LED of the device.

2. In a while after the charge is stopped, the LED turns on indicating that the battery is being charged. (The device sets batt_state_mode back to zero?)

3. Soon after 3, the LED turns off. (Probably, Battery Charge Limit sets batt_slate_mode back to one.)

4. The above two moves (2 and 3) gradually pumps the power to the battery. They repeat until the battery is fully charged.

So, it seems that Battery Charge Limit is a kind of doing the job, but it is not attaining its goal.

Thanks,

Borderite
[Android Apps and Games] dibt359:
Nice, nice, nice!!!

Zuk Z2 Plus w AEX.

_

Noob here, I think my battery % got stuck as long as the cable was plugged after it reached the target and now it's not accurate, is that a possibility?

I continued using the phone after it was done charging (40%, testing) and it never changed from 40, even after I used it unplugged for about 10min. Rebooted... now it's not stuck anymore.
[Android Apps and Games] HikingMoose:
Does it always drop within the first 10 minutes of use? It doesn't sound like anything is wrong to me. But of course you know your phone better than I do.

Just try it for a few days, you'll like it.
[Android Apps and Games] RedSkull23:
Hi man, i just noticed that the module doesn't work anymore from Magisk V14.3 beta, and i have the doubt that the same was happening on V14.2 stable release too, because i went on battery menu and i found 42h SoT in last days while i was still on V14.2. Even manually clicking on reset battery stats in BCL menu doesn't help, like if there is again a problem with dumpsys permission... You know what could be the problem, or a workaround? Thanks in advance.
[Android Apps and Games] 5anny:
Work on Custom ROM? Paranoid Android 7.3.0
[Android Apps and Games] RedSkull23:
Of course.
[Android Apps and Games] 5anny:
Help

Nexus 5 - Paranoid Android 7.3.0

https://pastebin.com/0JQWvEAn
[Android Apps and Games] post-mortem:
It is preferred that a very long post such as yours with log info should be put on Pastebin or a document in the cloud, and a link included in your post, rather than including the entire log contents here. It is particularly annoying for those who browse on a mobile phone, as they have to scroll a great deal to get past it.

At the very least, you can add [hide][/hide] tags around the log info.
[Android Apps and Games] 5anny:
Sorry
[Android Apps and Games] post-mortem:
So you installed BCL from Solid Explorer, then you launched the app and it crashed, right? What were you doing? Did you get a chance to get into the settings? I presume you've restarted your phone since then. Any further crashes?
[Android Apps and Games] RafalCOM:
Not limiting charge on Pixel XL

I had a previous version working fine but clicked on an upgrade and now it's charging to 100% even if it's set to 80%. Pixel XL with Magisk.
[Android Apps and Games] post-mortem:
All the old versions are available in the OP.
[Android Apps and Games] wongster12:
I have a Pixel XL and would love this app. Which release version worked for you?
[Android Apps and Games] Droid_JD:
I Don't know about newer versions, but 0.8.2 works on my XL
[Android Apps and Games] Smantanasiceapa:
When I "reach" 100%, sometimes I go for an extra juice I continuilly charge in recovery mode, from where I see is that there is a difference of 10%. MAybe my phone (S7 on Decent Ultralite ROM) already knows when she does need to be plugged out. If I use this app (which it does great job) and let default 90%, in recovery mode i'll have 80%. Which mean's I don't charge my battery corect.
[Android Apps and Games] gts24:
Hmm I've used the latest couple versions and they do not work on my Pixel XL. Just downloaded 0.8.2 and am giving i ta shot now. Thanks for the info
[Android Apps and Games] GryTEcHoG:
What does actually "auto reset stats" do ? Enabling this is better for battery ?

Thanks
[Android Apps and Games] post-mortem:
No, it has nothing to do with the battery. When you unplug the charger and the battery level is at 90% or higher, the Android OS automatically resets the battery stats. If you go to Settings -> Battery, the graph will be wiped out. Since the people who use this app typically want to limit their battery to 80% or less, then they will go weeks and months without ever reaching 90%, so the battery stats will accumulate until the graph is no longer useful. You can set BCL to automatically reset the battery stats every time your phone reaches whatever limit you set, instead of 90%.
[Android Apps and Games] gts24:
Walp, that doesn't work either on my Pixel XL. Shame, I'm gonna have to try one of the various scripts to do this manually I guess.

Shame because this worked so well on my Nexus 6p.