Add name and icon for AOD
Keep it in both app list and full usage list for now,
so we don't need to update smearing code.
Bug: 77156569
Test: Screenshot | RunSettingsRoboTests
Change-Id: I5247da90ea591b226cafef8f2d1ffcbff387b62f
diff --git a/res/drawable/ic_settings_aod.xml b/res/drawable/ic_settings_aod.xml
new file mode 100644
index 0000000..8d91349
--- /dev/null
+++ b/res/drawable/ic_settings_aod.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2018 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+
+ <path
+ android:fillColor="#000000"
+ android:pathData="M17,1.01L7,1C5.9,1,5,1.9,5,3v18c0,1.1,0.9,2,2,2h10c1.1,0,2-0.9,2-2V3C19,1.9,18.1,1.01,17,1.01z M17,21H7l0-1h10V21z M17,18H7V6h10V18z M17,4H7V3h10V4z" />
+ <path
+ android:fillColor="#000000"
+ android:pathData="M 8 10 H 16 V 11.5 H 8 V 10 Z" />
+ <path
+ android:fillColor="#000000"
+ android:pathData="M 9 13 H 15 V 14.5 H 9 V 13 Z" />
+ <path
+ android:pathData="M 0 0 H 24 V 24 H 0 V 0 Z" />
+</vector>
\ No newline at end of file
diff --git a/src/com/android/settings/fuelgauge/BatteryEntry.java b/src/com/android/settings/fuelgauge/BatteryEntry.java
index 1733a6e..a93d522 100644
--- a/src/com/android/settings/fuelgauge/BatteryEntry.java
+++ b/src/com/android/settings/fuelgauge/BatteryEntry.java
@@ -209,6 +209,10 @@
name = context.getResources().getString(R.string.power_camera);
iconId = R.drawable.ic_settings_camera;
break;
+ case AMBIENT_DISPLAY:
+ name = context.getResources().getString(R.string.ambient_display_screen_title);
+ iconId = R.drawable.ic_settings_aod;
+ break;
}
if (iconId > 0) {
icon = context.getDrawable(iconId);
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java
index b6be9ee..b89a3f0 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java
@@ -29,6 +29,7 @@
import com.android.internal.os.BatterySipper;
import com.android.internal.os.BatterySipper.DrainType;
+import com.android.settings.R;
import org.junit.Before;
import org.junit.Rule;
@@ -38,6 +39,7 @@
import org.mockito.junit.MockitoJUnit;
import org.mockito.junit.MockitoRule;
import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
import java.util.Locale;
@@ -137,6 +139,17 @@
}
@Test
+ public void batteryEntryForAOD_containCorrectInfo() {
+ final BatterySipper batterySipper = mock(BatterySipper.class);
+ batterySipper.drainType = DrainType.AMBIENT_DISPLAY;
+ final BatteryEntry entry = new BatteryEntry(RuntimeEnvironment.application, mockHandler,
+ mockUserManager, batterySipper);
+
+ assertThat(entry.iconId).isEqualTo(R.drawable.ic_settings_aod);
+ assertThat(entry.name).isEqualTo("Ambient display");
+ }
+
+ @Test
public void extractPackageFromSipper_systemSipper_returnSystemPackage() {
BatteryEntry entry = createBatteryEntryForSystem();