yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] bluegizmo83:
It wasn't easy. To be honest it just took a lot of trial and error looking at and editing files, starting in the recommended folder /sys/class/power_supply/battery as found from the Json file for this app on GitHub. Using the file manager MiXplorer, once I got to that folder path, I checked all the files there, with no luck, and then started going through all the folders that were linked in that path (MiXplorer shows linked folders with a red back arrow on then), when clicking on one of those linked folders called Device I was taken to it's actual path, in the case of this tablet, that was /sys/devices/platform/7000c400.i2c/i2c-1/1-000b and there was no luck in that folder either, and I eventually went up one level to /sys/devices/platform/7000c400.i2c/i2c-1 and started going through all the files and folders in there. I eventually ended up in /sys/devices/platform/7000c400.i2c/i2c-1/1-006b and when I tried editing the file charging_state (it only said "enabled" inside the file so I figured ok, try changing it to the opposite, "disabled"), and that finally did it. It stopped charging with the cable connected (verified with AccuBattery, showing no positive mAh). It was a little bit of knowledge, and little bit of patience, and a little bit of luck.

Edit: one tip I can give anyone trying to find the correct file (I noticed this when trying to find the file), you can pretty much ignore any file that has a permission state of r-r-r (which is read only). A lot of the files in all these areas where r-r-r. The right file will be rewritable (rw-r-r). But just because a file is rw-r-r doesn't mean it's the right file. But there are far more files in all these locations that are just r-r-r, don't waste your time trying all those.

Edit2: you can also check the uevent file in each folder location. That file will show you the current setting in every other file in the same location, giving you a quick idea of what files to try editing next.

Edit3: sorry for all the edits! One more tip, all these locations have a folder in them called Power. Don't bother with that folder. It contains files starting with autosuspend, control, and runtime. None of the files in the Power folders are the battery charging control file.
[Android Apps and Games] Gibbothegreat:
Can you post the link for MiXplorer can't find it.
[Android Apps and Games] post-mortem:
https://xdaforums.com/showthread.php?t=1523691

:good:
[Android Apps and Games] jerico123:
For those this app does not work they can try battery warner apk ..It works like charm for nexus 6 ..

https://xdaforums.com/android/apps-games/app-battery-warner-t3560920
[Android Apps and Games] ashjas:
Which control file option do you select?
[Android Apps and Games] chenrp:
installed, gave supersu, but when charging it goes over 80%.

app enabled but still charges over 80%...

ONEPLUS 3t...
[Android Apps and Games] bluegizmo83:
Anyone who's interested in charge limiting on the Nvidia Shield Tablet, I created an Automate flow that works on this tablet. Check the Automate community to download it, its named "Charge Limiter (ROOT, Shield Tablet)".

Obviously requires root and is only compatible with the Shield Tablet.

EDIT: I have updated the Automate Flow. It no longer requires Selinux Permissive

I recommend disabling/removing this Automate flow and using the app from this thread once its updated to work with the Shield Tablet.
[Android Apps and Games] Midomad:
[MENTION=6898873]sriharshaarangi[/MENTION]
[Android Apps and Games] pascalthebest:
HTC u11 is supported?
[Android Apps and Games] real_milux:
Please open a GitHub issue!

There is simply to much stuff around in this thread, it takes me too much time to dig through everything.

[MENTION=535343]all[/MENTION]: Posts like "it worked with XYZ and now it doesn't" are really not helpful!

I'm trying my best to fix every bug that's properly reported (GitHub!), and proper reporting includes logcat logs that help me to understand errors that I don't encounter on any of my devices.
[Android Apps and Games] amplatfus:
Hi, just tried to download v 1.0.2 but I got no mirrors found error. Thanks for cool app.
[Android Apps and Games] real_milux:
You may have to wait for AFH to distribute the file to their mirrors.

Others have already been successful. ;)

