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

@@ -46,6 +46,7 @@ public class ShadowUtils {
private static boolean sIsSystemAlertWindowEnabled;
private static boolean sIsVoiceCapable;
private static ArraySet<String> sResultLinks = new ArraySet<>();
private static boolean sIsBatteryPresent;
@Implementation
protected static int enforceSameOwner(Context context, int userId) {
@@ -67,6 +68,7 @@ public class ShadowUtils {
sIsDemoUser = false;
sIsVoiceCapable = false;
sResultLinks = new ArraySet<>();
sIsBatteryPresent = true;
}
public static void setIsDemoUser(boolean isDemoUser) {
@@ -155,4 +157,13 @@ public class ShadowUtils {
public static void setHandledDomains(ArraySet<String> links) {
sResultLinks = links;
}
@Implementation
protected static boolean isBatteryPresent(Context context) {
return sIsBatteryPresent;
}
public static void setIsBatteryPresent(boolean isBatteryPresent) {
sIsBatteryPresent = isBatteryPresent;
}
}