Merge "Remove duplicate result for dark mode" into rvc-dev
diff --git a/res/xml/dark_mode_settings.xml b/res/xml/dark_mode_settings.xml
index 1e0d42e..0ebc044 100644
--- a/res/xml/dark_mode_settings.xml
+++ b/res/xml/dark_mode_settings.xml
@@ -53,8 +53,7 @@
android:selectable="false"
android:layout="@layout/dark_ui_activation_button"
settings:allowDividerBelow="true"
- settings:controller="com.android.settings.display.darkmode.DarkModeActivationPreferenceController"
- settings:keywords="@string/keywords_dark_ui_mode"/>
+ settings:controller="com.android.settings.display.darkmode.DarkModeActivationPreferenceController"/>
<com.android.settingslib.widget.FooterPreference
android:key="dark_ui_footer"
diff --git a/res/xml/display_settings.xml b/res/xml/display_settings.xml
index c4ccd4f..d463a84 100644
--- a/res/xml/display_settings.xml
+++ b/res/xml/display_settings.xml
@@ -37,7 +37,8 @@
android:fragment="com.android.settings.display.darkmode.DarkModeSettingsFragment"
android:widgetLayout="@null"
settings:widgetLayout="@null"
- settings:controller="com.android.settings.display.DarkUIPreferenceController"/>
+ settings:controller="com.android.settings.display.DarkUIPreferenceController"
+ settings:keywords="@string/keywords_dark_ui_mode"/>
<com.android.settings.display.NightDisplayPreference
android:key="night_display"
diff --git a/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java b/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java
index 74b029f..1027dac 100644
--- a/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java
+++ b/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceController.java
@@ -156,6 +156,6 @@
@Override
public int getAvailabilityStatus() {
- return AVAILABLE;
+ return AVAILABLE_UNSEARCHABLE;
}
}
diff --git a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
index 25117be..5e6d463 100644
--- a/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/darkmode/DarkModeActivationPreferenceControllerTest.java
@@ -15,6 +15,19 @@
package com.android.settings.display.darkmode;
+import static com.android.settings.core.BasePreferenceController.AVAILABLE_UNSEARCHABLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.UiModeManager;
import android.content.Context;
import android.content.res.Configuration;
@@ -22,9 +35,12 @@
import android.os.PowerManager;
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;
@@ -34,15 +50,6 @@
import java.util.Locale;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-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;
@@ -203,4 +210,9 @@
verify(mTurnOffButton).setVisibility(eq(View.GONE));
verify(mTurnOnButton).setVisibility(eq(View.GONE));
}
+
+ @Test
+ public void getAvailabilityStatus_returnsAVAILABLE_UNSEARCHABLE() {
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(AVAILABLE_UNSEARCHABLE);
+ }
}