diff --git a/res/layout/dark_ui_activation_button.xml b/res/layout/dark_ui_activation_button.xml
deleted file mode 100644
index 5f9eefcded2..00000000000
--- a/res/layout/dark_ui_activation_button.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index ef75d031ccc..65d9c2e76ec 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -100,14 +100,6 @@
- 1800000
-
-
-
- - @string/dark_ui_auto_mode_never
-
- - @string/dark_ui_auto_mode_auto
-
-
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 7112a2af268..8521fefcac5 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -2919,40 +2919,6 @@
Night Light not currently on
-
-
- Turn on now
-
- Turn off now
-
- Turn on until sunrise
-
- Turn off until sunset
-
- Dark Mode
-
- Schedule
-
- None
-
- Turns on from sunset to sunrise
-
- Status
-
- Off / %1$s
-
- Will never turn on automatically
-
- Will turn on automatically at sunset
-
- On / %1$s
-
- Will never turn off automatically
-
- Will turn off automatically at sunrise
-
- Dark theme uses true black to help keep your battery alive longer. Dark theme schedules wait to turn on until your screen is off.
-
Screen timeout
@@ -7076,7 +7042,6 @@
-
diff --git a/res/xml/dark_mode_settings.xml b/res/xml/dark_mode_settings.xml
deleted file mode 100644
index 9247a0c3788..00000000000
--- a/res/xml/dark_mode_settings.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/res/xml/dark_ui_settings.xml b/res/xml/dark_ui_settings.xml
new file mode 100644
index 00000000000..1f11ebae94d
--- /dev/null
+++ b/res/xml/dark_ui_settings.xml
@@ -0,0 +1,24 @@
+
+
+
+
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index 9bc67108459..c45e6a2ae10 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -31,15 +31,6 @@
-
-
+
+
+
{
- updateSummary();
- };
- mDarkModeObserver.subscribe(mCallback);
- }
-
- @Override
- public void onAttached() {
- super.onAttached();
- mDarkModeObserver.subscribe(mCallback);
- }
-
- @Override
- public void onDetached() {
- super.onDetached();
- mDarkModeObserver.unsubscribe();
- }
-
- private void updateSummary() {
- final boolean active = (getContext().getResources().getConfiguration().uiMode
- & Configuration.UI_MODE_NIGHT_YES) != 0;
- final boolean auto = mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_AUTO;
-
- String detail;
- if (active) {
- detail = getContext().getString(auto
- ? R.string.dark_ui_summary_on_auto_mode_auto
- : R.string.dark_ui_summary_on_auto_mode_never);
- } else {
- detail = getContext().getString(auto
- ? R.string.dark_ui_summary_off_auto_mode_auto
- : R.string.dark_ui_summary_off_auto_mode_never);
- }
- String summary = getContext().getString(active
- ? R.string.dark_ui_summary_on
- : R.string.dark_ui_summary_off, detail);
-
- setSummary(summary);
- }
-}
diff --git a/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java b/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
deleted file mode 100644
index ab7ea92343f..00000000000
--- a/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorController.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.settings.display.darkmode;
-
-import android.app.UiModeManager;
-import android.content.Context;
-import android.content.res.Configuration;
-import androidx.preference.DropDownPreference;
-import androidx.preference.Preference;
-import androidx.preference.PreferenceScreen;
-import com.android.settings.R;
-import com.android.settings.core.BasePreferenceController;
-
-/**
- * Controller for the dark ui option dropdown
- */
-public class DarkModeScheduleSelectorController extends BasePreferenceController
- implements Preference.OnPreferenceChangeListener {
-
- private final UiModeManager mUiModeManager;
- private boolean mPreferenceSet = false;
- private DropDownPreference mPreference;
- private String mCurrentMode;
-
- public DarkModeScheduleSelectorController(Context context, String key) {
- super(context, key);
- mUiModeManager = context.getSystemService(UiModeManager.class);
- }
-
- @Override
- public void displayPreference(PreferenceScreen screen) {
- super.displayPreference(screen);
-
- mPreference = screen.findPreference(getPreferenceKey());
- }
-
- @Override
- public int getAvailabilityStatus() {
- return BasePreferenceController.AVAILABLE;
- }
-
- @Override
- public final void updateState(Preference preference) {
- mCurrentMode =
- mUiModeManager.getNightMode() == UiModeManager.MODE_NIGHT_AUTO
- ? mContext.getString(R.string.dark_ui_auto_mode_auto)
- : mContext.getString(R.string.dark_ui_auto_mode_never);
- mPreference.setValue(mCurrentMode);
- }
- @Override
- public final boolean onPreferenceChange(Preference preference, Object newValue) {
- String newMode = (String) newValue;
- if (newMode == mCurrentMode) {
- return false;
- }
- mCurrentMode = newMode;
- if (mCurrentMode == mContext.getString(R.string.dark_ui_auto_mode_never)) {
- boolean active = (mContext.getResources().getConfiguration().uiMode
- & Configuration.UI_MODE_NIGHT_YES) != 0;
- int mode = active ? UiModeManager.MODE_NIGHT_YES
- : UiModeManager.MODE_NIGHT_NO;
- mUiModeManager.setNightMode(mode);
-
- } else if (mCurrentMode ==
- mContext.getString(R.string.dark_ui_auto_mode_auto)) {
- mUiModeManager.setNightMode(UiModeManager.MODE_NIGHT_AUTO);
- }
- return true;
- }
-}
diff --git a/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java b/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
deleted file mode 100644
index 62933166e26..00000000000
--- a/src/com/android/settings/display/darkmode/DarkModeSettingsFragment.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.settings.display.darkmode;
-
-import android.content.Context;
-import android.os.Bundle;
-import android.app.settings.SettingsEnums;
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.SearchIndexable;
-
-/**
- * Settings screen for Dark UI Mode
- */
-@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
-public class DarkModeSettingsFragment extends DashboardFragment {
-
- private static final String TAG = "DarkModeSettingsFragment";
- private DarkModeObserver mContentObserver;
- private Runnable mCallback = () -> {
- updatePreferenceStates();
- };
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- final Context context = getContext();
- mContentObserver = new DarkModeObserver(context);
- }
-
- @Override
- public void onStart() {
- super.onStart();
- // Listen for changes only while visible.
- mContentObserver.subscribe(mCallback);
- }
-
- @Override
- public void onStop() {
- super.onStop();
- // Stop listening for state changes.
- mContentObserver.unsubscribe();
- }
-
- @Override
- protected int getPreferenceScreenResId() {
- return R.xml.dark_mode_settings;
- }
-
- @Override
- public int getHelpResource() {
- return R.string.help_url_dark_theme;
- }
-
- @Override
- protected String getLogTag() {
- return TAG;
- }
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.DARK_UI_SETTINGS;
- }
-
- public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider(R.xml.dark_mode_settings);
-}
diff --git a/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
index 9924cb4b628..3659803cc80 100644
--- a/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/DarkUIPreferenceControllerTest.java
@@ -16,9 +16,25 @@
package com.android.settings.display;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.content.Context;
+import android.os.Handler;
+import android.os.IPowerManager;
+import android.os.PowerManager;
+
import androidx.fragment.app.Fragment;
-import com.android.settings.display.darkmode.DarkModePreference;
+import androidx.preference.PreferenceScreen;
+import androidx.preference.SwitchPreference;
+
+import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -27,10 +43,6 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.RuntimeEnvironment;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-
@RunWith(RobolectricTestRunner.class)
public class DarkUIPreferenceControllerTest {
@@ -45,7 +57,7 @@ public class DarkUIPreferenceControllerTest {
mContext = spy(RuntimeEnvironment.application);
mController = spy(new DarkUIPreferenceController(mContext, "dark_ui_mode"));
mController.setParentFragment(mFragment);
- mController.mPreference = new DarkModePreference(mContext, null /* AttributeSet attrs */);
+ mController.mPreference = new SwitchPreference(mContext);
mController.onStart();
}
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
deleted file mode 100644
index 24cbd0707ca..00000000000
--- a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.settings.display.darkmode;
-
-import android.app.UiModeManager;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.content.res.Resources;
-import android.view.View;
-import android.widget.Button;
-import androidx.preference.PreferenceScreen;
-import com.android.settings.R;
-import com.android.settingslib.widget.LayoutPreference;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.eq;
-
-@RunWith(RobolectricTestRunner.class)
-public class DarkModeActivationPreferenceControllerTest {
- private DarkModeActivationPreferenceController mController;
- private String mPreferenceKey = "key";
- @Mock
- private LayoutPreference mPreference;
- @Mock
- private PreferenceScreen mScreen;
- @Mock
- private Resources res;
- @Mock
- private Context mContext;
- @Mock
- private UiModeManager mService;
- @Mock
- private Button mTurnOffButton;
- @Mock
- private Button mTurnOnButton;
-
- private Configuration configNightYes = new Configuration();
- private Configuration configNightNo = new Configuration();;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mService = mock(UiModeManager.class);
- when(mContext.getResources()).thenReturn(res);
- when(mContext.getSystemService(UiModeManager.class)).thenReturn(mService);
- when(mScreen.findPreference(anyString())).thenReturn(mPreference);
- when(mPreference.findViewById(
- eq(R.id.dark_ui_turn_on_button))).thenReturn(mTurnOnButton);
- when(mPreference.findViewById(
- eq(R.id.dark_ui_turn_off_button))).thenReturn(mTurnOffButton);
- when(mService.setNightModeActivated(anyBoolean())).thenReturn(true);
- when(mContext.getString(
- R.string.dark_ui_activation_off_auto)).thenReturn("off_auto");
- when(mContext.getString(
- R.string.dark_ui_activation_on_auto)).thenReturn("on_auto");
- when(mContext.getString(
- R.string.dark_ui_activation_off_manual)).thenReturn("off_manual");
- when(mContext.getString(
- R.string.dark_ui_activation_on_manual)).thenReturn("on_manual");
- when(mContext.getString(
- R.string.dark_ui_summary_off_auto_mode_auto)).thenReturn("summary_off_auto");
- when(mContext.getString(
- R.string.dark_ui_summary_on_auto_mode_auto)).thenReturn("summary_on_auto");
- when(mContext.getString(
- R.string.dark_ui_summary_off_auto_mode_never)).thenReturn("summary_off_manual");
- when(mContext.getString(
- R.string.dark_ui_summary_on_auto_mode_never)).thenReturn("summary_on_manual");
- mController = new DarkModeActivationPreferenceController(mContext, mPreferenceKey);
- mController.displayPreference(mScreen);
- configNightNo.uiMode = Configuration.UI_MODE_NIGHT_NO;
- configNightYes.uiMode = Configuration.UI_MODE_NIGHT_YES;
- }
-
- @Test
- public void nightMode_toggleButton_offManual() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
- when(res.getConfiguration()).thenReturn(configNightYes);
-
- mController.updateState(mPreference);
-
- verify(mTurnOnButton).setVisibility(eq(View.GONE));
- verify(mTurnOffButton).setVisibility(eq(View.VISIBLE));
- verify(mTurnOffButton).setText(eq(mContext.getString(
- R.string.dark_ui_activation_off_manual)));
- }
-
-
- @Test
- public void nightMode_toggleButton_onAutoWhenModeIsYes() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
- when(res.getConfiguration()).thenReturn(configNightNo);
-
- mController.updateState(mPreference);
-
- verify(mTurnOffButton).setVisibility(eq(View.GONE));
- verify(mTurnOnButton).setVisibility(eq(View.VISIBLE));
- verify(mTurnOnButton).setText(eq(mContext.getString(
- R.string.dark_ui_activation_on_manual)));
- }
-
- @Test
- public void nightMode_toggleButton_onAutoWhenModeIsAuto() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_AUTO);
- when(res.getConfiguration()).thenReturn(configNightNo);
-
- mController.updateState(mPreference);
-
- verify(mTurnOffButton).setVisibility(eq(View.GONE));
- verify(mTurnOnButton).setVisibility(eq(View.VISIBLE));
- verify(mTurnOnButton).setText(eq(mContext.getString(
- R.string.dark_ui_activation_on_auto)));
- }
-
- @Test
- public void nightModeSummary_buttonText_onManual() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_NO);
- when(res.getConfiguration()).thenReturn(configNightYes);
-
- assertEquals(mController.getSummary(), mContext.getString(
- R.string.dark_ui_summary_on_auto_mode_never));
- }
-
- @Test
- public void nightModeSummary_buttonText_offAuto() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_AUTO);
- when(res.getConfiguration()).thenReturn(configNightNo);
-
- assertEquals(mController.getSummary(), mContext.getString(
- R.string.dark_ui_summary_off_auto_mode_auto));
- }
-}
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeObserverTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeObserverTest.java
deleted file mode 100644
index dfa8ba118e4..00000000000
--- a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeObserverTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.settings.display.darkmode;
-
-import android.content.Context;
-import android.database.ContentObserver;
-import android.net.Uri;
-import android.provider.Settings;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-
-
-@RunWith(RobolectricTestRunner.class)
-public class DarkModeObserverTest {
- private Context mContext;
- private ContentObserver mContentObserver;
- private DarkModeObserver mDarkModeObserver;
- private Runnable mCallback;
- private Uri mUri = Settings.Secure.getUriFor(Settings.Secure.UI_NIGHT_MODE);
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = spy(RuntimeEnvironment.application);
- mDarkModeObserver = new DarkModeObserver(mContext);
- mContentObserver = mDarkModeObserver.getContentObserver();
- mCallback = mock(Runnable.class);
- }
-
- @Test
- public void callbackTest_subscribedCallbackCalled() {
- mDarkModeObserver.subscribe(mCallback);
- mContentObserver.onChange(false, mUri);
- Mockito.verify(mCallback, times(2)).run();
- }
-
- @Test
- public void callbackTest_unsubscribedCallNotbackCalled() {
- mDarkModeObserver.subscribe(mCallback);
- mContentObserver.onChange(false, mUri);
- mDarkModeObserver.unsubscribe();
- mContentObserver.onChange(false, mUri);
- Mockito.verify(mCallback, times(2)).run();
- }
-}
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorControllerTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorControllerTest.java
deleted file mode 100644
index a844fec0959..00000000000
--- a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeScheduleSelectorControllerTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2019 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.
- */
-
-package com.android.settings.display.darkmode;
-
-import android.app.UiModeManager;
-import android.content.Context;
-import androidx.preference.DropDownPreference;
-import androidx.preference.PreferenceScreen;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-import com.android.settings.R;
-
-import static junit.framework.TestCase.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
-@RunWith(RobolectricTestRunner.class)
-public class DarkModeScheduleSelectorControllerTest {
- private DarkModeScheduleSelectorController mController;
- private String mPreferenceKey = "key";
- @Mock
- private DropDownPreference mPreference;
- @Mock
- private PreferenceScreen mScreen;
- private Context mContext;
- @Mock
- private UiModeManager mService;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- mContext = spy(RuntimeEnvironment.application);
- when(mContext.getSystemService(UiModeManager.class)).thenReturn(mService);
- when(mContext.getString(R.string.dark_ui_auto_mode_never)).thenReturn("never");
- when(mContext.getString(R.string.dark_ui_auto_mode_auto)).thenReturn("auto");
- mPreference = spy(new DropDownPreference(mContext));
- when(mScreen.findPreference(anyString())).thenReturn(mPreference);
- when(mService.setNightModeActivated(anyBoolean())).thenReturn(true);
- mController = new DarkModeScheduleSelectorController(mContext, mPreferenceKey);
- }
-
- @Test
- public void nightMode_preferenceChange_preferenceChangeTrueWhenChangedOnly() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
- mController.displayPreference(mScreen);
- boolean changed = mController
- .onPreferenceChange(mScreen, mContext.getString(R.string.dark_ui_auto_mode_auto));
- assertTrue(changed);
- changed = mController
- .onPreferenceChange(mScreen, mContext.getString(R.string.dark_ui_auto_mode_auto));
- assertFalse(changed);
- }
-
- @Test
- public void nightMode_updateStateNone_dropDownValueChangedToNone() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_YES);
- mController.displayPreference(mScreen);
- mController.updateState(mPreference);
- verify(mPreference).setValue(mContext.getString(R.string.dark_ui_auto_mode_never));
- }
-
- @Test
- public void nightMode_updateStateNone_dropDownValueChangedToAuto() {
- when(mService.getNightMode()).thenReturn(UiModeManager.MODE_NIGHT_AUTO);
- mController.displayPreference(mScreen);
- mController.updateState(mPreference);
- verify(mPreference).setValue(mContext.getString(R.string.dark_ui_auto_mode_auto));
- }
-}