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,028
Reaction score
763
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...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top