Android: API to control battery protection mode?

Click For Summary
SUMMARY

The discussion centers around the lack of a public API in Android for controlling battery protection mode, specifically on devices like Lenovo tablets. Battery protection mode is designed to optimize battery life by charging and discharging between 40% and 60%. While rooted devices can utilize Magisk modules for this functionality, OEM-specific hidden APIs may exist but are not easily accessible. Additionally, the conversation suggests the potential for a new product that could intelligently manage charging profiles via an external USB-C device.

PREREQUISITES
  • Understanding of Android API limitations
  • Familiarity with battery management systems in mobile devices
  • Knowledge of rooting Android devices and using Magisk
  • Experience with USB-C charging technology
NEXT STEPS
  • Research Magisk modules for battery management on rooted Android devices
  • Explore OEM-specific APIs for battery protection features
  • Investigate the design and functionality of smart mains sockets for charging control
  • Develop a prototype for an external USB-C charging device that adjusts charging profiles
USEFUL FOR

Android developers, hardware engineers, product designers, and anyone interested in optimizing battery life and charging technology.

Swamp Thing
Insights Author
Messages
1,047
Reaction score
784
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   Reactions: 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   Reactions: 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   Reactions: Tom.G and berkeman

Similar threads

Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 15 ·
Replies
15
Views
2K
  • · Replies 9 ·
Replies
9
Views
6K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 56 ·
2
Replies
56
Views
54K
Replies
3
Views
2K
  • · Replies 10 ·
Replies
10
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K