BTW I just published 1.0.3 because I missed a bug. (That wasn't reported on GitHub, comes without saying. :mad:)
[Android Apps and Games] amplatfus:
Thanks. And about 1.0.3 please where we can get it? All the best!
[Android Apps and Games] real_milux:
OP? :p
[Android Apps and Games] jerico123:
Does 1.0.3 version is working with nexus 6 ?
[Android Apps and Games] bluegizmo83:
[MENTION=6929614]real_milux[/MENTION] you may want to fix the changelog for v1.0.2, you listed experimental support for the Nvidia Shield, it should be Nvidia Shield Tablet. The Nvidia Shield was originally the name of the very first device, a handled portable controller/screen combo device (later renamed the Shield Portable, but some people still think of it when they hear Nvidia Shield)

Edit: and thanks for your work on this app!
[Android Apps and Games] hansxl:
I've similar problems on both our phones at home (Galaxy S8, Renovate ICE 4.0 with Magisk root and Galaxy A5 (2016) with official Marsmallow and Supersu root). It functions only the first time after booting (all parameters of the app are default). While charging the first time i can unplug and plug the power in again and it still functions. But after reaching the 80% the first time and plugging in the power again after a few hours it will not charge again. Even after disabling the service the phone won't charge.

When the service is enabled it will say in the notification 'Waiting until 80%' but the app gives status DISCHARGING.

After rebooting it will charge again.
[Android Apps and Games] hansxl:
Second observation: if I unplug the power at 78%, thus before the max. target of 80% and plug it in later when the battery level is down till for example 55% it functions fine. So it seems to me that, anyway for our Samsung models, the problem arises when it has first reach it's target level (which is 80% for us). For some reason the phone will not charge again until rebooting.

Btw I use the latest version 1.0.3.

Would it be possible to have a (experimental) switch in the app and when that switch is on and you unplug the power cable it resets the phone to the same state as after rebooting (initialise all relevant paramets???) Or is this a stupid idea?:silly:
[Android Apps and Games] pranay.pratyush:
Is it possible to prevent charging once target is reached but keep on powering the phone?

Doesn't the phone automatically do this on 100%? Otherwise we would have multiple cycles of 100-99 within an hour and battery would be done in a matter of days.

---------- Post added at 09:50 PM ---------- Previous post was at 09:48 PM ----------

Is it possible to keep powering the phone when target is reached ?
[Android Apps and Games] real_milux:
Referring to the last question: That's exactly what we do already.

However, the app checks the previous content of the file and overwrites it only in case of a change. It sounds weird, but I think going back to "blind writing" could actually solve the problems that you mentioned. It seems that some devices require the control file to be overwritten, even if has already been reset.

One more question: Does physical removal of the power supply restore the normal operation, or does it really require a reboot?

We already observed strange behavior with Samsung specific control files, more precisely the store_mode file. On my Galaxy Note 10.1 2014, setting this to "1" "freezes" the battery level at the current value, until power is physically removed. If this is a similar problem, try another control file if possible, because there might not be anything we can do on our side.

Such weird reactions are 99% because of strange implementation decisions of OEMs. Always keep in mind that we mess with the kernel in a way that was never intended by the OEMs. ;)
[Android Apps and Games] hansxl:
Unplugging the power cable doesn't restore the normal situation I really have to reboot.

This situation arise only when I charge the phone until the set target limit (80%).

