Loading res/drawable/ic_settings_aod.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <?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 src/com/android/settings/fuelgauge/BatteryEntry.java +4 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,10 @@ public class BatteryEntry { 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); Loading tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.UserManager; 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; Loading @@ -38,6 +39,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.Locale; Loading Loading @@ -136,6 +138,17 @@ public class BatteryEntryTest { assertThat(entry.getLabel()).isEqualTo(HIGH_DRAIN_PACKAGE); } @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(); Loading Loading
res/drawable/ic_settings_aod.xml 0 → 100644 +34 −0 Original line number Diff line number Diff line <?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
src/com/android/settings/fuelgauge/BatteryEntry.java +4 −0 Original line number Diff line number Diff line Loading @@ -209,6 +209,10 @@ public class BatteryEntry { 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); Loading
tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java +13 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.os.UserManager; 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; Loading @@ -38,6 +39,7 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import java.util.Locale; Loading Loading @@ -136,6 +138,17 @@ public class BatteryEntryTest { assertThat(entry.getLabel()).isEqualTo(HIGH_DRAIN_PACKAGE); } @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(); Loading