Android: API to control battery protection mode?

AI Thread Summary
Lenovo tablets feature a "battery protection mode" that optimizes battery life by charging and discharging between 40% and 60%, ideal for devices left on charge continuously. Currently, there is no public API to enable or disable this mode, as Android battery-related APIs are primarily read-only. Rooted devices may access this functionality through specific Magisk modules, while some OEMs might have hidden APIs, though these vary by brand and are not easily accessible. Different manufacturers implement various charging controls; for instance, newer Samsung devices can stop charging at 85% and resume at 83%. A potential product idea discussed is an external USB-C charger that could adjust charging profiles based on the device's state. Additionally, using a WiFi-controlled smart mains socket is suggested as an alternative method for managing charging through an app.
Swamp Thing
Insights Author
Messages
1,030
Reaction score
769
My new Lenovo tablet has a "battery protection mode". This is useful for example when you want to leave it on charge almost permanently, in which case the protection mode will charge and discharge between 40% and 60% in order to maximize battery life.

Is there an API that can enable/disable this mode?

Screenshot_2022-06-25-07-59-26-516.jpeg
 
Technology news on Phys.org
As far as I know, there is no public API for this. All Android APIs related to battery are read-only.

If your phone is rooted, then there are some Magisk modules that can do this. In addition, OEMs may have some hidden APIs that can do this, but that will be specific to each brand and not easily discoverable.

Different brands have different implementations of charge controller. Your device charges and discharges between 40 and 60%. Newer Samsung devices with OneUI can stop the charging at 85%, and restart it at around 83%. (My HP laptop stops charging at 80% and trickle charges thereafter.)
 
  • Like
Likes Swamp Thing and berkeman
Swamp Thing said:
My new Lenovo tablet has a "battery protection mode". This is useful for example when you want to leave it on charge almost permanently, in which case the protection mode will charge and discharge between 40% and 60% in order to maximize battery life.

Is there an API that can enable/disable this mode?

View attachment 303294
Sounds like a new product opportunity to me. Design an external USB-C charging device that can query the charge state of the target device and adjust the charging profile delivered by that charging device. Might be a hit product -- I'd probably buy one or five... :smile:
 
  • Like
Likes anorlunda and Wrichik Basu
berkeman said:
Sounds like a new product opportunity to me. Design an external USB-C charging device that can query the charge state of the target device and adjust the charging profile delivered by that charging device. Might be a hit product -- I'd probably buy one or five... :smile:
While searching on this topic, I found a suggestion that one can use if one is OK with an extra external device. You can use a WiFi controlled smart mains socket that can be commanded ON / OFF by an app running on your phone. Charge through that socket, and let the app do all the logic.
 
  • Informative
Likes Tom.G and berkeman
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
hi; i purchased 3 of these, AZDelivery 3 x AZ-MEGA2560-Board Bundle with Prototype Shield and each is reporting the error message below. I have triple checked every aspect of the set up and all seems in order, cable devices port, board reburn bootloader et al . I have substituted an arduino uno and it works fine; could you help please Thanks Martyn 'avrdude: ser_open(): can't set com-state for "\\.\COM3"avrdude: ser_drain(): read error: The handle is invalid.avrdude: ser_send(): write...
Back
Top