yashsingh1/xdaforums huggingface dataset:
[Android Apps and Games] deobs:
Thanks for such app

Hi,

The v0.8.2 is working flawlessly using Batt_slate_mode on my galaxy mega I9205 running unofficial Lineage 7.1.1

I wish your app all due success and the best to the devs and also to testers. Any chance to see it on F-droid ?

[MENTION=2893530]hgmichna[/MENTION]: on my phone, once the 80% limit is reached, the lightning symbol goes off.

Aside off that I am taking the opportunity to ask a questions about how our phones behaves with the power supply plugged on when at the charging limit. Are the phones using power from the AC or from the battery ?

If from the later, could it be possible for the app to get the phone to draw the needed power from the cord instead of the battery ?

Cheers.
[Android Apps and Games] blueberry.sky:
Oh I meant using a terminal emulator app within android.

---------- Post added at 02:40 AM ---------- Previous post was at 02:30 AM ----------

This seems to depend on the device. With most devices it doesn't seem like you can choose. It's just whatever your device does. If you have multiple working control files on your particular device then you could test them out & see if you have the option.
[Android Apps and Games] cmglng:
This is the same reason why I reverted to the 0.5 version
[Android Apps and Games] Galaxea:
I managed to change the permission, but I still cannot edit the file. The editor just hangs when I try to save the file.....

I tried on CM 12.1 ROM and now on LOS 14.1 on S3 Mini. Both failed.
[Android Apps and Games] blueberry.sky:
Unfortunately it sounds like it may just not be controllable on your hardware.
[Android Apps and Games] sriharshaarangi:
Version 0.9.1

v0.9.1 Changelog:

Fixed widget not showing on some devices

v0.9 Changelog :

Added Widget to toggle service

Added scrollable view

Download link:https://www.androidfilehost.com/?fid=745425885120729783

Update: Can be installed on v0.8+ WITHOUT uninstalling.
[Android Apps and Games] threshfire:
Just installed over 0.8.2 and seems like no problems. Nexus 6P, 7.1.2. Thanks for the update!
[Android Apps and Games] sriharshaarangi:
Thanks for the feedback! I will update the OP
[Android Apps and Games] FPSUsername:
The widget is not in my list. Is there a permanent way for this app? That it can survive a reboot?
[Android Apps and Games] Midomad:
I would love a circular new app icon for future update!

And remove the settings entry since it does nothing [emoji4]
[Android Apps and Games] hgmichna:
Version 0.9

It is in mine.

After updating I force-stopped the running app and restarted it, but in theory this should not be necessary. Or should it?

On my phone it works automatically after a reboot. Earlier versions had already done this too.
[Android Apps and Games] sriharshaarangi:
Found the reason why the widget was not showing on some devices.
[Android Apps and Games] sriharshaarangi:
Can you confirm if the widget is showing with this one: https://www.androidfilehost.com/?fid=745425885120729783
[Android Apps and Games] FPSUsername:
It works
[Android Apps and Games] Vorlon8472:
For me the app just not responding after startup. Same was for version 0.5 and the newest now. I'm using the newest miui eu developer multi rom and I have redmi note 3 pro kenzo. Came out this Friday.
[Android Apps and Games] rogxd:
Deleted
[Android Apps and Games] ADM.GL:
Dude, would you like to try or have you already tried another rom, at least for a while. I also do have a kenzo, and works properly in various other ROMs.

Enviado de meu Redmi Note 3 usando Tapatalk
[Android Apps and Games] Vorlon8472:
It worked with last weeks eu dev rom
[Android Apps and Games] JoshReuben:
Works beautifully on my Kenzowith Resurrection Remix, on my rooted stock t710, and on my Samsung s5 running stock Lineage 7.1.2. Crashes on launch on my k00c (Asus t701) running a lineage 7.1.2 port.
[Android Apps and Games] macauf:
I am running on HTC butterfly s, Android 4.4.2 and it is not working.

Only Charging_enabled (generic) can be selected.

Any help please?
[Android Apps and Games] 8zabi:
any thoughts on my problem?
[Android Apps and Games] DocteurN:
Thanks for this great and usefullapp that works well on my Nexus 6P.

Is there a way to make it work on a NEXUS 10? under 7.1.2 2017-04-23 build (Purenexus)

Thanks in advance
[Android Apps and Games] rogxd:
It does not work on my stock Galaxy S5 6.0.1.

When the limit is reached it disconnects, then connects immediately and continues to charge.

