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
Merged-In: I892e0d137143160a0bce0c11ce9265120ebb8fd4
This commit is contained in:
Mill Chen
2020-10-21 16:32:56 +08:00
parent a759432bac
commit 5a347494d2
15 changed files with 182 additions and 14 deletions

View File

@@ -24,6 +24,8 @@ import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
import com.android.settings.R;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -66,4 +68,12 @@ public class TopLevelBatteryPreferenceControllerTest {
info.chargeLabel = "5% - charging";
assertThat(getDashboardLabel(mContext, info)).isEqualTo("5% - charging");
}
@Test
public void getSummary_batteryNotPresent_shouldShowWarningMessage() {
mController.mIsBatteryPresent = false;
assertThat(mController.getSummary())
.isEqualTo(mContext.getString(R.string.battery_missing_message));
}
}