Android: API to control battery protection mode?

Click For Summary

Discussion Overview

The discussion revolves around the existence of an API to control the "battery protection mode" on Android devices, particularly in the context of a Lenovo tablet. Participants explore the implications of battery management features and potential solutions for controlling charging behavior.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes the battery protection mode on their Lenovo tablet, which charges and discharges between 40% and 60% to maximize battery life.
  • Another participant asserts that there is no public API for enabling or disabling this mode, noting that Android battery-related APIs are read-only.
  • It is mentioned that rooted devices may have access to Magisk modules that can control this feature, while OEM-specific hidden APIs may exist but are not easily discoverable.
  • Participants discuss the variability in charging implementations across different brands, with examples of how Samsung devices and an HP laptop manage charging thresholds.
  • Some participants propose the idea of creating an external USB-C charging device that could adjust charging profiles based on the target device's charge state.
  • Another suggestion involves using a WiFi-controlled smart mains socket to manage charging through an app, allowing for logic-based control of the charging process.

Areas of Agreement / Disagreement

Participants express differing views on the availability of APIs and solutions for controlling battery protection mode, with no consensus reached on a definitive method to achieve this control.

Contextual Notes

The discussion highlights limitations regarding the discoverability of OEM-specific APIs and the reliance on external devices for managing charging behavior.

Swamp Thing
Insights Author
Messages
1,047
Reaction score
786
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
7K
  • · 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