Dark Theme doesnt forget car changes
SetNightMode was persisting car changes through overrides reset
This was fixed
Test: manually follow steps in the bug
Fixes: 151235572
Change-Id: I6fb4bb54e7f2b4c3d5a401be3060c69e0dd1acb8
diff --git a/tests/app/src/android/app/cts/UiModeManagerTest.java b/tests/app/src/android/app/cts/UiModeManagerTest.java
index 77175c3..25ec9a3 100644
--- a/tests/app/src/android/app/cts/UiModeManagerTest.java
+++ b/tests/app/src/android/app/cts/UiModeManagerTest.java
@@ -26,8 +26,6 @@
import android.test.AndroidTestCase;
import android.util.Log;
-import androidx.test.filters.Suppress;
-
import com.android.compatibility.common.util.BatteryUtils;
import com.android.compatibility.common.util.SettingsUtils;
@@ -50,6 +48,9 @@
super.setUp();
mUiModeManager = (UiModeManager) getContext().getSystemService(Context.UI_MODE_SERVICE);
assertNotNull(mUiModeManager);
+ // reset nightMode
+ setNightMode(UiModeManager.MODE_NIGHT_YES);
+ setNightMode(UiModeManager.MODE_NIGHT_NO);
}
public void testUiMode() throws Exception {
@@ -83,7 +84,6 @@
}
}
- @Suppress //("b/146764875")
public void testNightModeYesPersisted() throws InterruptedException {
// Reset the mode to no if it is set to another value
setNightMode(UiModeManager.MODE_NIGHT_NO);
@@ -92,7 +92,6 @@
assertStoredNightModeSetting(UiModeManager.MODE_NIGHT_YES);
}
- @Suppress //("b/146764875")
public void testNightModeAutoPersisted() throws InterruptedException {
// Reset the mode to no if it is set to another value
setNightMode(UiModeManager.MODE_NIGHT_NO);
@@ -101,6 +100,16 @@
assertStoredNightModeSetting(UiModeManager.MODE_NIGHT_AUTO);
}
+ public void testNightModeAutoNotPersistedCarMode() {
+ // Reset the mode to no if it is set to another value
+ setNightMode(UiModeManager.MODE_NIGHT_NO);
+ mUiModeManager.enableCarMode(0);
+
+ setNightMode(UiModeManager.MODE_NIGHT_AUTO);
+ assertStoredNightModeSetting(UiModeManager.MODE_NIGHT_NO);
+ mUiModeManager.disableCarMode(0);
+ }
+
public void testNightModeInCarModeIsTransient() {
if (mUiModeManager.isNightModeLocked()) {
return;