Revert "Revert "Change battery tip text""

This reverts commit 39beb2533f.

Reason for revert: <start to implement>

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: I83cc187d5bfda5312410e91ee636373f305ef449
This commit is contained in:
Raff Tsai
2019-03-08 14:42:03 +00:00
parent 70963e3808
commit deda67b7bf
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.getBatteryTipStringFormatted(
context, PowerUtil.convertUsToMs(drainTimeUs));
} else {
info.remainingLabel = null;
info.suggestionLabel = null;
info.chargeLabel = info.batteryPercentString;
}
}