Inviato dal mio SM-G900F utilizzando Tapatalk
[Android Apps and Games] blueberry.sky:
Gohamstergo reported that the nexus 6 is a little stubborn but toggling the control file a 2nd time worked. It looks like this hasn't made it's way into the app yet. If you don't want to wait you could use an automate script, I have one I could modify for you to try but you're better off asking for Gohamstergo's script since it's already tested / known to work for nexus 6.
[Android Apps and Games] 8zabi:
thank you, I saw that workaround, but a would like to see a bugfix, or the cause of this different behavior

if the nexus 6's kernel code has a bug maybe we can fix it
[Android Apps and Games] iperov:
autostart still not work on MIUI , but app exist in task manager

after phone reboot need to manual enter to app through task manager to begin charge limiting
[Android Apps and Games] pax2011:
Doesn't work on Samsung S8. Store mode doesn't work, batlle_slate_mode works but when is charged to the limit, the phone start to charge and stop charge in loop.
[Android Apps and Games] Nitrooo84:
Unfortunately, the same thing happens on my Nexus 4 with Cyanogenmod 13.
[Android Apps and Games] sriharshaarangi:
1. Disconnects 2. then connects immediately and continues to charge.

This seems to be common problem for some users. I think [MENTION=6929614]real_milux[/MENTION] was trying to fix it. We will check.
[Android Apps and Games] rogxd:
Update:

with control file "store_mode" it works!

