Update related UI if battery is not present

This change is to update the related UI in the battery page if the
battery is not present. This includes the following updates:
1. Update the summary of battery tile in the Settings homepage
2. Replace the battery level with "Unknown"
3. Replace the summary with help message in the battery page
4. Remove the battery meter icon

Bug: 171368508
Test: verify on an issue device
Change-Id: I892e0d137143160a0bce0c11ce9265120ebb8fd4
This commit is contained in:
Mill Chen
2020-10-21 16:32:56 +08:00
parent d682b2cc57
commit ad99e2ef38
15 changed files with 182 additions and 15 deletions

View File

@@ -90,6 +90,19 @@ public class BatteryBroadcastReceiverTest {
verify(mBatteryListener).onBatteryChanged(BatteryUpdateType.BATTERY_LEVEL);
}
@Test
@Config(shadows = {
BatteryFixSliceTest.ShadowBatteryStatsHelperLoader.class,
BatteryFixSliceTest.ShadowBatteryTipLoader.class
})
public void onReceive_batteryNotPresent_shouldShowHelpMessage() {
mChargingIntent.putExtra(BatteryManager.EXTRA_PRESENT, false);
mBatteryBroadcastReceiver.onReceive(mContext, mChargingIntent);
verify(mBatteryListener).onBatteryChanged(BatteryUpdateType.BATTERY_NOT_PRESENT);
}
@Test
@Config(shadows = {
BatteryFixSliceTest.ShadowBatteryStatsHelperLoader.class,