Loading packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +4 −5 Original line number Diff line number Diff line Loading @@ -723,15 +723,13 @@ public class KeyguardIndicationController { } protected String computePowerIndication() { if (mPowerCharged) { return mContext.getResources().getString(R.string.keyguard_charged); } int chargingId; String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); if (mBatteryOverheated) { chargingId = R.string.keyguard_plugged_in_charging_limited; String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); return mContext.getResources().getString(chargingId, percentage); } else if (mPowerCharged) { return mContext.getResources().getString(R.string.keyguard_charged); } final boolean hasChargingTime = mChargingTimeRemaining > 0; Loading Loading @@ -759,6 +757,7 @@ public class KeyguardIndicationController { : R.string.keyguard_plugged_in_wireless; } String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); if (hasChargingTime) { String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes( mContext, mChargingTimeRemaining); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +19 −1 Original line number Diff line number Diff line Loading @@ -639,7 +639,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test public void onRefreshBatteryInfo_fullChargedWithOverheat_presentCharged() { public void onRefreshBatteryInfo_fullChargedWithOverheat_presentChargingLimited() { createController(); BatteryStatus status = new BatteryStatus(BatteryManager.BATTERY_STATUS_CHARGING, 100 /* level */, BatteryManager.BATTERY_PLUGGED_AC, Loading @@ -649,6 +649,24 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mController.getKeyguardCallback().onRefreshBatteryInfo(status); mController.setVisible(true); verifyIndicationMessage( INDICATION_TYPE_BATTERY, mContext.getString( R.string.keyguard_plugged_in_charging_limited, NumberFormat.getPercentInstance().format(100 / 100f))); } @Test public void onRefreshBatteryInfo_fullChargedWithoutOverheat_presentCharged() { createController(); BatteryStatus status = new BatteryStatus(BatteryManager.BATTERY_STATUS_CHARGING, 100 /* level */, BatteryManager.BATTERY_PLUGGED_AC, BatteryManager.BATTERY_HEALTH_GOOD, 0 /* maxChargingWattage */, true /* present */); mController.getKeyguardCallback().onRefreshBatteryInfo(status); mController.setVisible(true); verifyIndicationMessage( INDICATION_TYPE_BATTERY, mContext.getString(R.string.keyguard_charged)); Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +4 −5 Original line number Diff line number Diff line Loading @@ -723,15 +723,13 @@ public class KeyguardIndicationController { } protected String computePowerIndication() { if (mPowerCharged) { return mContext.getResources().getString(R.string.keyguard_charged); } int chargingId; String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); if (mBatteryOverheated) { chargingId = R.string.keyguard_plugged_in_charging_limited; String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); return mContext.getResources().getString(chargingId, percentage); } else if (mPowerCharged) { return mContext.getResources().getString(R.string.keyguard_charged); } final boolean hasChargingTime = mChargingTimeRemaining > 0; Loading Loading @@ -759,6 +757,7 @@ public class KeyguardIndicationController { : R.string.keyguard_plugged_in_wireless; } String percentage = NumberFormat.getPercentInstance().format(mBatteryLevel / 100f); if (hasChargingTime) { String chargingTimeFormatted = Formatter.formatShortElapsedTimeRoundingUpToMinutes( mContext, mChargingTimeRemaining); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +19 −1 Original line number Diff line number Diff line Loading @@ -639,7 +639,7 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { } @Test public void onRefreshBatteryInfo_fullChargedWithOverheat_presentCharged() { public void onRefreshBatteryInfo_fullChargedWithOverheat_presentChargingLimited() { createController(); BatteryStatus status = new BatteryStatus(BatteryManager.BATTERY_STATUS_CHARGING, 100 /* level */, BatteryManager.BATTERY_PLUGGED_AC, Loading @@ -649,6 +649,24 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { mController.getKeyguardCallback().onRefreshBatteryInfo(status); mController.setVisible(true); verifyIndicationMessage( INDICATION_TYPE_BATTERY, mContext.getString( R.string.keyguard_plugged_in_charging_limited, NumberFormat.getPercentInstance().format(100 / 100f))); } @Test public void onRefreshBatteryInfo_fullChargedWithoutOverheat_presentCharged() { createController(); BatteryStatus status = new BatteryStatus(BatteryManager.BATTERY_STATUS_CHARGING, 100 /* level */, BatteryManager.BATTERY_PLUGGED_AC, BatteryManager.BATTERY_HEALTH_GOOD, 0 /* maxChargingWattage */, true /* present */); mController.getKeyguardCallback().onRefreshBatteryInfo(status); mController.setVisible(true); verifyIndicationMessage( INDICATION_TYPE_BATTERY, mContext.getString(R.string.keyguard_charged)); Loading