(Previously I tried "battery_state_mode" that didn't work)
[Android Apps and Games] real_milux:
That's a pity and really annoying, Harsha is right, I already tried to fix this.

Maybe I have to try harder...

Can anyone experiencing this problem can give me some information about how the charging state shown in the app is changing in this loop, and how long one cycle takes. That might help a lot to understand this behavior.
[Android Apps and Games] pax2011:
Of course, can you explain me more clearly what you need?
[Android Apps and Games] real_milux:
Sure. First, for better understanding, let me explain how this problem is caused:

Some (not all) of the control files switch off the whole power supply. Although the cable is still plugged in, the OS will think that it's not there anymore, firing a broadcast with the action string "android.intent.action.ACTION_POWER_DISCONNECTED".

Typically, this app would react immediately to this by shutting down the battery monitoring service, BUT when it does so, it will restore the original state of the control file, which in turn re-enables the charging. This is causing an "android.intent.action.ACTION_POWER_CONNECTED" broadcast, which in turn will start our foreground service again. The service will detect that the limit was reached, and disable the charging... and here the whole loop starts over again.

To prevent this behavior for the "problem candidates" among the control files (charging_enabled, batt_slate_mode, etc.), I built in a "tolerance time", which is currently 3000 ms. Whenever a "android.intent.action.ACTION_POWER_[DIS]CONNECTED" broadcast is received within this tolerance time after changing the control file, it will be regarded as "fake" and ignored, to prevent the loop that I described above.

However, it seems that your device needs some more time for the states to settle, therefore, I need as much information as possible about how long one iteration of the "loop" I just described takes, and how the state that is shown by this app (CHARGING, DISCHARGING, etc.) changes during this cycle.

In the ideal case, you would provide me the logs of this app, as they are provided to logcat. You could use aLogcat (https://play.google.com/store/apps/details?id=rs.pedjaapps.alogcatroot.app). Select the "Time" format in the preferences of aLogcat, so I can see how long the cycles are, and filter for "(Charging|Power) State" with "Apply as regular expression" ticked.
[Android Apps and Games] logosA:
I am sorry, it doesn't.
[Android Apps and Games] logosA:
It has to be something wrong with samsung note.

Same thing in my Note 4 running rooted, stock MM 6.01

Uninstall app rebooted, reinstall. No luck.

Maybe next built...
[Android Apps and Games] fapste:
How should I delete/reset the battery graph in phone settings when the phone gets charged upto 80%. Currently android OS only clears the battery stats when the device is charged above 90%
[Android Apps and Games] kimpot04:
I can't see the charging_enabled file on my Samsung Galaxy Grand Prime running RR rom 6.0.1

Btw.. Thanks for the app
[Android Apps and Games] Snoe II:
App working fine on Sony Xperia Z3 Compact running stock 5.1.1. Thanks for the awesome app ?

Only one thing I noticed, setting do nothing when clicked. And can you add notification sound when battery charged to the the limit?
[Android Apps and Games] sriharshaarangi:
Thanks for the feedback!
[Android Apps and Games] sriharshaarangi:
To charge to 100%, you can just disable it right?
[Android Apps and Games] sriharshaarangi:
Delete /data/system/batterystats.bin to clear stats
[Android Apps and Games] sriharshaarangi:
Appreciate your feedback, but this is the problem with OEMs. They modify the system files. I cannot find a charging_enabled equivalent file in that directory. Sorry! I don't have a Samsung, so I cannot do anything. If you can find a file which on changing to 0 disables charging, I can add it to the app. If you can find it, it will be helpful for all Samsung owners.
[Android Apps and Games] sriharshaarangi:
Thanks for the feedback! Please refer to above post for more information.
[Android Apps and Games] chazall1:
Has anyone used this app on a pixel or pixel xl
[Android Apps and Games] sriharshaarangi:
Thanks for the feedback! Yeah, as of now, settings doesn't provide any functionality. I will add that notification sound to my todo list.
[Android Apps and Games] sriharshaarangi:
Just check the mentioned file. If it is present, it will most probably work.
[Android Apps and Games] Diieguez:
Thanks for this App!! It works fine on my Mi5 :D But i would like setting the limit above 95%, like 98%, for example. But great job!
[Android Apps and Games] sriharshaarangi:
Thanks for the feedback!

Since, there are multiple requests, I will set the maximum to 99% in next release
[Android Apps and Games] almightysiman:
I try.seem not working.
[Android Apps and Games] sriharshaarangi:
Can you check if the following file exists? /sys/class/power_supply/battery/battery_enabled
[Android Apps and Games] JumboMan:
in terminal type

su

dumpsys batterystats --reset
[Android Apps and Games] Diieguez:
I think I can give my personal opinion to improve the app, If only I could choose if i want or not re-charging my phone, I mean, I want when my battery reaches 98% the app stops working and not charging my phone again until 98%. I whish you take it into account :)

Enviado desde mi MI 5 mediante Tapatalk
[Android Apps and Games] tassos_chry:
Hello,

Since updating to May security release, the app no longer resets my battery stats, neither automatically nor manually. Tested 2 different ROM, Pure Nexus and SAOSP.

My setup: Nexus 5X, latest SAOSP(tested with Pure Nexus too), Franco kernel, Magisk
[Android Apps and Games] post-mortem:
I previously reported that the app didn't work on SGS3, but I have an update. Sometimes it does works, and sometimes it doesn't.

Here's a scenario:

Battery is low.

I plug the phone into a charger.

The notification appears, and the battery is charging.

I unplug the charger.

At this point, one of 2 things happens: The notification goes away, or it remains. If the notification remains, then the app will work; if the notification goes away, then the app won't work. What I mean is that if I allow the phone to remain in the charger, the app does or doesn't limit max charge. In other words, your app only actually works if the notification remains at all times. When the notification only appears while the device is plugged in, then the app doesn't actually do anything.

To add more confusion, when the app is working fine but I leave the phone in the charger, the notification eventually goes away, allowing the phone to charge to 100%. For example, if I leave the phone to charge overnight, it always charges to 100%. If it's charging during the day (and I catch it in time), charging will be limited by the app as intended.

I do not have a task killer installed. Same behavior on 7.1.1 & 7.1.2.
[Android Apps and Games] sriharshaarangi:
It might be due to the problem mentioned in above posts: "Disconnects, then connects immediately and continues to charge". We don't have a fix for it yet
[Android Apps and Games] caiorrs:
My nexus 5 cant open it. I'm using pure nexus 2017 04 24, Franco kernel 107 and magisk 12.0 for root. I install it, then grant root access, after that it force close.
[Android Apps and Games] post-mortem:
No, because some times it does work properly. I don't know the time frame, but it's not on the order of seconds as mentioned by others.

For example, while at work if I plug my phone in the charger, I might glance from a distance and see the charging light is off. I pick up my phone and it's at 90% (my set limit) and plugged in. When I unplug my phone, the notification remains. If I leave the phone plugged in for hours, the app will unload and the phone will continue to charge.

What is the expected behavior regarding the notification? Is it supposed to remain at all times? For me, the app only works if the app remains all the time.
[Android Apps and Games] hgmichna:
Do not quote irrelevant text.

The phones of people who quote the entire first post usually get attacked by evil ghosts, and then all bets are off.
[Android Apps and Games] real_milux:
The notification is connected to the foreground service, which is - you're absolutely right about that - the instance that controls the charging limit.

When this service is shut down, it will issue a reset of the charge control file, and your device will power up until 100%.

However, the permanent notification makes the service a "high priority service". This services are usually not killed by the OS unless RAM is very, very scarce.

So, I can only give you that advice: Whatever causes your system to kill the foreground service, stop it.

I don't see anything we can do for you, unless you provide logcat excerpts that show some problem that we might have missed. At the moment, your problem seems to indicate that your OS is killing the service, which must not happen.

---------- Post added at 08:34 PM ---------- Previous post was at 08:30 PM ----------

No error message, nothing? :confused:
[Android Apps and Games] caiorrs:
This happens
[Android Apps and Games] real_milux:
Ahm... translation? :o

Edit: I think I got it, but I have no clue why and how this happens, sorry. :(

Anybody here with the same issue?
[Android Apps and Games] caiorrs:
I thought it was of no need to translate, Sorry, here you go
[Android Apps and Games] real_milux:
Thank you, but still no idea, sorry. :(

Do you have any logs, maybe even a stack trace? That might help a lot to understand why it's crashing for you.
[Android Apps and Games] caiorrs:
If I didn't do it right, I can PM you when I get home, in about 1h30
[Android Apps and Games] iperov:
I fixed autostart app on my xiaomi phone by changing ROM from "xiaomi.eu" to "MultiROM".
[Android Apps and Games] real_milux:
Hi, I have good news and bad news for you.

The good news: In a few minutes I publish version 0.9.2, and I'm pretty confident that I could fix the issue with the help of your log output. (Well actually, Harsha did already fix it half-way recently, maybe without even noticing. ^^)

The bad news: This bug could only occur if some dependency was not fulfilled, either because of missing root, or because of missing control file options. That means that instead of a crashing app, the next thing you will most likely see is an error message. :(

But hey, cheer up, at least you will soon know the actual problem of your device...

---------- Post added at 10:44 PM ---------- Previous post was at 10:36 PM ----------

Just published v0.9.2, which fixes activity crashes that could occur on unrooted or unsupported devices:

https://www.androidfilehost.com/?fid=457095661767160082
[Android Apps and Games] caiorrs:
Not supported :( thanks man
[Android Apps and Games] real_milux:
Would have been my first guess...

Have you checked the contents of /sys/classes/power_supply and /sys/classes/power_supply/battery?

Maybe it is supported, but we don't know the control file yet.

Additional information: An experimental control file for Nexus 4 that was added some time ago is located at /sys/module/pm8921_charger/parameters/disabled. Maybe you can find something similar with slightly different folder names?
[Android Apps and Games] caiorrs:
Here you go
[Android Apps and Games] sriharshaarangi:
Expected behaviour:

As long as it is plugged in, the notification SHOULD remain. After the device is unplugged, and the percentage reaches limit - threshold(eg: 78 when limit = 80 and threshold = 2), then the notification closes.
[Android Apps and Games] sriharshaarangi:
I thought that I fixed it completely, glad you fixed it :good:
[Android Apps and Games] chenrp:
bottom line,

everyone here is using the 80% limit...

anything more?
[Android Apps and Games] Benny Bosser:
Nah, I use tasker to switch charging levels depending on time: during the day when I'm near to a charger I limit the charge between 72 and 77 depending on location. In that way I only have short charges which limits battery damage

At night I limit it to 89, for me this is a nice balance between enough battery for the day and some damage control

But bottom line is, if you don't want any battery damage due to charging, it's best not to charge over 80%,but that's not always possible for everyone unfortunately
[Android Apps and Games] chenrp:
good idea to add "time" feature to the app...

or even better.. to the KERNEL!
[Android Apps and Games] hgmichna:
60%

I have set the app to 60%, because that does not harm the battery at all and because it is almost always enough for my purposes.

The slider is set to recharge below 59%.

In the rare cases when I need more charge I disable the app or set it to 80%.
[Android Apps and Games] tassos_chry:
I found out that MagiskSU seems to be the problem, with SuperSU the battery stats reset works properly.
[Android Apps and Games] gerlium:
I've got a Oneplus One with Android 6 and the charge comes and goes. I tried with a recharge limit of 41%. This is the logcat:

05-11 19:24:03.138 D/Charging State(18570): CHARGE_FULL 176545517

05-11 19:25:42.946 D/Charging State(18570): CHARGE_STOP 176545517

05-11 19:26:23.358 D/Power State(18570): ACTION_POWER_DISCONNECTED

05-11 19:27:03.376 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 1

05-11 19:27:03.399 D/Power State(18570): ACTION_POWER_CONNECTED

05-11 19:27:04.019 D/Charging State(18570): CHARGE_STOP 13385052

05-11 19:27:35.231 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 0

05-11 19:27:43.347 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 1

05-11 19:27:43.373 D/Power State(18570): ACTION_POWER_DISCONNECTED

05-11 19:27:53.394 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 0

05-11 19:28:11.902 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 1

05-11 19:28:23.140 D/Power State(18570): ACTION_POWER_CONNECTED

05-11 19:28:23.775 D/Charging State(18570): CHARGE_STOP 93963104

05-11 19:28:33.394 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 0

05-11 19:29:03.275 D/Power State(18570): ACTION_POWER_DISCONNECTED

05-11 19:29:03.317 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 1

05-11 19:29:13.432 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 0

05-11 19:29:26.254 I/qdhwcomposer( 326): handle_blank_event: dpy:0 panel power state: 1
[Android Apps and Games] post-mortem:
In my case, I use 90%. So the phone charges to 90%, then the app disables charging. Over the next few hours, as the battery goes down to 87%, the phone should automatically start charging again, then stop at 90% again, right?
[Android Apps and Games] real_milux:
Judging from this logcat excerpt, I assume that the foreground service is somehow killed by the OS. Can you confirm this?

---------- Post added at 01:41 PM ---------- Previous post was at 01:40 PM ----------

Except for control files like battery_charging_enabled, where it will close immediately when device is unplugged. :p
[Android Apps and Games] dnle71:
Glad I found this app. Let me test this for a while. Thanks!
[Android Apps and Games] post-mortem:
Alright, so I left my phone in the charger all night and it was at 100% in the morning. I have a (rather large) logcat showing this nugget at 4:49am:

I went back 3-4 seconds and exported that file, which is here. (Let me know if you want a bigger piece of this log.)

A couple hours later, I plugged my phone in. It was at 90% and not charging, so I left it in the charger & started a log. Only 17 minutes later, lo and behold, it's charging and at 93%, so I've got a log which captured that. This 2nd log does not have the golden nugget, and I don't see why your app stopped working.
[Android Apps and Games] tvvarun:
version 0.3 works perfectly in my oneplus one
[Android Apps and Games] dnle71:
Works fine on my OPO with franco kernel. Can we get a support for Nexus 7 2013, please?
[Android Apps and Games] realista87:
i use 90% and nexus mode....that keeps the phone always at 90% without to block the charge and wait till the lower setted %.

imho 90% is about 4,3 or 4,25v that's enough to save the battery life. i've read that the "optimal" % is about 85 or 87% for a lithium, but limitig to 80% is just extreme to me------ too much battery life wasted, instead just limiting to 90% is STILL A GOOD CHOOSE for whose person who want to not lose too much stamina, still saving the battery chemistry stress.

ps: i still use the 0.5 version because i don't think it would be useful to update it if it's ALREADY working in the correct way.
[Android Apps and Games] NickKH:
Will there be any tasker integration to adjust the limit value?

Thank you dev, this is the app that I have waited for a long time. Previously I could only use tasker to set an alarm at 70% which I then disconnect the phone afterwards.
[Android Apps and Games] Kimbo82:
It's been there since version 0.8 of the app. :)
[Android Apps and Games] bibon27:
[MENTION=6898873]sriharshaarangi[/MENTION] i love your app. just would like to suggest it would be better to add an option to charge to 100% if the phone is plugged in during the night maybe, and daytime maybe limit it to 80%, so when we start the day it'll be on full battery, for now i have to manually off the app if i would like it to charge to 100%, maybe a toggle in the notification bar would do the trick too.
[Android Apps and Games] Squabl:
You can already do that with Tasker.
[Android Apps and Games] FPSUsername:
The best is to charge at 45 and unplug at 65, but nobody wants to use 20% of their battery. Just let it wear out and get a replacement. I limit it to 90% and start charging at 40 and sometimes 20. A time feature would be great, that I can set the limit on 60% over night (as that is the best percentage for storage) and before I wake up, set it to 90
[Android Apps and Games] swa100:
Same problem here, doesn't reset battery stats.

Edit: I've read that magisk can cause this. Is there any way to get it to work with magisk? Need to pass safetynet..

Edit 2: is it possible for the devs to make this app (specifically the wipe battery stats functionality) compatible with magiskSU?