Merge "Move dream test package to sdk 26"
diff --git a/res/layout/storage_summary_donut.xml b/res/layout/storage_summary_donut.xml
index 8e11d71..ce7e272 100644
--- a/res/layout/storage_summary_donut.xml
+++ b/res/layout/storage_summary_donut.xml
@@ -63,7 +63,7 @@
android:layout_height="wrap_content"
android:layout_below="@android:id/summary"
android:text="@string/storage_menu_free"
- style="@android:style/@Widget.Material.Button.Colored" />
+ style="@style/ActionPrimaryButton" />
</LinearLayout>
<com.android.settings.widget.DonutView
diff --git a/res/layout/suggestion_tile_with_button.xml b/res/layout/suggestion_tile_with_button.xml
index 085f88c..081df5b 100644
--- a/res/layout/suggestion_tile_with_button.xml
+++ b/res/layout/suggestion_tile_with_button.xml
@@ -61,7 +61,7 @@
<Button
android:id="@android:id/primary"
- style="@style/SuwGlifButton.Primary"
+ style="@style/ActionPrimaryButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
diff --git a/res/values/styles.xml b/res/values/styles.xml
index e2b6d44..7c43e99 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -338,10 +338,10 @@
<style name="TextAppearance.SupportSummary" parent="TextAppearance.CategoryTitle"/>
- <style name="SupportPrimaryButton" parent="android:Widget.Material.Button.Colored"/>
+ <style name="SupportPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
<style name="SupportSecondaryButton"
- parent="android:Widget.Material.Button.Borderless.Colored">
+ parent="android:Widget.DeviceDefault.Button.Borderless.Colored">
<item name="android:textSize">12sp</item>
</style>
@@ -425,11 +425,11 @@
<item name="android:textSize">16sp</item>
</style>
- <style name="ActionPrimaryButton" parent="android:Widget.Material.Button.Colored"/>
+ <style name="ActionPrimaryButton" parent="android:Widget.DeviceDefault.Button.Colored"/>
- <style name="ActionSecondaryButton" parent="android:Widget.Material.Button"/>
+ <style name="ActionSecondaryButton" parent="android:Widget.DeviceDefault.Button"/>
- <style name="DreamStartButton" parent="android:Widget.Material.Button" />
+ <style name="DreamStartButton" parent="android:Widget.DeviceDefault.Button" />
<style name="LockPatternContainerStyle">
<item name="android:maxHeight">400dp</item>
diff --git a/src/com/android/settings/core/BasePreferenceController.java b/src/com/android/settings/core/BasePreferenceController.java
new file mode 100644
index 0000000..444cbe9
--- /dev/null
+++ b/src/com/android/settings/core/BasePreferenceController.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2017 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.core;
+
+import android.annotation.IntDef;
+import android.app.slice.Slice;
+import android.content.Context;
+import android.support.v7.preference.Preference;
+import android.text.TextUtils;
+import android.util.Log;
+
+
+import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.search.ResultPayload;
+import com.android.settings.search.SearchIndexableRaw;
+import com.android.settingslib.core.AbstractPreferenceController;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.util.List;
+
+/**
+ * Abstract class to consolidate utility between preference controllers and act as an interface
+ * for Slices. The abstract classes that inherit from this class will act as the direct interfaces
+ * for each type when plugging into Slices.
+ */
+public abstract class BasePreferenceController extends AbstractPreferenceController {
+
+ private static final String TAG = "SettingsPrefController";
+
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({AVAILABLE, DISABLED_UNSUPPORTED, DISABLED_FOR_USER, DISABLED_DEPENDENT_SETTING,
+ UNAVAILABLE_UNKNOWN})
+ public @interface AvailabilityStatus {
+ }
+
+ /**
+ * The setting is available.
+ */
+ public static final int AVAILABLE = 0;
+
+ /**
+ * The setting is not supported by the device.
+ */
+ public static final int DISABLED_UNSUPPORTED = 1;
+
+ /**
+ * The setting cannot be changed by the current user.
+ */
+ public static final int DISABLED_FOR_USER = 2;
+
+ /**
+ * The setting has a dependency in the Settings App which is currently blocking access.
+ */
+ public static final int DISABLED_DEPENDENT_SETTING = 3;
+
+ /**
+ * A catch-all case for internal errors and inexplicable unavailability.
+ */
+ public static final int UNAVAILABLE_UNKNOWN = 4;
+
+ private final String mPreferenceKey;
+
+ public BasePreferenceController(Context context, String preferenceKey) {
+ super(context);
+ mPreferenceKey = preferenceKey;
+ }
+
+ /**
+ * @return {@AvailabilityStatus} for the Setting. This status is used to determine if the
+ * Setting should be shown or disabled in Settings. Further, it can be used to produce
+ * appropriate error / warning Slice in the case of unavailability.
+ * </p>
+ * The status is used for the convenience methods: {@link #isAvailable()},
+ * {@link #isSupported()}
+ */
+ @AvailabilityStatus
+ public abstract int getAvailabilityStatus();
+
+ /**
+ * @return A slice for the corresponding setting.
+ */
+ public abstract Slice getSettingSlice();
+
+ @Override
+ public String getPreferenceKey() {
+ return mPreferenceKey;
+ }
+
+ @Override
+ public final boolean isAvailable() {
+ return getAvailabilityStatus() == AVAILABLE;
+ }
+
+ /**
+ * @return {@code false} if the setting is not applicable to the device. This covers both
+ * settings which were only introduced in future versions of android, or settings that have
+ * hardware dependencies.
+ * </p>
+ * Note that a return value of {@code true} does not mean that the setting is available.
+ */
+ public final boolean isSupported() {
+ return getAvailabilityStatus() != DISABLED_UNSUPPORTED;
+ }
+
+ /**
+ * Updates non-indexable keys for search provider.
+ *
+ * Called by SearchIndexProvider#getNonIndexableKeys
+ */
+ public void updateNonIndexableKeys(List<String> keys) {
+ if (this instanceof AbstractPreferenceController) {
+ if (!isAvailable()) {
+ final String key = getPreferenceKey();
+ if (TextUtils.isEmpty(key)) {
+ Log.w(TAG,
+ "Skipping updateNonIndexableKeys due to empty key " + this.toString());
+ return;
+ }
+ keys.add(key);
+ }
+ }
+ }
+
+ /**
+ * Updates raw data for search provider.
+ *
+ * Called by SearchIndexProvider#getRawDataToIndex
+ */
+ public void updateRawDataToIndex(List<SearchIndexableRaw> rawData) {
+ }
+
+ /**
+ * @return the {@link ResultPayload} corresponding to the search result type for the preference.
+ * TODO (b/69808376) Remove this method.
+ * Do not extend this method. It will not launch with P.
+ */
+ @Deprecated
+ public ResultPayload getResultPayload() {
+ return null;
+ }
+
+ // TODO (b/69380366) Add Method to get preference UI
+
+ // TODO (b/69380464) Add method to get intent
+
+ // TODO (b/69380560) Add method to get broadcast intent
+}
\ No newline at end of file
diff --git a/src/com/android/settings/core/PreferenceControllerMixin.java b/src/com/android/settings/core/PreferenceControllerMixin.java
index 1c54af7..23facba 100644
--- a/src/com/android/settings/core/PreferenceControllerMixin.java
+++ b/src/com/android/settings/core/PreferenceControllerMixin.java
@@ -26,6 +26,7 @@
/**
* A controller mixin that adds mobile settings specific functionality
+ * TODO (b/69808530) Replace with BasePreferenceController.
*/
public interface PreferenceControllerMixin {
@@ -60,7 +61,11 @@
/**
* @return the {@link ResultPayload} corresponding to the search result type for the preference.
+ *
+ * Do not rely on this method for intent-based or inline results. It will be removed in the
+ * unbundling effort.
*/
+ @Deprecated
default ResultPayload getResultPayload() {
return null;
}
diff --git a/src/com/android/settings/core/TogglePreferenceController.java b/src/com/android/settings/core/TogglePreferenceController.java
new file mode 100644
index 0000000..03106d3
--- /dev/null
+++ b/src/com/android/settings/core/TogglePreferenceController.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2017 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.core;
+
+import android.app.slice.Slice;
+import android.content.Context;
+import android.support.v14.preference.SwitchPreference;
+import android.support.v7.preference.Preference;
+
+/**
+ * Abstract class that consolidates logic for updating toggle controllers.
+ * It automatically handles the getting and setting of the switch UI element.
+ * Children of this class implement methods to get and set the underlying value of the setting.
+ */
+public abstract class TogglePreferenceController extends BasePreferenceController implements
+ Preference.OnPreferenceChangeListener {
+
+ private static final String TAG = "TogglePrefController";
+
+ public TogglePreferenceController(Context context, String preferenceKey) {
+ super(context, preferenceKey);
+ }
+
+ /**
+ * @return {@code true} if the Setting is enabled.
+ */
+ public abstract boolean isChecked();
+
+ /**
+ * Set the Setting to {@param isChecked}
+ *
+ * @param isChecked Is {@true} when the setting should be enabled.
+ */
+ public abstract void setChecked(boolean isChecked);
+
+ @Override
+ public final void updateState(Preference preference) {
+ ((SwitchPreference) preference).setChecked(isChecked());
+ }
+
+ @Override
+ public final boolean onPreferenceChange(Preference preference, Object newValue) {
+ boolean auto = (Boolean) newValue;
+ setChecked(auto);
+ return true;
+ }
+
+ @Override
+ public Slice getSettingSlice() {
+ // TODO
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/com/android/settings/development/OemUnlockPreferenceController.java b/src/com/android/settings/development/OemUnlockPreferenceController.java
index f486b3d..c6ba60c 100644
--- a/src/com/android/settings/development/OemUnlockPreferenceController.java
+++ b/src/com/android/settings/development/OemUnlockPreferenceController.java
@@ -98,7 +98,7 @@
@Override
public void updateState(Preference preference) {
super.updateState(preference);
- mPreference.setChecked(mOemLockManager.isOemUnlockAllowed());
+ mPreference.setChecked(isOemUnlockedAllowed());
updateOemUnlockSettingDescription();
// Showing mEnableOemUnlock preference as device has persistent data block.
mPreference.setDisabledByAdmin(null);
@@ -183,7 +183,8 @@
/**
* Returns {@code true} if the bootloader has been unlocked. Otherwise, returns {code false}.
*/
- private boolean isBootloaderUnlocked() {
+ @VisibleForTesting
+ boolean isBootloaderUnlocked() {
return mOemLockManager.isDeviceOemUnlocked();
}
@@ -216,4 +217,9 @@
userHandle);
}
+ @VisibleForTesting
+ boolean isOemUnlockedAllowed() {
+ return mOemLockManager.isOemUnlockAllowed();
+ }
+
}
diff --git a/src/com/android/settings/display/AutoBrightnessPreferenceController.java b/src/com/android/settings/display/AutoBrightnessPreferenceController.java
index f242022..d71a1f8 100644
--- a/src/com/android/settings/display/AutoBrightnessPreferenceController.java
+++ b/src/com/android/settings/display/AutoBrightnessPreferenceController.java
@@ -16,65 +16,54 @@
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
-import android.support.v14.preference.SwitchPreference;
-import android.support.v7.preference.Preference;
import com.android.settings.DisplaySettings;
-import com.android.settings.core.PreferenceControllerMixin;
+import com.android.settings.core.TogglePreferenceController;
import com.android.settings.search.DatabaseIndexingUtils;
import com.android.settings.search.InlineSwitchPayload;
import com.android.settings.search.ResultPayload;
import com.android.settings.R;
-import com.android.settingslib.core.AbstractPreferenceController;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
-public class AutoBrightnessPreferenceController extends AbstractPreferenceController implements
- PreferenceControllerMixin, Preference.OnPreferenceChangeListener {
-
- private final String mAutoBrightnessKey;
+public class AutoBrightnessPreferenceController extends TogglePreferenceController {
private final String SYSTEM_KEY = SCREEN_BRIGHTNESS_MODE;
private final int DEFAULT_VALUE = SCREEN_BRIGHTNESS_MODE_MANUAL;
public AutoBrightnessPreferenceController(Context context, String key) {
- super(context);
- mAutoBrightnessKey = key;
+ super(context, key);
}
@Override
- public boolean isAvailable() {
- return mContext.getResources().getBoolean(
- com.android.internal.R.bool.config_automatic_brightness_available);
+ public boolean isChecked() {
+ return Settings.System.getInt(mContext.getContentResolver(),
+ SYSTEM_KEY, DEFAULT_VALUE) != DEFAULT_VALUE;
}
@Override
- public String getPreferenceKey() {
- return mAutoBrightnessKey;
- }
-
- @Override
- public void updateState(Preference preference) {
- int brightnessMode = Settings.System.getInt(mContext.getContentResolver(),
- SYSTEM_KEY, DEFAULT_VALUE);
- ((SwitchPreference) preference).setChecked(brightnessMode != DEFAULT_VALUE);
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- boolean auto = (Boolean) newValue;
+ public void setChecked(boolean isChecked) {
Settings.System.putInt(mContext.getContentResolver(), SYSTEM_KEY,
- auto ? SCREEN_BRIGHTNESS_MODE_AUTOMATIC : DEFAULT_VALUE);
- return true;
+ isChecked ? SCREEN_BRIGHTNESS_MODE_AUTOMATIC : DEFAULT_VALUE);
+ }
+
+ @Override
+ @AvailabilityStatus
+ public int getAvailabilityStatus() {
+ return mContext.getResources().getBoolean(
+ com.android.internal.R.bool.config_automatic_brightness_available)
+ ? AVAILABLE
+ : DISABLED_UNSUPPORTED;
}
@Override
public ResultPayload getResultPayload() {
+ // TODO remove result payload
final Intent intent = DatabaseIndexingUtils.buildSearchResultPageIntent(mContext,
- DisplaySettings.class.getName(), mAutoBrightnessKey,
+ DisplaySettings.class.getName(), getPreferenceKey(),
mContext.getString(R.string.display_settings));
return new InlineSwitchPayload(SYSTEM_KEY,
diff --git a/src/com/android/settings/search/BaseSearchIndexProvider.java b/src/com/android/settings/search/BaseSearchIndexProvider.java
index 0f02f49..5723300 100644
--- a/src/com/android/settings/search/BaseSearchIndexProvider.java
+++ b/src/com/android/settings/search/BaseSearchIndexProvider.java
@@ -27,6 +27,7 @@
import android.util.Log;
import android.util.Xml;
+import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -71,6 +72,9 @@
if (controller instanceof PreferenceControllerMixin) {
((PreferenceControllerMixin) controller)
.updateNonIndexableKeys(nonIndexableKeys);
+ } else if (controller instanceof BasePreferenceController) {
+ ((BasePreferenceController) controller).updateNonIndexableKeys(
+ nonIndexableKeys);
} else {
throw new IllegalStateException(controller.getClass().getName()
+ " must implement " + PreferenceControllerMixin.class.getName());
diff --git a/src/com/android/settings/search/DatabaseIndexingUtils.java b/src/com/android/settings/search/DatabaseIndexingUtils.java
index 39bcdf84..207d09f 100644
--- a/src/com/android/settings/search/DatabaseIndexingUtils.java
+++ b/src/com/android/settings/search/DatabaseIndexingUtils.java
@@ -27,6 +27,7 @@
import com.android.internal.logging.nano.MetricsProto;
import com.android.settings.SettingsActivity;
import com.android.settings.Utils;
+import com.android.settings.core.BasePreferenceController;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settingslib.core.AbstractPreferenceController;
@@ -72,10 +73,11 @@
* @return A map between {@link Uri}s and {@link PreferenceControllerMixin}s to get the payload
* types for Settings.
*/
- public static Map<String, PreferenceControllerMixin> getPreferenceControllerUriMap(
+ public static Map<String, ResultPayload> getPayloadKeyMap(
String className, Context context) {
+ ArrayMap<String, ResultPayload> map = new ArrayMap<>();
if (context == null) {
- return null;
+ return map;
}
final Class<?> clazz = getIndexableClass(className);
@@ -83,7 +85,7 @@
if (clazz == null) {
Log.d(TAG, "SearchIndexableResource '" + className +
"' should implement the " + Indexable.class.getName() + " interface!");
- return null;
+ return map;
}
// Will be non null only for a Local provider implementing a
@@ -94,44 +96,28 @@
provider.getPreferenceControllers(context);
if (controllers == null) {
- return null;
+ return map;
}
- ArrayMap<String, PreferenceControllerMixin> map = new ArrayMap<>();
-
for (AbstractPreferenceController controller : controllers) {
+ ResultPayload payload;
if (controller instanceof PreferenceControllerMixin) {
- map.put(controller.getPreferenceKey(), (PreferenceControllerMixin) controller);
+ payload = ((PreferenceControllerMixin) controller).getResultPayload();
+
+ } else if (controller instanceof BasePreferenceController) {
+ payload = ((BasePreferenceController) controller).getResultPayload();
} else {
throw new IllegalStateException(controller.getClass().getName()
+ " must implement " + PreferenceControllerMixin.class.getName());
}
+ if (payload != null) {
+ map.put(controller.getPreferenceKey(), payload);
+ }
}
return map;
}
- /**
- * @param uriMap Map between the {@link PreferenceControllerMixin} keys
- * and the controllers themselves.
- * @param key The look-up key
- * @return The Payload from the {@link PreferenceControllerMixin} specified by the key,
- * if it exists. Otherwise null.
- */
- public static ResultPayload getPayloadFromUriMap(Map<String, PreferenceControllerMixin> uriMap,
- String key) {
- if (uriMap == null) {
- return null;
- }
-
- PreferenceControllerMixin controller = uriMap.get(key);
- if (controller == null) {
- return null;
- }
-
- return controller.getResultPayload();
- }
-
public static Class<?> getIndexableClass(String className) {
final Class<?> clazz;
try {
@@ -164,4 +150,4 @@
}
return null;
}
-}
+}
\ No newline at end of file
diff --git a/src/com/android/settings/search/indexing/IndexDataConverter.java b/src/com/android/settings/search/indexing/IndexDataConverter.java
index 65fa279..c40a466 100644
--- a/src/com/android/settings/search/indexing/IndexDataConverter.java
+++ b/src/com/android/settings/search/indexing/IndexDataConverter.java
@@ -40,6 +40,7 @@
import java.io.IOException;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -178,11 +179,11 @@
final String intentTargetPackage = sir.intentTargetPackage;
final String intentTargetClass = sir.intentTargetClass;
- Map<String, PreferenceControllerMixin> controllerUriMap = null;
+ Map<String, ResultPayload> controllerUriMap = new HashMap<>();
if (fragmentName != null) {
controllerUriMap = DatabaseIndexingUtils
- .getPreferenceControllerUriMap(fragmentName, context);
+ .getPayloadKeyMap(fragmentName, context);
}
headerTitle = XmlParserUtils.getDataTitle(context, attrs);
@@ -249,7 +250,7 @@
}
// TODO (b/62254931) index primitives instead of payload
- payload = DatabaseIndexingUtils.getPayloadFromUriMap(controllerUriMap, key);
+ payload = controllerUriMap.get(key);
childFragment = XmlParserUtils.getDataChildFragment(context, attrs);
builder.setSummaryOn(summary)
diff --git a/tests/robotests/src/com/android/settings/core/BasePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/core/BasePreferenceControllerTest.java
new file mode 100644
index 0000000..d153e9a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/core/BasePreferenceControllerTest.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2017 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.core;
+
+import static com.android.settings.core.BasePreferenceController.AVAILABLE;
+import static com.android.settings.core.BasePreferenceController
+ .DISABLED_DEPENDENT_SETTING;
+import static com.android.settings.core.BasePreferenceController.DISABLED_FOR_USER;
+import static com.android.settings.core.BasePreferenceController.DISABLED_UNSUPPORTED;
+import static com.android.settings.core.BasePreferenceController.UNAVAILABLE_UNKNOWN;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.when;
+
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
+public class BasePreferenceControllerTest {
+
+ @Mock
+ BasePreferenceController mPreferenceController;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test
+ public void isAvailable_availableStatusAvailable_returnsTrue() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(AVAILABLE);
+
+ assertThat(mPreferenceController.isAvailable()).isTrue();
+ }
+
+ @Test
+ public void isAvailable_availableStatusUnsupported_returnsFalse() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(DISABLED_UNSUPPORTED);
+
+ assertThat(mPreferenceController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void isAvailable_availableStatusDisabled_returnsFalse() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(DISABLED_FOR_USER);
+
+ assertThat(mPreferenceController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void isAvailable_availableStatusBlockedDependent_returnsFalse() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(DISABLED_DEPENDENT_SETTING);
+
+ assertThat(mPreferenceController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void isAvailable_availableStatusUnavailable_returnsFalse() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(UNAVAILABLE_UNKNOWN);
+
+ assertThat(mPreferenceController.isAvailable()).isFalse();
+ }
+
+ @Test
+ public void isSupported_availableStatusAvailable_returnsTrue() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(AVAILABLE);
+
+ assertThat(mPreferenceController.isSupported()).isTrue();
+ }
+
+ @Test
+ public void isSupported_availableStatusUnsupported_returnsFalse() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(DISABLED_UNSUPPORTED);
+
+ assertThat(mPreferenceController.isSupported()).isFalse();
+ }
+
+ @Test
+ public void isSupported_availableStatusDisabled_returnsTrue() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(DISABLED_FOR_USER);
+
+ assertThat(mPreferenceController.isSupported()).isTrue();
+ }
+
+ @Test
+ public void isSupported_availableStatusDependentSetting_returnsTrue() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(DISABLED_DEPENDENT_SETTING);
+
+ assertThat(mPreferenceController.isSupported()).isTrue();
+ }
+
+ @Test
+ public void isSupported_availableStatusUnavailable_returnsTrue() {
+ when(mPreferenceController.getAvailabilityStatus()).thenReturn(UNAVAILABLE_UNKNOWN);
+
+ assertThat(mPreferenceController.isSupported()).isTrue();
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/core/TogglePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/core/TogglePreferenceControllerTest.java
new file mode 100644
index 0000000..b3df90a
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/core/TogglePreferenceControllerTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (C) 2017 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.core;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.support.v14.preference.SwitchPreference;
+
+import com.android.settings.TestConfig;
+import com.android.settings.core.TogglePreferenceController;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.robolectric.RuntimeEnvironment;
+import org.robolectric.annotation.Config;
+
+@RunWith(SettingsRobolectricTestRunner.class)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
+public class TogglePreferenceControllerTest {
+
+ @Mock
+ TogglePreferenceController mTogglePreferenceController;
+
+ Context mContext;
+ SwitchPreference mPreference;
+
+ @Before
+ public void setUp() {
+ MockitoAnnotations.initMocks(this);
+ mContext = RuntimeEnvironment.application;
+ mPreference = new SwitchPreference(mContext);
+ }
+
+ @Test
+ public void testSetsPreferenceValue_setsChecked() {
+ when(mTogglePreferenceController.isChecked()).thenReturn(true);
+ mPreference.setChecked(false);
+
+ mTogglePreferenceController.updateState(mPreference);
+
+ assertThat(mPreference.isChecked()).isTrue();
+ }
+
+ @Test
+ public void testSetsPreferenceValue_setsNotChecked() {
+ when(mTogglePreferenceController.isChecked()).thenReturn(false);
+ mPreference.setChecked(true);
+
+ mTogglePreferenceController.updateState(mPreference);
+
+ assertThat(mPreference.isChecked()).isFalse();
+ }
+
+ @Test
+ public void testUpdatesPreferenceOnChange_turnsOn() {
+ boolean newValue = true;
+
+ mTogglePreferenceController.onPreferenceChange(mPreference, newValue);
+
+ verify(mTogglePreferenceController).setChecked(newValue);
+ }
+
+ @Test
+ public void testUpdatesPreferenceOnChange_turnsOff() {
+ boolean newValue = false;
+
+ mTogglePreferenceController.onPreferenceChange(mPreference, newValue);
+
+ verify(mTogglePreferenceController).setChecked(newValue);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerDescriptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerDescriptionPreferenceControllerTest.java
index dd438ff..d0f895a 100644
--- a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerDescriptionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerDescriptionPreferenceControllerTest.java
@@ -23,7 +23,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutomaticStorageManagerDescriptionPreferenceControllerTest {
@Mock private PreferenceScreen mScreen;
@Mock private Preference mPreference;
diff --git a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java
index 38c4ab2..3b98063 100644
--- a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java
@@ -51,7 +51,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutomaticStorageManagerSwitchBarControllerTest {
private Context mContext;
private SwitchBar mSwitchBar;
diff --git a/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java
index 582400d..29f19df 100644
--- a/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/AbstractBluetoothA2dpPreferenceControllerTest.java
@@ -46,7 +46,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AbstractBluetoothA2dpPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/AdbPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AdbPreferenceControllerTest.java
index ddcd850..6dac819 100644
--- a/tests/robotests/src/com/android/settings/development/AdbPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/AdbPreferenceControllerTest.java
@@ -41,7 +41,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AdbPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/AllowAppsOnExternalPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AllowAppsOnExternalPreferenceControllerTest.java
index e23c4cc..2703617 100644
--- a/tests/robotests/src/com/android/settings/development/AllowAppsOnExternalPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/AllowAppsOnExternalPreferenceControllerTest.java
@@ -44,7 +44,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AllowAppsOnExternalPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/AnimatorDurationScalePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AnimatorDurationScalePreferenceControllerTest.java
index 5acaf0a..6c83e47 100644
--- a/tests/robotests/src/com/android/settings/development/AnimatorDurationScalePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/AnimatorDurationScalePreferenceControllerTest.java
@@ -44,7 +44,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AnimatorDurationScalePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/AppsNotRespondingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/AppsNotRespondingPreferenceControllerTest.java
index 15c84b5..8850df0 100644
--- a/tests/robotests/src/com/android/settings/development/AppsNotRespondingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/AppsNotRespondingPreferenceControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppsNotRespondingPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BackgroundProcessLimitPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BackgroundProcessLimitPreferenceControllerTest.java
index b384cd0..67b2abe 100644
--- a/tests/robotests/src/com/android/settings/development/BackgroundProcessLimitPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BackgroundProcessLimitPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BackgroundProcessLimitPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAbsoluteVolumePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAbsoluteVolumePreferenceControllerTest.java
index 09e6e9c..652832f 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAbsoluteVolumePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAbsoluteVolumePreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothAbsoluteVolumePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAudioBitsPerSamplePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAudioBitsPerSamplePreferenceControllerTest.java
index fe0a41a..586d626 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAudioBitsPerSamplePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAudioBitsPerSamplePreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioBitsPerSamplePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAudioChannelModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAudioChannelModePreferenceControllerTest.java
index c4dcc19..2f51f1c 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAudioChannelModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAudioChannelModePreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioChannelModePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAudioCodecPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAudioCodecPreferenceControllerTest.java
index 29d8047..33cd3a1 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAudioCodecPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAudioCodecPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioCodecPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAudioQualityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAudioQualityPreferenceControllerTest.java
index e76f1d0..20593dc 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAudioQualityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAudioQualityPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioQualityPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAudioSampleRatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAudioSampleRatePreferenceControllerTest.java
index 4c113b1..95f07c2 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAudioSampleRatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAudioSampleRatePreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothAudioSampleRatePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothAvrcpVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothAvrcpVersionPreferenceControllerTest.java
index 07d0e50..3f993e5 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothAvrcpVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothAvrcpVersionPreferenceControllerTest.java
@@ -45,7 +45,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothAvrcpVersionPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothDeviceNoNamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothDeviceNoNamePreferenceControllerTest.java
index 4e4d8fa..0bc527a 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothDeviceNoNamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothDeviceNoNamePreferenceControllerTest.java
@@ -42,7 +42,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothDeviceNoNamePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothInbandRingingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothInbandRingingPreferenceControllerTest.java
index 4074e25..d132224 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothInbandRingingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothInbandRingingPreferenceControllerTest.java
@@ -45,7 +45,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothInbandRingingPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java
index 4fa991b..7d29637 100644
--- a/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BluetoothSnoopLogPreferenceControllerTest.java
@@ -41,7 +41,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class BluetoothSnoopLogPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java
index 82086dd..bce9b0d 100644
--- a/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BugReportInPowerPreferenceControllerTest.java
@@ -51,7 +51,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BugReportInPowerPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java
index 908c519..77a109a 100644
--- a/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/BugReportPreferenceControllerTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BugReportPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java
index 1443d16..21a01aa 100644
--- a/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/CameraLaserSensorPreferenceControllerTest.java
@@ -45,7 +45,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class CameraLaserSensorPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java
index c4be569..471bf27 100644
--- a/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ClearAdbKeysPreferenceControllerTest.java
@@ -54,7 +54,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class, ShadowUtils.class})
public class ClearAdbKeysPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java
index 5e99ec9..bb974f4 100644
--- a/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ConnectivityMonitorPreferenceControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows =
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows =
SettingsShadowSystemProperties.class)
public class ConnectivityMonitorPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/CoolColorTemperaturePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/CoolColorTemperaturePreferenceControllerTest.java
index 16e6c2a..6e85ca6 100644
--- a/tests/robotests/src/com/android/settings/development/CoolColorTemperaturePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/CoolColorTemperaturePreferenceControllerTest.java
@@ -45,7 +45,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class CoolColorTemperaturePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/DebugGpuOverdrawPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DebugGpuOverdrawPreferenceControllerTest.java
index 2a35993..7aa34ca 100644
--- a/tests/robotests/src/com/android/settings/development/DebugGpuOverdrawPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DebugGpuOverdrawPreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class DebugGpuOverdrawPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/DebugNonRectClipOperationsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DebugNonRectClipOperationsPreferenceControllerTest.java
index 585fe51..877f7fb 100644
--- a/tests/robotests/src/com/android/settings/development/DebugNonRectClipOperationsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DebugNonRectClipOperationsPreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class DebugNonRectClipOperationsPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/DebugViewAttributesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DebugViewAttributesPreferenceControllerTest.java
index 76efa90..6256ddb 100644
--- a/tests/robotests/src/com/android/settings/development/DebugViewAttributesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DebugViewAttributesPreferenceControllerTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DebugViewAttributesPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
index 881ee84..43e389a 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDashboardFragmentTest.java
@@ -52,7 +52,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DevelopmentSettingsDashboardFragmentTest {
private SwitchBar mSwitchBar;
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java
index 5927646..aa9a3a3 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentSettingsDisabledActivityTest.java
@@ -31,7 +31,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DevelopmentSettingsDisabledActivityTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/development/DevelopmentSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/development/DevelopmentSwitchBarControllerTest.java
index bfe30fb..f34bedf 100644
--- a/tests/robotests/src/com/android/settings/development/DevelopmentSwitchBarControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DevelopmentSwitchBarControllerTest.java
@@ -44,7 +44,7 @@
import java.util.ArrayList;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowUtils.class
})
diff --git a/tests/robotests/src/com/android/settings/development/DisableAutomaticUpdatesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/DisableAutomaticUpdatesPreferenceControllerTest.java
index b4e0755..d1e2fd9 100644
--- a/tests/robotests/src/com/android/settings/development/DisableAutomaticUpdatesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/DisableAutomaticUpdatesPreferenceControllerTest.java
@@ -38,7 +38,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DisableAutomaticUpdatesPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
index 1810b11..f94213f 100644
--- a/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/FileEncryptionPreferenceControllerTest.java
@@ -51,7 +51,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class FileEncryptionPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ForceGpuRenderingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ForceGpuRenderingPreferenceControllerTest.java
index 66060a8..e81b422 100644
--- a/tests/robotests/src/com/android/settings/development/ForceGpuRenderingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ForceGpuRenderingPreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ForceGpuRenderingPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java
index ca1ff08..5aaadb4 100644
--- a/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ForceMSAAPreferenceControllerTest.java
@@ -40,7 +40,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ForceMSAAPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/FreeformWindowsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/FreeformWindowsPreferenceControllerTest.java
index b4a4212..43757d0 100644
--- a/tests/robotests/src/com/android/settings/development/FreeformWindowsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/FreeformWindowsPreferenceControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FreeformWindowsPreferenceControllerTest {
private static final String ENG_BUILD_TYPE = "eng";
diff --git a/tests/robotests/src/com/android/settings/development/GpuViewUpdatesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/GpuViewUpdatesPreferenceControllerTest.java
index ecb0da5..028c29e 100644
--- a/tests/robotests/src/com/android/settings/development/GpuViewUpdatesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/GpuViewUpdatesPreferenceControllerTest.java
@@ -41,7 +41,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class GpuViewUpdatesPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/HardwareLayersUpdatesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/HardwareLayersUpdatesPreferenceControllerTest.java
index 9288df9..e7c984b 100644
--- a/tests/robotests/src/com/android/settings/development/HardwareLayersUpdatesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/HardwareLayersUpdatesPreferenceControllerTest.java
@@ -41,7 +41,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class HardwareLayersUpdatesPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/HardwareOverlaysPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/HardwareOverlaysPreferenceControllerTest.java
index 09e48d3..31e910e 100644
--- a/tests/robotests/src/com/android/settings/development/HardwareOverlaysPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/HardwareOverlaysPreferenceControllerTest.java
@@ -47,7 +47,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class HardwareOverlaysPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/HdcpCheckingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/HdcpCheckingPreferenceControllerTest.java
index 434941c..a85075b 100644
--- a/tests/robotests/src/com/android/settings/development/HdcpCheckingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/HdcpCheckingPreferenceControllerTest.java
@@ -47,7 +47,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class HdcpCheckingPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/KeepActivitiesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/KeepActivitiesPreferenceControllerTest.java
index 02a5df6..9736365 100644
--- a/tests/robotests/src/com/android/settings/development/KeepActivitiesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/KeepActivitiesPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class KeepActivitiesPreferenceControllerTest {
private static final int SETTING_VALUE_ON = 1;
diff --git a/tests/robotests/src/com/android/settings/development/LocalBackupPasswordPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/LocalBackupPasswordPreferenceControllerTest.java
index c698313..24b0290 100644
--- a/tests/robotests/src/com/android/settings/development/LocalBackupPasswordPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/LocalBackupPasswordPreferenceControllerTest.java
@@ -28,7 +28,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LocalBackupPasswordPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/LocalTerminalPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/LocalTerminalPreferenceControllerTest.java
index bd33319..66e7ccd 100644
--- a/tests/robotests/src/com/android/settings/development/LocalTerminalPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/LocalTerminalPreferenceControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class LocalTerminalPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java
index 1dc1255..b567dbe 100644
--- a/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/LogPersistPreferenceControllerTest.java
@@ -40,7 +40,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class LogPersistPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java
index f7be653..ec0f492 100644
--- a/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/LogdSizePreferenceControllerTest.java
@@ -39,7 +39,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class LogdSizePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/MemoryUsagePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/MemoryUsagePreferenceControllerTest.java
index d68f276..a769344 100644
--- a/tests/robotests/src/com/android/settings/development/MemoryUsagePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/MemoryUsagePreferenceControllerTest.java
@@ -41,7 +41,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MemoryUsagePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/MobileDataAlwaysOnPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/MobileDataAlwaysOnPreferenceControllerTest.java
index 01ed435..7f33630 100644
--- a/tests/robotests/src/com/android/settings/development/MobileDataAlwaysOnPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/MobileDataAlwaysOnPreferenceControllerTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MobileDataAlwaysOnPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java
index 0aab0db..e136fc0 100644
--- a/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/MockLocationAppPreferenceControllerTest.java
@@ -39,7 +39,7 @@
import java.util.Collections;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class MockLocationAppPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java
index 5ad0329..f471f35 100644
--- a/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/NotificationChannelWarningsPreferenceControllerTest.java
@@ -41,7 +41,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class NotificationChannelWarningsPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
index f59c29f..5018b75 100644
--- a/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/OemUnlockPreferenceControllerTest.java
@@ -48,7 +48,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class OemUnlockPreferenceControllerTest {
@Mock
@@ -108,6 +108,7 @@
doReturn(false).when(mController).showKeyguardConfirmation(mResources,
REQUEST_CODE_ENABLE_OEM_UNLOCK);
doNothing().when(mController).confirmEnableOemUnlock();
+
mController.onPreferenceChange(null, true);
verify(mController).confirmEnableOemUnlock();
@@ -115,17 +116,20 @@
@Test
public void onPreferenceChanged_turnOffUnlock() {
+ mController = spy(mController);
mController.onPreferenceChange(null, false);
- verify(mOemLockManager).setOemUnlockAllowedByUser(false);
+ doReturn(false).when(mController).isBootloaderUnlocked();
+
verify(mFragment).getChildFragmentManager();
}
@Test
public void updateState_preferenceShouldBeCheckedAndShouldBeDisabled() {
mController = spy(mController);
- when(mOemLockManager.isOemUnlockAllowed()).thenReturn(true);
+ doReturn(true).when(mController).isOemUnlockedAllowed();
doReturn(true).when(mController).isOemUnlockAllowedByUserAndCarrier();
- when(mOemLockManager.isDeviceOemUnlocked()).thenReturn(true);
+ doReturn(true).when(mController).isBootloaderUnlocked();
+
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -135,9 +139,10 @@
@Test
public void updateState_preferenceShouldBeUncheckedAndShouldBeDisabled() {
mController = spy(mController);
- when(mOemLockManager.isOemUnlockAllowed()).thenReturn(false);
+ doReturn(false).when(mController).isOemUnlockedAllowed();
doReturn(true).when(mController).isOemUnlockAllowedByUserAndCarrier();
- when(mOemLockManager.isDeviceOemUnlocked()).thenReturn(true);
+ doReturn(true).when(mController).isBootloaderUnlocked();
+
mController.updateState(mPreference);
verify(mPreference).setChecked(false);
@@ -147,9 +152,10 @@
@Test
public void updateState_preferenceShouldBeCheckedAndShouldBeEnabled() {
mController = spy(mController);
- when(mOemLockManager.isOemUnlockAllowed()).thenReturn(true);
+ doReturn(true).when(mController).isOemUnlockedAllowed();
doReturn(true).when(mController).isOemUnlockAllowedByUserAndCarrier();
- when(mOemLockManager.isDeviceOemUnlocked()).thenReturn(false);
+ doReturn(false).when(mController).isBootloaderUnlocked();
+
mController.updateState(mPreference);
verify(mPreference).setChecked(true);
@@ -176,7 +182,9 @@
public void onDeveloperOptionsEnabled_preferenceShouldCheckRestriction() {
mController = spy(mController);
doReturn(false).when(mController).isOemUnlockAllowedByUserAndCarrier();
+ doReturn(false).when(mController).isBootloaderUnlocked();
when(mPreference.isEnabled()).thenReturn(true);
+
mController.onDeveloperOptionsEnabled();
verify(mPreference).checkRestrictionAndSetDisabled(UserManager.DISALLOW_FACTORY_RESET);
@@ -186,8 +194,11 @@
@Test
public void onDeveloperOptionsDisabled_preferenceShouldCheckRestriction() {
mController = spy(mController);
+ doReturn(true).when(mController).isOemUnlockedAllowed();
doReturn(false).when(mController).isOemUnlockAllowedByUserAndCarrier();
+ doReturn(false).when(mController).isBootloaderUnlocked();
when(mPreference.isEnabled()).thenReturn(true);
+
mController.onDeveloperOptionsDisabled();
verify(mPreference).checkRestrictionAndSetDisabled(UserManager.DISALLOW_FACTORY_RESET);
diff --git a/tests/robotests/src/com/android/settings/development/PictureColorModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/PictureColorModePreferenceControllerTest.java
index fac74ac..ff5ffd3 100644
--- a/tests/robotests/src/com/android/settings/development/PictureColorModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/PictureColorModePreferenceControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PictureColorModePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/PointerLocationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/PointerLocationPreferenceControllerTest.java
index 6a6cd2c..120e4a4 100644
--- a/tests/robotests/src/com/android/settings/development/PointerLocationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/PointerLocationPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PointerLocationPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/ProfileGpuRenderingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ProfileGpuRenderingPreferenceControllerTest.java
index 8175110..d6c6185 100644
--- a/tests/robotests/src/com/android/settings/development/ProfileGpuRenderingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ProfileGpuRenderingPreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ProfileGpuRenderingPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ResizableActivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ResizableActivityPreferenceControllerTest.java
index 1289aec..3d6bd16 100644
--- a/tests/robotests/src/com/android/settings/development/ResizableActivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ResizableActivityPreferenceControllerTest.java
@@ -39,7 +39,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ResizableActivityPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/RtlLayoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/RtlLayoutPreferenceControllerTest.java
index 808e2a7..d607a27 100644
--- a/tests/robotests/src/com/android/settings/development/RtlLayoutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/RtlLayoutPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RtlLayoutPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/SecondaryDisplayPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/SecondaryDisplayPreferenceControllerTest.java
index 485e441..d11c117 100644
--- a/tests/robotests/src/com/android/settings/development/SecondaryDisplayPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/SecondaryDisplayPreferenceControllerTest.java
@@ -39,7 +39,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SecondaryDisplayPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/SelectDebugAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/SelectDebugAppPreferenceControllerTest.java
index 03f4972..6c38cea 100644
--- a/tests/robotests/src/com/android/settings/development/SelectDebugAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/SelectDebugAppPreferenceControllerTest.java
@@ -48,7 +48,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SelectDebugAppPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java
index 5a82ca0..bbbc52b 100644
--- a/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/SelectUsbConfigPreferenceControllerTest.java
@@ -57,7 +57,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUtils.class})
public class SelectUsbConfigPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/SetGpuRendererPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/SetGpuRendererPreferenceControllerTest.java
index 7b3097b..9ad1540 100644
--- a/tests/robotests/src/com/android/settings/development/SetGpuRendererPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/SetGpuRendererPreferenceControllerTest.java
@@ -43,7 +43,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class SetGpuRendererPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ShortcutManagerThrottlingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ShortcutManagerThrottlingPreferenceControllerTest.java
index 0a189cb..6654f9a 100644
--- a/tests/robotests/src/com/android/settings/development/ShortcutManagerThrottlingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ShortcutManagerThrottlingPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShortcutManagerThrottlingPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java
index 2eb1070..8320c97 100644
--- a/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ShowLayoutBoundsPreferenceControllerTest.java
@@ -41,7 +41,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class ShowLayoutBoundsPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/ShowSurfaceUpdatesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ShowSurfaceUpdatesPreferenceControllerTest.java
index a5cfa22..94af993 100644
--- a/tests/robotests/src/com/android/settings/development/ShowSurfaceUpdatesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ShowSurfaceUpdatesPreferenceControllerTest.java
@@ -47,7 +47,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShowSurfaceUpdatesPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/ShowTapsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/ShowTapsPreferenceControllerTest.java
index 40e2fbd..d8fec93 100644
--- a/tests/robotests/src/com/android/settings/development/ShowTapsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/ShowTapsPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ShowTapsPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/SimulateColorSpacePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/SimulateColorSpacePreferenceControllerTest.java
index 23c6e4c..3570368 100644
--- a/tests/robotests/src/com/android/settings/development/SimulateColorSpacePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/SimulateColorSpacePreferenceControllerTest.java
@@ -46,7 +46,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SimulateColorSpacePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/StayAwakePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/StayAwakePreferenceControllerTest.java
index 41b9fde..2dd0caf 100644
--- a/tests/robotests/src/com/android/settings/development/StayAwakePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/StayAwakePreferenceControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class StayAwakePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/StrictModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/StrictModePreferenceControllerTest.java
index 0f839c1..fdc841b 100644
--- a/tests/robotests/src/com/android/settings/development/StrictModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/StrictModePreferenceControllerTest.java
@@ -45,7 +45,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {SettingsShadowSystemProperties.class})
public class StrictModePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/development/TetheringHardwareAccelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/TetheringHardwareAccelPreferenceControllerTest.java
index e044f2a..43798c0 100644
--- a/tests/robotests/src/com/android/settings/development/TetheringHardwareAccelPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/TetheringHardwareAccelPreferenceControllerTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TetheringHardwareAccelPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/TransitionAnimationScalePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/TransitionAnimationScalePreferenceControllerTest.java
index e8f9980..5da1abc 100644
--- a/tests/robotests/src/com/android/settings/development/TransitionAnimationScalePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/TransitionAnimationScalePreferenceControllerTest.java
@@ -44,7 +44,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TransitionAnimationScalePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/UsbAudioRoutingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/UsbAudioRoutingPreferenceControllerTest.java
index 4b7e82b..644e7c9 100644
--- a/tests/robotests/src/com/android/settings/development/UsbAudioRoutingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/UsbAudioRoutingPreferenceControllerTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UsbAudioRoutingPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
index e396ebe..4585b6d 100644
--- a/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/VerifyAppsOverUsbPreferenceControllerTest.java
@@ -51,7 +51,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class VerifyAppsOverUsbPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/WaitForDebuggerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WaitForDebuggerPreferenceControllerTest.java
index e1d96d1..1d7f3f7 100644
--- a/tests/robotests/src/com/android/settings/development/WaitForDebuggerPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WaitForDebuggerPreferenceControllerTest.java
@@ -50,7 +50,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WaitForDebuggerPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java
index 59f6e35..26331b1 100644
--- a/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WebViewAppPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WebViewAppPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/WifiAggressiveHandoverPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiAggressiveHandoverPreferenceControllerTest.java
index ebda837..57b6e1d 100644
--- a/tests/robotests/src/com/android/settings/development/WifiAggressiveHandoverPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WifiAggressiveHandoverPreferenceControllerTest.java
@@ -40,7 +40,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiAggressiveHandoverPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/WifiDisplayCertificationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiDisplayCertificationPreferenceControllerTest.java
index c049bc1..9ca9b55d 100644
--- a/tests/robotests/src/com/android/settings/development/WifiDisplayCertificationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WifiDisplayCertificationPreferenceControllerTest.java
@@ -38,7 +38,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiDisplayCertificationPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/WifiRoamScansPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiRoamScansPreferenceControllerTest.java
index 60e5e49..a7a6608 100644
--- a/tests/robotests/src/com/android/settings/development/WifiRoamScansPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WifiRoamScansPreferenceControllerTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiRoamScansPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/WifiVerboseLoggingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WifiVerboseLoggingPreferenceControllerTest.java
index f8a9b87..09a5e9c 100644
--- a/tests/robotests/src/com/android/settings/development/WifiVerboseLoggingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WifiVerboseLoggingPreferenceControllerTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WifiVerboseLoggingPreferenceControllerTest {
@Mock
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/development/WindowAnimationScalePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/WindowAnimationScalePreferenceControllerTest.java
index 0fbff3b..c7e2258 100644
--- a/tests/robotests/src/com/android/settings/development/WindowAnimationScalePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/WindowAnimationScalePreferenceControllerTest.java
@@ -44,7 +44,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WindowAnimationScalePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagsDashboardTest.java b/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagsDashboardTest.java
index 0839a02..1fd07c3 100644
--- a/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagsDashboardTest.java
+++ b/tests/robotests/src/com/android/settings/development/featureflags/FeatureFlagsDashboardTest.java
@@ -29,7 +29,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FeatureFlagsDashboardTest {
private FeatureFlagsDashboard mDashboard;
diff --git a/tests/robotests/src/com/android/settings/development/qstile/DevelopmentTilePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/qstile/DevelopmentTilePreferenceControllerTest.java
index 1cdff20..e4c479e 100644
--- a/tests/robotests/src/com/android/settings/development/qstile/DevelopmentTilePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/development/qstile/DevelopmentTilePreferenceControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.shadows.ShadowPackageManager;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DevelopmentTilePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java
index a7d7355..f71bae6 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/BasebandVersionPreferenceControllerTest.java
@@ -24,6 +24,7 @@
import android.support.v7.preference.Preference;
import com.android.settings.TestConfig;
+import com.android.settings.deviceinfo.firmwareversion.BasebandVersionDialogController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowSystemProperties;
import com.android.settings.testutils.shadow.ShadowConnectivityManager;
@@ -36,6 +37,10 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
+/**
+ * Deprecated in favor of {@link BasebandVersionDialogController}
+ */
+@Deprecated
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
shadows = ShadowConnectivityManager.class)
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java
index 0ccc139..5587f4b 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/BatteryInfoPreferenceControllerTest.java
@@ -50,7 +50,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BatteryInfoPreferenceControllerTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/BuildNumberPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/BuildNumberPreferenceControllerTest.java
index 16de8ea..8312673 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/BuildNumberPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/BuildNumberPreferenceControllerTest.java
@@ -58,7 +58,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowUtils.class
})
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceControllerTest.java
index 951d8c7..c77a279 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/FccEquipmentIdPreferenceControllerTest.java
@@ -36,7 +36,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FccEquipmentIdPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/FeedbackPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/FeedbackPreferenceControllerTest.java
index dfc1a0c..293127c 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/FeedbackPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/FeedbackPreferenceControllerTest.java
@@ -34,7 +34,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FeedbackPreferenceControllerTest {
@Mock
private Fragment mFragment;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java
index 207d58e..09b2e7f 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/FirmwareVersionPreferenceControllerTest.java
@@ -25,6 +25,7 @@
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.TestConfig;
+import com.android.settings.deviceinfo.firmwareversion.FirmwareVersionDialogController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -36,6 +37,10 @@
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
+/**
+ * Deprecated in favor of {@link FirmwareVersionDialogController}
+ */
+@Deprecated
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
public class FirmwareVersionPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/KernelVersionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/KernelVersionPreferenceControllerTest.java
index 10e4958..a889e9b 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/KernelVersionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/KernelVersionPreferenceControllerTest.java
@@ -30,7 +30,7 @@
import static com.google.common.truth.Truth.assertThat;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class KernelVersionPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/ManualPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/ManualPreferenceControllerTest.java
index 6151ca0..916c45d 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/ManualPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/ManualPreferenceControllerTest.java
@@ -34,7 +34,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ManualPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/PrivateVolumeOptionMenuControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/PrivateVolumeOptionMenuControllerTest.java
index 6363317..866b53d 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/PrivateVolumeOptionMenuControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/PrivateVolumeOptionMenuControllerTest.java
@@ -43,7 +43,7 @@
import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class PrivateVolumeOptionMenuControllerTest {
@Mock
private MenuItem mMigrateMenuItem;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceControllerTest.java
index 4ea33ee..99a835f 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/RegulatoryInfoPreferenceControllerTest.java
@@ -42,7 +42,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RegulatoryInfoPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
index b1296e5..8ad91cd 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/StorageDashboardFragmentTest.java
@@ -52,7 +52,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class StorageDashboardFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private StorageManager mStorageManager;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java b/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java
index 5b34c7d..cec1887 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/StorageItemPreferenceTest.java
@@ -35,7 +35,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class StorageItemPreferenceTest {
private Context mContext;
private StorageItemPreference mPreference;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/StorageProfileFragmentTest.java b/tests/robotests/src/com/android/settings/deviceinfo/StorageProfileFragmentTest.java
index b0f464c..80aebab 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/StorageProfileFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/StorageProfileFragmentTest.java
@@ -37,7 +37,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class StorageProfileFragmentTest {
@Captor
private ArgumentCaptor<SparseArray<StorageAsyncLoader.AppsStorageResult>> mCaptor;
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/StorageSettingsTest.java b/tests/robotests/src/com/android/settings/deviceinfo/StorageSettingsTest.java
index 5e95a61..cc8b31d 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/StorageSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/StorageSettingsTest.java
@@ -48,7 +48,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class StorageSettingsTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/UsbBackendTest.java b/tests/robotests/src/com/android/settings/deviceinfo/UsbBackendTest.java
index ce384a5..5939174 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/UsbBackendTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/UsbBackendTest.java
@@ -37,7 +37,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UsbBackendTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/UsbModeChooserActivityTest.java b/tests/robotests/src/com/android/settings/deviceinfo/UsbModeChooserActivityTest.java
index 1817bfb..34246b4 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/UsbModeChooserActivityTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/UsbModeChooserActivityTest.java
@@ -32,7 +32,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class UsbModeChooserActivityTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerV2Test.java
index 5fa8a91..d27d880 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/firmwareversion/FirmwareVersionPreferenceControllerV2Test.java
@@ -43,7 +43,7 @@
import org.robolectric.annotation.Config;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FirmwareVersionPreferenceControllerV2Test {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
index c95c4db..921c41f 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoDialogControllerTest.java
@@ -49,7 +49,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ImeiInfoDialogControllerTest {
private static final String PRL_VERSION = "some_prl_version";
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerV2Test.java
index 3fed589..f077386 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/imei/ImeiInfoPreferenceControllerV2Test.java
@@ -50,7 +50,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ImeiInfoPreferenceControllerV2Test {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
index fd48162..3eb4955 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusDialogControllerTest.java
@@ -68,7 +68,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SimStatusDialogControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusPreferenceControllerV2Test.java b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusPreferenceControllerV2Test.java
index 53324b5..ec6b0be 100644
--- a/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusPreferenceControllerV2Test.java
+++ b/tests/robotests/src/com/android/settings/deviceinfo/simstatus/SimStatusPreferenceControllerV2Test.java
@@ -48,7 +48,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SimStatusPreferenceControllerV2Test {
@Mock
diff --git a/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java
index b46441d..4acf609 100644
--- a/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AutoBrightnessPreferenceControllerTest.java
@@ -19,6 +19,7 @@
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC;
import static android.provider.Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL;
+
import static com.google.common.truth.Truth.assertThat;
import android.content.ContentResolver;
@@ -26,9 +27,6 @@
import android.provider.Settings;
import com.android.settings.TestConfig;
-import com.android.settings.search.InlinePayload;
-import com.android.settings.search.InlineSwitchPayload;
-import com.android.settings.search.ResultPayload;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
@@ -38,10 +36,9 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config;
-import org.robolectric.shadows.ShadowApplication;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoBrightnessPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Context mContext;
@@ -74,33 +71,27 @@
}
@Test
- public void testPreferenceController_ProperResultPayloadType() {
- final Context context = ShadowApplication.getInstance().getApplicationContext();
- mController = new AutoBrightnessPreferenceController(context, PREFERENCE_KEY);
- ResultPayload payload = mController.getResultPayload();
- assertThat(payload).isInstanceOf(InlineSwitchPayload.class);
- }
-
- @Test
public void testSetValue_updatesCorrectly() {
- int newValue = 1;
+ boolean newValue = true;
ContentResolver resolver = mContext.getContentResolver();
- Settings.System.putInt(resolver, SCREEN_BRIGHTNESS_MODE, 0);
+ Settings.System.putInt(resolver, SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_MANUAL);
- ((InlinePayload) mController.getResultPayload()).setValue(mContext, newValue);
- int updatedValue = Settings.System.getInt(resolver, SCREEN_BRIGHTNESS_MODE, -1);
+ mController.setChecked(newValue);
+ boolean updatedValue = Settings.System.getInt(resolver, SCREEN_BRIGHTNESS_MODE, -1)
+ != SCREEN_BRIGHTNESS_MODE_MANUAL;
assertThat(updatedValue).isEqualTo(newValue);
}
@Test
public void testGetValue_correctValueReturned() {
- int currentValue = 1;
ContentResolver resolver = mContext.getContentResolver();
- Settings.System.putInt(resolver, SCREEN_BRIGHTNESS_MODE, currentValue);
+ Settings.System.putInt(resolver, SCREEN_BRIGHTNESS_MODE, SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
- int newValue = ((InlinePayload) mController.getResultPayload()).getValue(mContext);
+ int newValue = mController.isChecked() ?
+ SCREEN_BRIGHTNESS_MODE_AUTOMATIC
+ : SCREEN_BRIGHTNESS_MODE_MANUAL;
- assertThat(newValue).isEqualTo(currentValue);
+ assertThat(newValue).isEqualTo(SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
}
}
diff --git a/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java b/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java
index 9ce725b..94ce487 100644
--- a/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/search/DatabaseIndexingUtilsTest.java
@@ -20,18 +20,14 @@
import static com.google.common.truth.Truth.assertThat;
import android.content.Context;
-import android.util.ArrayMap;
-import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.TestConfig;
-import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.deviceinfo.SystemUpdatePreferenceController;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
@@ -43,8 +39,6 @@
public class DatabaseIndexingUtilsTest {
private Context mContext;
- @Mock
- private AmbientDisplayConfiguration mAmbientDisplayConfiguration;
@Before
public void setUp() {
@@ -54,44 +48,22 @@
@Test
public void testGetPreferenceControllerUriMap_BadClassName_ReturnsNull() {
- Map map = DatabaseIndexingUtils.getPreferenceControllerUriMap("dummy", mContext);
- assertThat(map).isNull();
+ Map map = DatabaseIndexingUtils.getPayloadKeyMap("dummy", mContext);
+ assertThat(map).isEmpty();
}
@Test
public void testGetPreferenceControllerUriMap_NullContext_ReturnsNull() {
- Map map = DatabaseIndexingUtils.getPreferenceControllerUriMap("dummy", null);
- assertThat(map).isNull();
- }
-
- @Test
- public void testGetPreferenceControllerUriMap_CompatibleClass_ReturnsValidMap() {
- final String className = "com.android.settings.system.SystemDashboardFragment";
- final Map<String, PreferenceControllerMixin> map =
- DatabaseIndexingUtils.getPreferenceControllerUriMap(className, mContext);
- assertThat(map.get("system_update_settings"))
- .isInstanceOf(SystemUpdatePreferenceController.class);
+ Map map = DatabaseIndexingUtils.getPayloadKeyMap("dummy", null);
+ assertThat(map).isEmpty();
}
@Test
public void testGetPayloadFromMap_NullMap_ReturnsNull() {
- ResultPayload payload = DatabaseIndexingUtils.getPayloadFromUriMap(null, "");
+ final String className = "com.android.settings.system.SystemDashboardFragment";
+ final Map<String, ResultPayload> map =
+ DatabaseIndexingUtils.getPayloadKeyMap(className, mContext);
+ ResultPayload payload = map.get(null);
assertThat(payload).isNull();
}
-
- @Test
- public void testGetPayloadFromMap_MatchingKey_ReturnsPayload() {
- final String key = "key";
- PreferenceControllerMixin prefController = new PreferenceControllerMixin() {
- @Override
- public ResultPayload getResultPayload() {
- return new ResultPayload(null);
- }
- };
- ArrayMap<String, PreferenceControllerMixin> map = new ArrayMap<>();
- map.put(key, prefController);
-
- ResultPayload payload = DatabaseIndexingUtils.getPayloadFromUriMap(map, key);
- assertThat(payload).isInstanceOf(ResultPayload.class);
- }
}