Change battery tip text

Fixes: 121042353
Test: adb shell settings put global battery_tip_constants test_low_battery_tip=true
      Then go to Settings -> battery to see the text
Change-Id: Ie3c4a89ccb7c2724840dc886a502ef919e13a856
This commit is contained in:
Raff Tsai
2019-03-06 10:27:42 +08:00
parent 131eeac4aa
commit 2441b94c6d
3 changed files with 23 additions and 1 deletions

View File

@@ -47,6 +47,7 @@ public class BatteryInfo {
public long averageTimeToDischarge = Estimate.AVERAGE_TIME_TO_DISCHARGE_UNKNOWN;
public String batteryPercentString;
public String statusLabel;
public String suggestionLabel;
private boolean mCharging;
private BatteryStats mStats;
private static final String LOG_TAG = "BatteryInfo";
@@ -247,6 +248,7 @@ public class BatteryInfo {
final int status = batteryBroadcast.getIntExtra(BatteryManager.EXTRA_STATUS,
BatteryManager.BATTERY_STATUS_UNKNOWN);
info.discharging = false;
info.suggestionLabel = null;
if (chargeTime > 0 && status != BatteryManager.BATTERY_STATUS_FULL) {
info.remainingTimeUs = chargeTime;
CharSequence timeString = StringUtil.formatElapsedTime(context,
@@ -282,8 +284,11 @@ public class BatteryInfo {
info.batteryPercentString,
estimate.isBasedOnUsage && !shortString
);
info.suggestionLabel = PowerUtil.getBatterySuggestionStringFormatted(
context, PowerUtil.convertUsToMs(drainTimeUs));
} else {
info.remainingLabel = null;
info.suggestionLabel = null;
info.chargeLabel = info.batteryPercentString;
}
}