I have a third observation (don't know if it makes sense to you :eek:). After reaching the target limit of 80% I let the battery level drop under 70%. I did this twice. 1 time until 63% and 1 time until 45%. In both cases it will charge again but no further than 70% :silly:

The app show status DISCHARGING but also says 'Waiting until 80%'.

So after reaching the limit of 80% it start acting as if there is a new limit if 70%?
[Android Apps and Games] real_milux:
Are you using store_mode? This is almost precisely the behavior that was reported on new devices using this file.
[Android Apps and Games] hansxl:
Yes, I use the default parameters. The control file is store_mode (samsung note).

I just tried something more. Without rebooting I changed the charge limit, one time to 60%, while the battery was at 67% (thus above limit) and after plugging in the power cable it charged again till 70% (while saying 'Maintaining between 60 and 58%:)).

After this I dropped again until 67% and set the charge limit at 99%. Same result, charging till 70%
[Android Apps and Games] hgmichna:
Rapid charge-discharge cycle

I keep having this problem from time to time on my OnePlus One with a regularly updated LineageOS 14.1 and always the latest version of the app.

Usually the app activates and deactivates charging in a 6 + 6 seconds cycle. The phone gets hot. In some rare cases there is no cycling and the phone just quietly charges to 100%. Often the error does not occur, but about every third or fourth night it happens.

It happens only when the phone is connected to a strong charger with a charging current in the range of 1 A to 1.5 A. I often charge it during the day on a 500 mA USB port, and there it never happens.

At night a sleep surveillance app (Sleep as Android) always runs and uses some battery charge, just a bit too much to run the phone overnight without charging.

I use the generic charging_enabled control file. Max charge is set to 60%. Recharge has been set to various levels, down to 50%. That did not solve the problem.

Enforce Charge Limit is activated. Should I deactivate it for further testing? I don't understand what exactly it does.

I had already posted log excerpts earlier. Nothing has changed there.

I still think that leaving the charging interval at 6 seconds while extending the not charging interval to at least 2 minutes could defuse the problem, if that is possible and if no better way can be found.

Meanwhile I will try to use a much weaker charger and see if that could serve as an emergency workaround.
[Android Apps and Games] real_milux:
That's a normal condition, 100 % device-specific, known behavior.

Folks, please don't report this anymore. It is NOT A BUG!

---------- Post added at 12:04 PM ---------- Previous post was at 11:58 AM ----------

I would not recommend fast chargers anyway. Fast charge = higher current = higher voltage = shorter battery life.

The current version of the app will try to make the on/off cycles longer until it's 30 seconds "on" and 30 seconds "off".

If your device cycles with higher frequency, it means that your device accepts the "stop" command for some seconds, but then it just goes on charging.

Sorry to say that, but in this case there is nothing I can do to improve your experience.

Your device is simply refusing to accept the stop signal, period. Sorry. :(

---------- Post added at 12:08 PM ---------- Previous post was at 12:04 PM ----------

PS: As always, there is little chance that I can find a workround when I get a filtered logcat of the device behavior. But honestly, rapid cycles with versions after 1.0.0 is likely something I cannot fix.
[Android Apps and Games] Brainlab:
Not working on my S8, Device not supported. Also I'm using fast charger battery.

Do you have any idea guys?
[Android Apps and Games] naifaharsy:
Check on my desire 820..
[Android Apps and Games] hansxl:
Ok pity. If I understand correctly it's device specific that our S8 and A5 charge correctly only once after reboot and after that maintain a intrinsic limit of 70%?:confused:

And there's no fix possible to restore the 'reboot situation ' after every disabling of service/disconnect from power :crying:

Anyway I'm still happy with this app but will delete it from my wife's A5. Too much trouble for her :D
[Android Apps and Games] real_milux:
It's device specific that your devices will charge no more than 70% after store_mode has been triggered.

For me it's sufficient to remove the power supply to charge it over 70% next time, for you the same thing might require a reboot.

You could try a different control file, if available. It might have other pros/cons. Some Samsung devices (both of my devices, for instance) do also support batt_slate_mode. This doesn't suffer from the hard 70% limit like store_mode, but it might completely disable the power supply and therefore drain the battery a bit, which causes a refresh after the set minimum threshold has been reached.

It's not possible to fix the store_mode behavior, this is Samsung kernel implementation stuff, no chance!

Edit: I want to add that this very same explanation is also found in the FAQ section of the OP. But because you asked nicely, I explained it again. ;)
[Android Apps and Games] hansxl:
Okay I got the message and thanks for your kind explanation :good:
[Android Apps and Games] Cro Cop:
This app worked for my HTC 10, but it doesn't anymore, it always get past 80 percent when charging. 1.0.3. version here, what should I do?
[Android Apps and Games] bluegizmo83:
I was also experiencing over charging on my device, a Shield Tablet. Your issue may be different than the one I had, but if you want to try the simple fix that worked for me, disable "Enforce Limit" option in the app settings and see if that helps. It worked for me on the Shield Tablet.
[Android Apps and Games] post-mortem:
If the new version doesn't work, use the old version which worked. The links are in the OP.
[Android Apps and Games] pranay.pratyush:
Is there a way to actually limit charging and not totally stop it once target level is reached. So that the phone is still powered by usb but not charging. I am on OnePlus 5 btw.
[Android Apps and Games] hgmichna:
Stress from charging-discharging cycles?

This has been discussed here not long ago. Check the recent pages.

The function you are asking for is only a small advantage. The battery does not mind to be charged in cycles, as long as the voltage is not too high (under 3.92 V).
[Android Apps and Games] HikingMoose:
I couldn't find it in the thread, but is there a workaround to reset the battery stats on the Android O DP4?
[Android Apps and Games] naifaharsy:
Not working for me..htc d820u root..:(
[Android Apps and Games] real_milux:
Honestly, I don't know. ;)

That is due to the fact that you only said what device you use, and this is indeed entirely irrelevant for your issue. :p

What was the last version that worked?

How is the device behaving?

What is logged in catlog?

Is the charging mode constant or cycling?

So many questions, and not a single useful answer... ;)

---------- Post added at 02:07 PM ---------- Previous post was at 02:05 PM ----------

No useful comment :(
[Android Apps and Games] Cro Cop:
It's all good now ^^, I changed some settings (disabled "Enforce charge limit" and put Control file to "Charging_enabled generic"), now the 1.0.3. version works like it should.

One of the most useful apps I have ever used ?
[Android Apps and Games] Gregbol:
Hello.

Can someone help me the software no longer reload after stopping the load has 80%.

I have a 3 n9005 eur rom phronesis v6 kernel phantom 1.2q.

Thank you.

Envoyé de mon SM-N930F en utilisant Tapatalk
[Android Apps and Games] 中国塔灯:
very good
[Android Apps and Games] CharlesWise:
I Will Try This

Thanks for this app, I will try to root my phone first then I will try this one. :D
[Android Apps and Games] Alvian_P:
thanks man, Very use full app for maintain battery health, like in my Vaio. Its worked for my sony Z5c stock rom 7.0 without change stock app settings.
[Android Apps and Games] dsjd:
The battery stats reset from this app

https://xdaforums.com/android/apps-games/app-battery-warner-t3560920/page11

Works well with magisk.. And it's open source.. Could you implement it in your app?
[Android Apps and Games] rayparlour:
After reaching the charge limit. I've noticed my phone does not go into deep sleep causing it to discharge much more rapidly leading to several cycles over night of it charging the few percent between the apps upper and lower limits.

Is there a way to fix this and have to enter deep sleep?

Running stock OOS on OP5
[Android Apps and Games] hgmichna:
Stress from charging-discharging cycles?

No need to fix, as it is not a problem. Perhaps there is a way to "fix" it, but if not, don't worry.

Somehow there is a widespread belief that batteries age by the number of charge-discharge cycles, but this is, for the most part, untrue. Li-ion batteries suffer from high voltage. They do not wear out from cycles at low voltage.

They also don't like heat, by the way, but this should also not be a problem in your case.
[Android Apps and Games] kbit013:
Sorry
[Android Apps and Games] gsw5700:
I have a HTC 10, I've disabled "Enforce Charge Limit" and set "Charging_enabled to generic. I'm looking at the app now, the charge limit is 85% and recharge set to 75%. The status is "CHARGING" and the current battery level is at 91%. Note that it did stay at 85% for a while

Is this still working for you? Thanks
[Android Apps and Games] Cro Cop:
It worked for me this way one time, but today it did not stop charging at 80 again for some reason (does android powersaver play a role here ?). I'll try and use an older version of the app

edit : version 0.9 works fine so far (no settings changed)
[Android Apps and Games] Vovodroid:
Reset battery statistics

Hi,

how this function (let's take manual reset) is supposed to work? It does nothing on Galaxy S3/4.3 (at least I don't see any effect)

Regards
[Android Apps and Games] RedSkull23:
Everything is explained in OP, from how it works to how to use it
[Android Apps and Games] Vovodroid:
Do you mean first post in thread? There is explanation about automatic reset, but not about reset in general. I expected that Android Battery settings shows graph and consumption from the reset moment, but it didn't happen.
[Android Apps and Games] bluegizmo83:
That's how it's supposed to work, the Android battery settings graph and consumption should start at reset. On a lot of devices though it doesn't seem to work unless you set SELinux mode to Permissive (which I had to do, then it works perfectly).
[Android Apps and Games] Vovodroid:
On my phone getenforce returns Disabled
[Android Apps and Games] bluegizmo83:
Did you SU first? In terminal emulator on my device if I don't do SU first, then getenforce, I get a permission denied error.
[Android Apps and Games] Vovodroid:
Sure:
[Android Apps and Games] bluegizmo83:
Weird. Try the battery reset command in terminal emulator and see what that says/does

dumpsys batterystats --reset

The SELinux thing may be an Android 4.3 issue (you did say your running 4.3 right?).

On that version of Android you may have to EDIT /etc/selinux/config file and change SELINUX=disable to SELINUX=permissive
[Android Apps and Games] Vovodroid:
Doesn't work:
[Android Apps and Games] bluegizmo83:
Ah ok yep I just looked up the battery reset command (https://developer.android.com/studio/profile/battery-historian.html), it requires Android 5.0 or higher, so it wasn't implemented yet in 4.3, so the battery reset of this app (and that terminal command which is how the app reset it) won't ever work on 4.3
[Android Apps and Games] Revertron:
Working great on Sony Xperia XZ!
[Android Apps and Games] MPJINFiNiTE:
For me it was always 1! I set it to 0 and then the battery charging gets disabled and device runs on supply.

Check the screenshots. The bolt icon is there but in settings it says not charging!
[Android Apps and Games] real_milux:
I can confirm the correct working of "store_mode" (Samsung Note 10.1 2014 Edition, SM-P605).

Actually, it works better than the default method, because it maintains the battery voltage until power supply is removed.

This is far better than the 3-percent-back-and-forth of the normal method.

Speaking of the normal method, I see an issue with that and a way to resolve it:

The problem: I use a sleep tracker that requires some amount of energy. My phone is plugged in the whole night. The battery is now charged until 82 % (my limit), then falls back to 79%, is then charged up to 82 % again, and so on. I don't want to imagine how often this cycle repeats.

Effect of the problem: So now instead of charging completely and finally bypassing the battery, the device is charged until the limit multiple times - I think that's not necessarily desirable for improved battery life, especially when somebody uses a limit close to 100 %. In this case, the method will cause more harm than good.

Suggestion: Implement the option to set an optional time for "real charging". Until that time, maintain only a very low battery level (maybe 10 or 20 percent). When the charging time is reached, start to charge up to the limit and maintain the voltage using the normal method.

Of course, it's just a workaround. store_mode-semantics would be more desirable...

Opinions?
[Android Apps and Games] brownsmell:
This is correct, the battery cycling is unnecessary and at some point it will become harmful to the battery longevity. Keeping in mind that it is impossible to keep the battery frozen, it will always be in a state of 'flux' because that is just how batteries work. 3% may be more cycling than ideal, but not necessarily.

If you really look closely into all of this you will see that the charge voltage and current cannot ever equal the instantaneous power use of the phone. It isnt possible to keep things perfectly stable, that isnt how nature works despite what your specific battery percentage tells you. Maybe the 3% constant cycle is of no harm to the battery and you could consider this to be a stable battery condition- that would take some pretty specific research to discover. One thing you can be sure of, a 3% cycle is much better for your battery than a 20-100% cycle. Better than the 3% cycle would be varying the charge current and possibly the voltage (like quick charge 3.0 does).

I would recommend deep cycling the battery now and then, maybe once every couple weeks. Just to shock and freshen it up. This deep cycling recommendation is not based on any research I am aware of, maybe it is just from my past experience with batteries that had memory issues.

P.S. This app is what I have wanted for a long time because my phone is almost always connected to a charger and that is hard on the battery to store it above 80%.
[Android Apps and Games] real_milux:
So your point is that there will be some flux anyway, because the power consumption varies far too quickly and too fine-grained for the charging circuits to follow. Sounds quite reasonable to me.

However, if we want to keep flux minimal, then why not using just 2% or even 1 %?

New suggestion: Every time the percentage drops slightly (1 % or even more fine-grained when using mV figures) below threshold, a timer counts back for some time - let's say 5 minutes - and then issues charging until the battery is back to the precise threshold.

Should be perfectly stable then quite similar to "store_mode", correct?
[Android Apps and Games] Mr.Ultimate:
Ok, this is going to be interesting, Im gonna try use this in my S7edge with Note7 ported ROM and will also try this on my note7's I have... will report later with note 7's :D
[Android Apps and Games] blueberry.sky:
Don't have a Xiaomi Redmi 3s but on the Moto E2 (xt1526) the same functionality (active device runs on AC, battery charging disabled) appears to be provided just from CHARGING_ENABLED. Physical usb current/voltage monitor shows 0.00 Amps with screen off, ~100mA idle screen on low, ~200mA idle screen max, 300-400mA playing a video.