Merge "Add preference group for saved devcies."
diff --git a/res/layout-land/fingerprint_enroll_enrolling.xml b/res/layout-land/fingerprint_enroll_enrolling.xml
index fb6c78b..8b902f1 100644
--- a/res/layout-land/fingerprint_enroll_enrolling.xml
+++ b/res/layout-land/fingerprint_enroll_enrolling.xml
@@ -110,10 +110,11 @@
<com.android.setupwizardlib.view.FillContentLayout
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
+ android:layout_height="0dp"
+ android:layout_marginVertical="24dp"
+ android:layout_weight="1"
android:paddingTop="0dp"
- android:paddingBottom="0dp"
- android:layout_marginVertical="24dp">
+ android:paddingBottom="0dp">
<include layout="@layout/fingerprint_enroll_enrolling_content"
android:layout_width="match_parent"
diff --git a/res/layout/preference_dropdown_material_settings.xml b/res/layout/preference_dropdown_material_settings.xml
deleted file mode 100644
index a3f5ab9..0000000
--- a/res/layout/preference_dropdown_material_settings.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
- Copyright (C) 2016 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.
- -->
-
-
-<!-- Based off frameworks/base/core/res/res/layout/preference_dropdown_material.xml
- except that icon space in this layout is always reserved -->
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content">
-
- <Spinner
- android:id="@+id/spinner"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/preference_no_icon_padding_start"
- android:visibility="invisible" />
-
- <include layout="@layout/preference_material"/>
-
-</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/settings_main_dashboard.xml b/res/layout/settings_main_dashboard.xml
index 7c34803..269bc3c 100644
--- a/res/layout/settings_main_dashboard.xml
+++ b/res/layout/settings_main_dashboard.xml
@@ -32,7 +32,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="@dimen/search_bar_margin"
- app:cardCornerRadius="@dimen/search_bar_half_height"
+ app:cardCornerRadius="@dimen/search_bar_corner_radius"
app:cardBackgroundColor="?android:attr/colorBackground"
app:cardElevation="2dp">
<Toolbar
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/dimens.xml b/res/values/dimens.xml
index 2f00297..ef4d269 100755
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -121,7 +121,7 @@
<dimen name="search_bar_negative_margin">-8dp</dimen>
<dimen name="search_bar_height">48dp</dimen>
- <dimen name="search_bar_half_height">24dp</dimen>
+ <dimen name="search_bar_corner_radius">2dp</dimen>
<dimen name="search_bar_text_size">16dp</dimen>
<!-- Dimensions for Wifi Assistant Card -->
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/res/values/styles_preference.xml b/res/values/styles_preference.xml
index 056d55a..b8b9eb3 100644
--- a/res/values/styles_preference.xml
+++ b/res/values/styles_preference.xml
@@ -20,19 +20,19 @@
<resources>
<!-- Fragment style -->
- <style name="SettingsPreferenceFragmentStyle" parent="@style/PreferenceFragmentStyle.SettingsBase">
+ <style name="SettingsPreferenceFragmentStyle" parent="@style/PreferenceFragment.Material">
<item name="android:layout">@layout/preference_list_fragment</item>
</style>
- <style name="ApnPreference" parent="Preference.SettingsBase">
+ <style name="ApnPreference" parent="@style/Preference.Material">
<item name="android:layout">@layout/apn_preference_layout</item>
</style>
- <style name="SettingsSeekBarPreference" parent="Preference.SettingsBase">
+ <style name="SettingsSeekBarPreference" parent="@style/Preference.Material">
<item name="android:layout">@layout/preference_widget_seekbar_settings</item>
</style>
- <style name="SyncSwitchPreference" parent="Preference.SettingsBase">
+ <style name="SyncSwitchPreference" parent="@style/Preference.Material">
<item name="android:widgetLayout">@layout/preference_widget_sync_toggle</item>
</style>
diff --git a/src/com/android/settings/CredentialStorage.java b/src/com/android/settings/CredentialStorage.java
index e5d40b7..ffbd2ce 100644
--- a/src/com/android/settings/CredentialStorage.java
+++ b/src/com/android/settings/CredentialStorage.java
@@ -275,6 +275,16 @@
Log.e(TAG, "Failed to install " + key + " as uid " + uid);
return;
}
+ // The key was prepended USER_PRIVATE_KEY by the CredentialHelper. However,
+ // KeyChain internally uses the raw alias name and only prepends USER_PRIVATE_KEY
+ // to the key name when interfacing with KeyStore.
+ // This is generally a symptom of CredentialStorage and CredentialHelper relying
+ // on internal implementation details of KeyChain and imitating its functionality
+ // rather than delegating to KeyChain for the certificate installation.
+ if (uid == Process.SYSTEM_UID || uid == KeyStore.UID_SELF) {
+ new MarkKeyAsUserSelectable(
+ key.replaceFirst("^" + Credentials.USER_PRIVATE_KEY, "")).execute();
+ }
}
int flags = KeyStore.FLAG_NONE;
@@ -391,6 +401,33 @@
}
/**
+ * Background task to mark a given key alias as user-selectable, so that
+ * it can be selected by users from the Certificate Selection prompt.
+ */
+ private class MarkKeyAsUserSelectable extends AsyncTask<Void, Void, Boolean> {
+ final String mAlias;
+
+ public MarkKeyAsUserSelectable(String alias) {
+ mAlias = alias;
+ }
+
+ @Override
+ protected Boolean doInBackground(Void... unused) {
+ try (KeyChainConnection keyChainConnection = KeyChain.bind(CredentialStorage.this)) {
+ keyChainConnection.getService().setUserSelectable(mAlias, true);
+ return true;
+ } catch (RemoteException e) {
+ Log.w(TAG, "Failed to mark key " + mAlias + " as user-selectable.");
+ return false;
+ } catch (InterruptedException e) {
+ Log.w(TAG, "Failed to mark key " + mAlias + " as user-selectable.");
+ Thread.currentThread().interrupt();
+ return false;
+ }
+ }
+ }
+
+ /**
* Check that the caller is either certinstaller or Settings running in a profile of this user.
*/
private boolean checkCallerIsCertInstallerOrSelfInProfile() {
diff --git a/src/com/android/settings/applications/AppInfoWithHeader.java b/src/com/android/settings/applications/AppInfoWithHeader.java
index 3df81c7..af0cf5b 100644
--- a/src/com/android/settings/applications/AppInfoWithHeader.java
+++ b/src/com/android/settings/applications/AppInfoWithHeader.java
@@ -16,6 +16,8 @@
package com.android.settings.applications;
+import static com.android.settings.widget.EntityHeaderController.ActionType;
+
import android.app.Activity;
import android.os.Bundle;
import android.support.v7.preference.Preference;
@@ -25,8 +27,6 @@
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.applications.AppUtils;
-import static com.android.settings.widget.EntityHeaderController.ActionType;
-
public abstract class AppInfoWithHeader extends AppInfoBase {
private boolean mCreated;
@@ -44,7 +44,7 @@
final Preference pref = EntityHeaderController
.newInstance(activity, this, null /* header */)
.setRecyclerView(getListView(), getLifecycle())
- .setIcon(IconDrawableFactory.newInstance(activity)
+ .setIcon(IconDrawableFactory.newInstance(getContext())
.getBadgedIcon(mPackageInfo.applicationInfo))
.setLabel(mPackageInfo.applicationInfo.loadLabel(mPm))
.setSummary(mPackageInfo)
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/dashboard/DashboardAdapter.java b/src/com/android/settings/dashboard/DashboardAdapter.java
index fd2adac..54a1eeb 100644
--- a/src/com/android/settings/dashboard/DashboardAdapter.java
+++ b/src/com/android/settings/dashboard/DashboardAdapter.java
@@ -477,7 +477,7 @@
final int tintColor = a.getColor(0, mContext.getColor(R.color.fallback_tintColor));
a.recycle();
if (category != null) {
- for (Tile tile : category.tiles) {
+ for (Tile tile : category.getTiles()) {
if (tile.isIconTintable) {
// If this drawable is tintable, tint it to match the color.
tile.icon.setTint(tintColor);
diff --git a/src/com/android/settings/dashboard/DashboardData.java b/src/com/android/settings/dashboard/DashboardData.java
index a14b8c2..6407960 100644
--- a/src/com/android/settings/dashboard/DashboardData.java
+++ b/src/com/android/settings/dashboard/DashboardData.java
@@ -268,8 +268,9 @@
&& hiddenSuggestion == 0);
if (mCategory != null) {
- for (int j = 0; j < mCategory.tiles.size(); j++) {
- final Tile tile = mCategory.tiles.get(j);
+ final List<Tile> tiles = mCategory.getTiles();
+ for (int j = 0; j < tiles.size(); j++) {
+ final Tile tile = tiles.get(j);
addToItemList(tile, R.layout.dashboard_tile, Objects.hash(tile.title),
true /* add */);
}
diff --git a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
index bee822a..9ef38b8 100644
--- a/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
+++ b/src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java
@@ -91,7 +91,7 @@
Log.d(TAG, "NO dashboard tiles for " + TAG);
return null;
}
- final List<Tile> tiles = category.tiles;
+ final List<Tile> tiles = category.getTiles();
if (tiles == null || tiles.isEmpty()) {
Log.d(TAG, "tile list is empty, skipping category " + category.title);
return null;
diff --git a/src/com/android/settings/dashboard/DashboardFragment.java b/src/com/android/settings/dashboard/DashboardFragment.java
index 3551d23..3e1e881 100644
--- a/src/com/android/settings/dashboard/DashboardFragment.java
+++ b/src/com/android/settings/dashboard/DashboardFragment.java
@@ -307,7 +307,7 @@
Log.d(TAG, "NO dashboard tiles for " + TAG);
return;
}
- List<Tile> tiles = category.tiles;
+ final List<Tile> tiles = category.getTiles();
if (tiles == null) {
Log.d(TAG, "tile list is empty, skipping category " + category.title);
return;
diff --git a/src/com/android/settings/dashboard/SiteMapManager.java b/src/com/android/settings/dashboard/SiteMapManager.java
index facd9ed..b54e061 100644
--- a/src/com/android/settings/dashboard/SiteMapManager.java
+++ b/src/com/android/settings/dashboard/SiteMapManager.java
@@ -16,23 +16,26 @@
package com.android.settings.dashboard;
+import static android.provider.SearchIndexablesContract.SITE_MAP_COLUMNS;
import static com.android.settings.dashboard.DashboardFragmentRegistry.CATEGORY_KEY_TO_PARENT_MAP;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
+import android.provider.SearchIndexablesContract.SiteMapColumns;
import android.support.annotation.VisibleForTesting;
import android.support.annotation.WorkerThread;
import android.support.v4.util.ArrayMap;
import android.text.TextUtils;
import android.util.Log;
+
import com.android.settings.SettingsActivity;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.search.IndexDatabaseHelper;
import com.android.settings.search.IndexDatabaseHelper.IndexColumns;
-import com.android.settings.search.IndexDatabaseHelper.SiteMapColumns;
import com.android.settingslib.drawer.DashboardCategory;
import com.android.settingslib.drawer.Tile;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@@ -47,14 +50,6 @@
private static final String TAG = "SiteMapManager";
private static final boolean DEBUG_TIMING = false;
- @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
- public static final String[] SITE_MAP_COLUMNS = {
- SiteMapColumns.PARENT_CLASS,
- SiteMapColumns.PARENT_TITLE,
- SiteMapColumns.CHILD_CLASS,
- SiteMapColumns.CHILD_TITLE
- };
-
private static final String[] CLASS_TO_SCREEN_TITLE_COLUMNS = {
IndexColumns.CLASS_NAME,
IndexColumns.SCREEN_TITLE,
@@ -108,7 +103,7 @@
* 2. IA: We know from {@link DashboardFeatureProvider} which page can be dynamically
* injected to where.
*/
- @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+ @VisibleForTesting
@WorkerThread
synchronized void init(Context context) {
if (mInitialized) {
@@ -159,7 +154,7 @@
continue;
}
// Build parent-child mPairs for all children listed under this key.
- for (Tile tile : category.tiles) {
+ for (Tile tile : category.getTiles()) {
final String childTitle = tile.title.toString();
String childClass = null;
if (tile.metaData != null) {
diff --git a/src/com/android/settings/dashboard/SummaryLoader.java b/src/com/android/settings/dashboard/SummaryLoader.java
index fe55be8..5af276c 100644
--- a/src/com/android/settings/dashboard/SummaryLoader.java
+++ b/src/com/android/settings/dashboard/SummaryLoader.java
@@ -216,7 +216,7 @@
if (category == null) {
return;
}
- for (Tile tile : category.tiles) {
+ for (Tile tile : category.getTiles()) {
final String key = mDashboardFeatureProvider.getDashboardKeyForTile(tile);
if (mSummaryTextMap.containsKey(key)) {
tile.summary = mSummaryTextMap.get(key);
@@ -250,12 +250,13 @@
}
private Tile getTileFromCategory(DashboardCategory category, ComponentName component) {
- if (category == null || category.tiles == null) {
+ if (category == null || category.getTilesCount() == 0) {
return null;
}
- final int tileCount = category.tiles.size();
+ final List<Tile> tiles = category.getTiles();
+ final int tileCount = tiles.size();
for (int j = 0; j < tileCount; j++) {
- final Tile tile = category.tiles.get(j);
+ final Tile tile = tiles.get(j);
if (component.equals(tile.intent.getComponent())) {
return tile;
}
@@ -291,10 +292,10 @@
case MSG_GET_CATEGORY_TILES_AND_SET_LISTENING:
final DashboardCategory category =
mDashboardFeatureProvider.getTilesForCategory(mCategoryKey);
- if (category == null || category.tiles == null) {
+ if (category == null || category.getTilesCount() == 0) {
return;
}
- final List<Tile> tiles = category.tiles;
+ final List<Tile> tiles = category.getTiles();
for (Tile tile : tiles) {
makeProviderW(tile);
}
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/AmbientDisplayAlwaysOnPreferenceController.java b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
index 2fb538e..9132daa 100644
--- a/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
+++ b/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceController.java
@@ -21,6 +21,7 @@
import android.provider.Settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
+import android.support.annotation.VisibleForTesting;
import com.android.internal.hardware.AmbientDisplayConfiguration;
import com.android.settings.R;
@@ -81,7 +82,7 @@
@Override
public boolean isAvailable() {
- return isAvailable(mConfig);
+ return alwaysOnAvailableForUser(mConfig);
}
public static boolean isAvailable(AmbientDisplayConfiguration config) {
@@ -102,4 +103,9 @@
ResultPayload.SettingsSource.SECURE, ON /* onValue */, intent, isAvailable(),
ON /* defaultValue */);
}
+
+ @VisibleForTesting
+ boolean alwaysOnAvailableForUser(AmbientDisplayConfiguration config) {
+ return isAvailable(config);
+ }
}
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/fuelgauge/FakeUid.java b/src/com/android/settings/fuelgauge/FakeUid.java
index 2c3e3cf..2b5afe1 100644
--- a/src/com/android/settings/fuelgauge/FakeUid.java
+++ b/src/com/android/settings/fuelgauge/FakeUid.java
@@ -51,6 +51,11 @@
}
@Override
+ public Timer getMulticastWakelockStats() {
+ return null;
+ }
+
+ @Override
public ArrayMap<String, ? extends Timer> getSyncStats() {
return null;
}
diff --git a/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java b/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
index d6291a8..2eb9f6a 100644
--- a/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
+++ b/src/com/android/settings/notification/EmergencyBroadcastPreferenceController.java
@@ -40,7 +40,6 @@
private AccountRestrictionHelper mHelper;
private UserManager mUserManager;
private PackageManager mPm;
- private boolean mCellBroadcastAppLinkEnabled;
public EmergencyBroadcastPreferenceController(Context context, String prefKey) {
this(context, new AccountRestrictionHelper(context), prefKey);
@@ -54,8 +53,6 @@
mHelper = helper;
mUserManager = (UserManager) context.getSystemService(Context.USER_SERVICE);
mPm = mContext.getPackageManager();
- // Enable link to CMAS app settings depending on the value in config.xml.
- mCellBroadcastAppLinkEnabled = isCellBroadcastAppLinkEnabled();
}
@Override
@@ -79,12 +76,13 @@
@Override
public boolean isAvailable() {
- return mUserManager.isAdminUser() && mCellBroadcastAppLinkEnabled
+ return mUserManager.isAdminUser() && isCellBroadcastAppLinkEnabled()
&& !mHelper.hasBaseUserRestriction(
UserManager.DISALLOW_CONFIG_CELL_BROADCASTS, UserHandle.myUserId());
}
private boolean isCellBroadcastAppLinkEnabled() {
+ // Enable link to CMAS app settings depending on the value in config.xml.
boolean enabled = mContext.getResources().getBoolean(
com.android.internal.R.bool.config_cellBroadcastAppLinks);
if (enabled) {
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/DatabaseIndexingManager.java b/src/com/android/settings/search/DatabaseIndexingManager.java
index 970b50f..0aeda66 100644
--- a/src/com/android/settings/search/DatabaseIndexingManager.java
+++ b/src/com/android/settings/search/DatabaseIndexingManager.java
@@ -19,20 +19,18 @@
import static com.android.settings.search.CursorToSearchResultConverter.COLUMN_INDEX_ID;
-import static com.android.settings.search.CursorToSearchResultConverter
- .COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE;
+import static com.android.settings.search.CursorToSearchResultConverter.COLUMN_INDEX_INTENT_ACTION_TARGET_PACKAGE;
import static com.android.settings.search.CursorToSearchResultConverter.COLUMN_INDEX_KEY;
import static com.android.settings.search.DatabaseResultLoader.SELECT_COLUMNS;
-import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DOCID;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.CLASS_NAME;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_ENTRIES;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_KEYWORDS;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_KEY_REF;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_SUMMARY_ON;
-import static com.android.settings.search.IndexDatabaseHelper.IndexColumns
- .DATA_SUMMARY_ON_NORMALIZED;
+import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_SUMMARY_ON_NORMALIZED;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_TITLE;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DATA_TITLE_NORMALIZED;
+import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.DOCID;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.ENABLED;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.ICON;
import static com.android.settings.search.IndexDatabaseHelper.IndexColumns.INTENT_ACTION;
@@ -55,6 +53,7 @@
import android.os.AsyncTask;
import android.os.Build;
import android.provider.SearchIndexablesContract;
+import android.provider.SearchIndexablesContract.SiteMapColumns;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.Log;
@@ -68,7 +67,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.Objects;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -276,17 +274,11 @@
if (!TextUtils.isEmpty(dataRow.className)
&& !TextUtils.isEmpty(dataRow.childClassName)) {
- ContentValues siteMapPair = new ContentValues();
- final int pairDocId = Objects.hash(dataRow.className, dataRow.childClassName);
- siteMapPair.put(IndexDatabaseHelper.SiteMapColumns.DOCID, pairDocId);
- siteMapPair.put(IndexDatabaseHelper.SiteMapColumns.PARENT_CLASS,
- dataRow.className);
- siteMapPair.put(IndexDatabaseHelper.SiteMapColumns.PARENT_TITLE,
- dataRow.screenTitle);
- siteMapPair.put(IndexDatabaseHelper.SiteMapColumns.CHILD_CLASS,
- dataRow.childClassName);
- siteMapPair.put(IndexDatabaseHelper.SiteMapColumns.CHILD_TITLE,
- dataRow.updatedTitle);
+ final ContentValues siteMapPair = new ContentValues();
+ siteMapPair.put(SiteMapColumns.PARENT_CLASS, dataRow.className);
+ siteMapPair.put(SiteMapColumns.PARENT_TITLE, dataRow.screenTitle);
+ siteMapPair.put(SiteMapColumns.CHILD_CLASS, dataRow.childClassName);
+ siteMapPair.put(SiteMapColumns.CHILD_TITLE, dataRow.updatedTitle);
database.replaceOrThrow(IndexDatabaseHelper.Tables.TABLE_SITE_MAP,
null /* nullColumnHack */, siteMapPair);
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/IndexDatabaseHelper.java b/src/com/android/settings/search/IndexDatabaseHelper.java
index b85b6c0..19e3419 100644
--- a/src/com/android/settings/search/IndexDatabaseHelper.java
+++ b/src/com/android/settings/search/IndexDatabaseHelper.java
@@ -22,6 +22,7 @@
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build;
+import android.provider.SearchIndexablesContract.SiteMapColumns;
import android.support.annotation.VisibleForTesting;
import android.text.TextUtils;
import android.util.Log;
@@ -33,7 +34,7 @@
private static final String TAG = "IndexDatabaseHelper";
private static final String DATABASE_NAME = "search_index.db";
- private static final int DATABASE_VERSION = 117;
+ private static final int DATABASE_VERSION = 118;
private static final String SHARED_PREFS_TAG = "indexing_manager";
@@ -80,14 +81,6 @@
String TIME_STAMP = "timestamp";
}
- public interface SiteMapColumns {
- String DOCID = "docid";
- String PARENT_CLASS = "parent_class";
- String CHILD_CLASS = "child_class";
- String PARENT_TITLE = "parent_title";
- String CHILD_TITLE = "child_title";
- }
-
private static final String CREATE_INDEX_TABLE =
"CREATE VIRTUAL TABLE " + Tables.TABLE_PREFS_INDEX + " USING fts4" +
"(" +
diff --git a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
index 968847b..0c98b9c 100644
--- a/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
+++ b/src/com/android/settings/search/SettingsSearchIndexablesProvider.java
@@ -40,16 +40,24 @@
import static android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS;
import static android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS;
import static android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS;
+import static android.provider.SearchIndexablesContract.SITE_MAP_COLUMNS;
+import static com.android.settings.dashboard.DashboardFragmentRegistry.CATEGORY_KEY_TO_PARENT_MAP;
import android.content.Context;
import android.database.Cursor;
import android.database.MatrixCursor;
import android.provider.SearchIndexableResource;
+import android.provider.SearchIndexablesContract;
import android.provider.SearchIndexablesProvider;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.Log;
+import com.android.settings.SettingsActivity;
+import com.android.settings.overlay.FeatureFactory;
+import com.android.settingslib.drawer.DashboardCategory;
+import com.android.settingslib.drawer.Tile;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -134,6 +142,38 @@
return cursor;
}
+ @Override
+ public Cursor querySiteMapPairs() {
+ final MatrixCursor cursor = new MatrixCursor(SITE_MAP_COLUMNS);
+ final Context context = getContext();
+ // Loop through all IA categories and pages and build additional SiteMapPairs
+ final List<DashboardCategory> categories = FeatureFactory.getFactory(context)
+ .getDashboardFeatureProvider(context).getAllCategories();
+ for (DashboardCategory category : categories) {
+ // Use the category key to look up parent (which page hosts this key)
+ final String parentClass = CATEGORY_KEY_TO_PARENT_MAP.get(category.key);
+ if (parentClass == null) {
+ continue;
+ }
+ // Build parent-child class pairs for all children listed under this key.
+ for (Tile tile : category.getTiles()) {
+ String childClass = null;
+ if (tile.metaData != null) {
+ childClass = tile.metaData.getString(
+ SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS);
+ }
+ if (childClass == null) {
+ continue;
+ }
+ cursor.newRow()
+ .add(SearchIndexablesContract.SiteMapColumns.PARENT_CLASS, parentClass)
+ .add(SearchIndexablesContract.SiteMapColumns.CHILD_CLASS, childClass);
+ }
+ }
+ // Done.
+ return cursor;
+ }
+
private List<String> getNonIndexableKeysFromProvider(Context context) {
final Collection<Class> values = SearchIndexableResources.providerValues();
final List<String> nonIndexableKeys = new ArrayList<>();
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/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 9f510d2..834166b 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -923,7 +923,7 @@
for (int userId : values[0]) {
Bitmap bitmap = mUserManager.getUserIcon(userId);
if (bitmap == null) {
- bitmap = getDefaultUserIconAsBitmap(userId);
+ bitmap = getDefaultUserIconAsBitmap(getContext().getResources(), userId);
}
mUserIcons.append(userId, bitmap);
}
@@ -934,7 +934,8 @@
private Drawable getEncircledDefaultIcon() {
if (mDefaultIconDrawable == null) {
- mDefaultIconDrawable = encircle(getDefaultUserIconAsBitmap(UserHandle.USER_NULL));
+ mDefaultIconDrawable = encircle(
+ getDefaultUserIconAsBitmap(getContext().getResources(), UserHandle.USER_NULL));
}
return mDefaultIconDrawable;
}
@@ -1038,14 +1039,16 @@
* Returns a default user icon (as a {@link Bitmap}) for the given user.
*
* Note that for guest users, you should pass in {@code UserHandle.USER_NULL}.
+ * @param resources resources object to fetch the user icon.
* @param userId the user id or {@code UserHandle.USER_NULL} for a non-user specific icon
*/
- private static Bitmap getDefaultUserIconAsBitmap(int userId) {
+ private static Bitmap getDefaultUserIconAsBitmap(Resources resources, int userId) {
Bitmap bitmap = null;
// Try finding the corresponding bitmap in the dark bitmap cache
bitmap = sDarkDefaultUserBitmapCache.get(userId);
if (bitmap == null) {
- bitmap = UserIcons.convertToBitmap(UserIcons.getDefaultUserIcon(userId, false));
+ bitmap = UserIcons.convertToBitmap(
+ UserIcons.getDefaultUserIcon(resources, userId, false));
// Save it to cache
sDarkDefaultUserBitmapCache.put(userId, bitmap);
}
@@ -1064,7 +1067,7 @@
return false;
}
UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
- Bitmap bitmap = getDefaultUserIconAsBitmap(userId);
+ Bitmap bitmap = getDefaultUserIconAsBitmap(context.getResources(), userId);
um.setUserIcon(userId, bitmap);
return true;
diff --git a/tests/robotests/res/values-mcc999/config.xml b/tests/robotests/res/values-mcc999/config.xml
index c2909ac..4113c90 100644
--- a/tests/robotests/res/values-mcc999/config.xml
+++ b/tests/robotests/res/values-mcc999/config.xml
@@ -15,7 +15,9 @@
-->
<resources>
+ <bool name="config_tintSettingIcon">false</bool>
<bool name="config_enableColorTemperature">false</bool>
<bool name="config_show_camera_laser_sensor">false</bool>
<bool name="config_show_connectivity_monitor">false</bool>
+ <bool name="config_display_recent_apps">false</bool>
</resources>
\ No newline at end of file
diff --git a/tests/robotests/res/values/config.xml b/tests/robotests/res/values/config.xml
index 9e2d911..4004106 100644
--- a/tests/robotests/res/values/config.xml
+++ b/tests/robotests/res/values/config.xml
@@ -20,4 +20,5 @@
<bool name="config_enableColorTemperature">true</bool>
<bool name="config_show_camera_laser_sensor">true</bool>
<bool name="config_show_connectivity_monitor">true</bool>
+ <bool name="config_display_recent_apps">true</bool>
</resources>
\ No newline at end of file
diff --git a/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java b/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java
index 5a798f9..55141f7 100644
--- a/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppAndNotificationDashboardFragmentTest.java
@@ -16,32 +16,35 @@
package com.android.settings.applications;
-import android.content.Context;
+import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
import android.os.UserManager;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settings.notification.EmergencyBroadcastPreferenceController;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.XmlTestUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
-import org.robolectric.util.ReflectionHelpers;
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
import java.util.List;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
-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 AppAndNotificationDashboardFragmentTest {
@Test
+ @Config(shadows = {ShadowEmergencyBroadcastPreferenceController.class})
public void testNonIndexableKeys_existInXmlLayout() {
final Context context = spy(RuntimeEnvironment.application);
UserManager manager = mock(UserManager.class);
@@ -56,4 +59,13 @@
assertThat(keys).containsAllIn(niks);
}
+
+ @Implements(EmergencyBroadcastPreferenceController.class)
+ public static class ShadowEmergencyBroadcastPreferenceController {
+
+ @Implementation
+ public boolean isAvailable() {
+ return true;
+ }
+ }
}
diff --git a/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java b/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
index 62395f3..75ae458 100644
--- a/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppInfoWithHeaderTest.java
@@ -16,6 +16,13 @@
package com.android.settings.applications;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.AlertDialog;
import android.content.BroadcastReceiver;
import android.content.Context;
@@ -49,14 +56,8 @@
import org.robolectric.shadows.ShadowApplication;
import org.robolectric.util.ReflectionHelpers;
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-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 = ShadowEntityHeaderController.class)
public class AppInfoWithHeaderTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
index 2e52214..b0f0d0c 100644
--- a/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppPermissionsPreferenceControllerTest.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 AppPermissionsPreferenceControllerTest {
private static final String PERM_LOCATION = "android.permission-group.LOCATION";
diff --git a/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java b/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
index d63697e..6fadb43 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStateAppOpsBridgeTest.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 final class AppStateAppOpsBridgeTest {
@Mock private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java b/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java
index 62623e5..c88f878 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStateInstallAppsBridgeTest.java
@@ -28,7 +28,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 AppStateInstallAppsBridgeTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java b/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java
index 1f6aea4..d254074 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStorageSettingsTest.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 AppStorageSettingsTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java b/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java
index 027bd33..62cb26c 100644
--- a/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppStorageSizesControllerTest.java
@@ -8,8 +8,10 @@
import android.content.Context;
import android.support.v7.preference.Preference;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settings.R;
import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
+import com.android.settingslib.applications.StorageStatsSource.AppStorageStats;
import org.junit.Before;
import org.junit.Test;
@@ -18,11 +20,8 @@
import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
-import com.android.settings.R;
-import com.android.settingslib.applications.StorageStatsSource.AppStorageStats;
-
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppStorageSizesControllerTest {
private static final String COMPUTING = "Computing…";
private static final String INVALID_SIZE = "Couldn’t compute package size.";
@@ -85,9 +84,9 @@
mController.setResult(result);
mController.updateUi(mContext);
- assertThat(mAppPreference.getSummary()).isEqualTo("1.00 B");
- assertThat(mCachePreference.getSummary()).isEqualTo("10.00 B");
- assertThat(mDataPreference.getSummary()).isEqualTo("90.00 B");
+ assertThat(mAppPreference.getSummary()).isEqualTo("1 B");
+ assertThat(mCachePreference.getSummary()).isEqualTo("10 B");
+ assertThat(mDataPreference.getSummary()).isEqualTo("90 B");
assertThat(mTotalPreference.getSummary()).isEqualTo("101 B");
}
@@ -103,10 +102,10 @@
mController.setCacheCleared(true);
mController.updateUi(mContext);
- assertThat(mAppPreference.getSummary()).isEqualTo("1.00 B");
- assertThat(mCachePreference.getSummary()).isEqualTo("0.00 B");
- assertThat(mDataPreference.getSummary()).isEqualTo("90.00 B");
- assertThat(mTotalPreference.getSummary()).isEqualTo("91.00 B");
+ assertThat(mAppPreference.getSummary()).isEqualTo("1 B");
+ assertThat(mCachePreference.getSummary()).isEqualTo("0 B");
+ assertThat(mDataPreference.getSummary()).isEqualTo("90 B");
+ assertThat(mTotalPreference.getSummary()).isEqualTo("91 B");
}
@Test
@@ -121,9 +120,9 @@
mController.setDataCleared(true);
mController.updateUi(mContext);
- assertThat(mAppPreference.getSummary()).isEqualTo("1.00 B");
- assertThat(mCachePreference.getSummary()).isEqualTo("0.00 B");
- assertThat(mDataPreference.getSummary()).isEqualTo("0.00 B");
- assertThat(mTotalPreference.getSummary()).isEqualTo("1.00 B");
+ assertThat(mAppPreference.getSummary()).isEqualTo("1 B");
+ assertThat(mCachePreference.getSummary()).isEqualTo("0 B");
+ assertThat(mDataPreference.getSummary()).isEqualTo("0 B");
+ assertThat(mTotalPreference.getSummary()).isEqualTo("1 B");
}
}
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
index 33d261f..eb3d94f 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsCounterTest.java
@@ -56,7 +56,7 @@
* Tests for {@link InstalledAppCounter}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AppWithAdminGrantedPermissionsCounterTest {
private final String APP_1 = "app1";
diff --git a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
index 2e9328a..d7c8059 100644
--- a/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/AppWithAdminGrantedPermissionsListerTest.java
@@ -55,7 +55,7 @@
* Tests for {@link AppWithAdminGrantedPermissionsLister}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AppWithAdminGrantedPermissionsListerTest {
private final String APP_1 = "app1";
diff --git a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
index e5b7a66..dad02ef 100644
--- a/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/applications/ApplicationFeatureProviderImplTest.java
@@ -55,7 +55,7 @@
* Tests for {@link ApplicationFeatureProviderImpl}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUserManager.class})
public final class ApplicationFeatureProviderImplTest {
diff --git a/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java b/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
index 9441707..78ec265 100644
--- a/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/DefaultAppSettingsTest.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 DefaultAppSettingsTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java b/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java
index 5d20a4c..38c0128 100644
--- a/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/DrawOverlayDetailsTest.java
@@ -46,7 +46,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 DrawOverlayDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java b/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java
index 10caf13..8014dbb 100644
--- a/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/EnterpriseDefaultAppsTest.java
@@ -27,7 +27,7 @@
import static junit.framework.Assert.assertTrue;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class EnterpriseDefaultAppsTest {
@Test
public void testNumberOfIntentsCorrelateWithUI() throws Exception {
diff --git a/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java b/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java
index 3269acb..d34b2eb 100644
--- a/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/FetchPackageStorageAsyncLoaderTest.java
@@ -44,7 +44,7 @@
import java.io.IOException;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FetchPackageStorageAsyncLoaderTest {
private static final String PACKAGE_NAME = "com.test.package";
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
index 58c4386..def8758 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppCounterTest.java
@@ -61,7 +61,7 @@
* Tests for {@link InstalledAppCounter}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {ShadowUserManager.class})
public final class InstalledAppCounterTest {
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java
index 58a9577..b8a27b9 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppDetailsTest.java
@@ -17,6 +17,7 @@
package com.android.settings.applications;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.ArgumentMatchers.nullable;
import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.anyInt;
@@ -83,9 +84,9 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
- manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
- shadows = InstalledAppDetailsTest.ShadowUtils.class
+ manifest = TestConfig.MANIFEST_PATH,
+ sdk = TestConfig.SDK_VERSION_O,
+ shadows = InstalledAppDetailsTest.ShadowUtils.class
)
public final class InstalledAppDetailsTest {
@@ -192,7 +193,7 @@
when(stats.getTotalBytes()).thenReturn(1L);
assertThat(InstalledAppDetails.getStorageSummary(context, stats, true))
- .isEqualTo("1.00 B used in external storage");
+ .isEqualTo("1 B used in external storage");
}
@Test
@@ -202,7 +203,7 @@
when(stats.getTotalBytes()).thenReturn(1L);
assertThat(InstalledAppDetails.getStorageSummary(context, stats, false))
- .isEqualTo("1.00 B used in internal storage");
+ .isEqualTo("1 B used in internal storage");
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java b/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java
index c74deae..6a5cfeb 100644
--- a/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/InstalledAppListerTest.java
@@ -57,7 +57,7 @@
* Tests for {@link InstalledAppLister}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class InstalledAppListerTest {
private final String APP_1 = "app1";
diff --git a/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java b/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java
index 11d757f..735a811 100644
--- a/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/NotificationAppsTest.java
@@ -49,7 +49,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 NotificationAppsTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java b/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java
index 02b8c7a..b998b81e 100644
--- a/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/PictureInPictureDetailsTest.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 PictureInPictureDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java b/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java
index d379dbd..85b398a 100644
--- a/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/PictureInPictureSettingsTest.java
@@ -51,7 +51,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 PictureInPictureSettingsTest {
private static final int PRIMARY_USER_ID = 0;
diff --git a/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java b/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java
index 30ebcde..dedb61d 100644
--- a/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java
+++ b/tests/robotests/src/com/android/settings/applications/PremiumSmsAccessTest.java
@@ -38,7 +38,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 PremiumSmsAccessTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
index 5e85f9b..d0d8a3b 100644
--- a/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/RecentAppsPreferenceControllerTest.java
@@ -16,13 +16,30 @@
package com.android.settings.applications;
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Matchers.anyString;
+import static org.mockito.Matchers.argThat;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
import android.app.Application;
import android.app.usage.UsageStats;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.Intent;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
-import android.content.res.Configuration;
import android.os.UserHandle;
import android.os.UserManager;
import android.support.v7.preference.Preference;
@@ -31,14 +48,13 @@
import android.text.TextUtils;
import com.android.settings.R;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.applications.ApplicationsState;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
-import org.mockito.Answers;
import org.mockito.ArgumentMatcher;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
@@ -47,25 +63,9 @@
import java.util.ArrayList;
import java.util.List;
-import java.util.Locale;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyInt;
-import static org.mockito.Matchers.anyLong;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-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 RecentAppsPreferenceControllerTest {
@Mock
@@ -76,14 +76,18 @@
private Preference mSeeAllPref;
@Mock
private PreferenceCategory mDivider;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Context mMockContext;
@Mock
private UsageStatsManager mUsageStatsManager;
@Mock
private UserManager mUserManager;
@Mock
private ApplicationsState mAppState;
+ @Mock
+ private PackageManager mPackageManager;
+ @Mock
+ private ApplicationsState.AppEntry mAppEntry;
+ @Mock
+ private ApplicationInfo mApplicationInfo;
private Context mContext;
private RecentAppsPreferenceController mController;
@@ -91,12 +95,11 @@
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- when(mMockContext.getSystemService(Context.USAGE_STATS_SERVICE))
- .thenReturn(mUsageStatsManager);
- when(mMockContext.getSystemService(Context.USER_SERVICE))
- .thenReturn(mUserManager);
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mUsageStatsManager).when(mContext).getSystemService(Context.USAGE_STATS_SERVICE);
+ doReturn(mUserManager).when(mContext).getSystemService(Context.USER_SERVICE);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
- mContext = RuntimeEnvironment.application;
mController = new RecentAppsPreferenceController(mContext, mAppState, null);
when(mScreen.findPreference(anyString())).thenReturn(mCategory);
@@ -125,7 +128,7 @@
@Test
public void onDisplayAndUpdateState_shouldRefreshUi() {
mController = spy(
- new RecentAppsPreferenceController(mMockContext, (Application) null, null));
+ new RecentAppsPreferenceController(mContext, (Application) null, null));
doNothing().when(mController).refreshUi(mContext);
@@ -136,11 +139,8 @@
}
@Test
+ @Config(qualifiers = "mcc999")
public void display_shouldNotShowRecents_showAppInfoPreference() {
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(false);
-
mController.displayPreference(mScreen);
verify(mCategory, never()).addPreference(any(Preference.class));
@@ -152,8 +152,6 @@
@Test
public void display_showRecents() {
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(true);
final List<UsageStats> stats = new ArrayList<>();
final UsageStats stat1 = new UsageStats();
final UsageStats stat2 = new UsageStats();
@@ -172,20 +170,17 @@
// stat1, stat2 are valid apps. stat3 is invalid.
when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
- .thenReturn(mock(ApplicationsState.AppEntry.class));
+ .thenReturn(mAppEntry);
when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
- .thenReturn(mock(ApplicationsState.AppEntry.class));
+ .thenReturn(mAppEntry);
when(mAppState.getEntry(stat3.mPackageName, UserHandle.myUserId()))
.thenReturn(null);
- when(mMockContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
- .thenReturn(new ResolveInfo());
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
.thenReturn(stats);
- final Configuration configuration = new Configuration();
- configuration.locale = Locale.US;
- when(mMockContext.getResources().getConfiguration()).thenReturn(configuration);
+ mAppEntry.info = mApplicationInfo;
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
mController.displayPreference(mScreen);
verify(mCategory).setTitle(R.string.recent_app_category_title);
@@ -200,8 +195,6 @@
@Test
public void display_hasRecentButNoneDisplayable_showAppInfo() {
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(true);
final List<UsageStats> stats = new ArrayList<>();
final UsageStats stat1 = new UsageStats();
final UsageStats stat2 = new UsageStats();
@@ -218,12 +211,11 @@
.thenReturn(mock(ApplicationsState.AppEntry.class));
when(mAppState.getEntry(stat2.mPackageName, UserHandle.myUserId()))
.thenReturn(mock(ApplicationsState.AppEntry.class));
- when(mMockContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
- .thenReturn(new ResolveInfo());
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
.thenReturn(stats);
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
mController.displayPreference(mScreen);
verify(mCategory, never()).addPreference(any(Preference.class));
@@ -234,8 +226,6 @@
@Test
public void display_showRecents_formatSummary() {
- when(mMockContext.getResources().getBoolean(R.bool.config_display_recent_apps))
- .thenReturn(true);
final List<UsageStats> stats = new ArrayList<>();
final UsageStats stat1 = new UsageStats();
stat1.mLastTimeUsed = System.currentTimeMillis();
@@ -243,17 +233,13 @@
stats.add(stat1);
when(mAppState.getEntry(stat1.mPackageName, UserHandle.myUserId()))
- .thenReturn(mock(ApplicationsState.AppEntry.class));
- when(mMockContext.getPackageManager().resolveActivity(any(Intent.class), anyInt()))
- .thenReturn(new ResolveInfo());
+ .thenReturn(mAppEntry);
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
when(mUsageStatsManager.queryUsageStats(anyInt(), anyLong(), anyLong()))
- .thenReturn(stats);
+ .thenReturn(stats);
+ mAppEntry.info = mApplicationInfo;
- final Configuration configuration = new Configuration();
- configuration.locale = Locale.US;
- when(mMockContext.getResources().getConfiguration()).thenReturn(configuration);
-
- mController = new RecentAppsPreferenceController(mMockContext, mAppState, null);
mController.displayPreference(mScreen);
verify(mCategory).addPreference(argThat(summaryMatches("0 min. ago")));
diff --git a/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java
index f17addd..09bfc29 100644
--- a/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/SpecialAppAccessPreferenceControllerTest.java
@@ -36,7 +36,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 SpecialAppAccessPreferenceControllerTest {
private Context mContext;
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java b/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java
index 1a3aeb5..64ef4ff 100644
--- a/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/UsageAccessDetailsTest.java
@@ -41,7 +41,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 UsageAccessDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java b/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java
index d2f1bbd..5f9ec95 100644
--- a/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/VrListenerSettingsTest.java
@@ -36,7 +36,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 VrListenerSettingsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java b/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java
index a995394..6cd07e3 100644
--- a/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/WriteSettingsDetailsTest.java
@@ -36,7 +36,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 WriteSettingsDetailsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java
index d4cd6da..0b933c6 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppInfoTest.java
@@ -17,11 +17,17 @@
package com.android.settings.applications.defaultapps;
import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.ApplicationInfo;
import android.content.pm.PackageItemInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
@@ -39,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 DefaultAppInfoTest {
@Mock
@@ -50,15 +56,24 @@
private PackageManager mPackageManager;
@Mock
private PackageManagerWrapper mPackageManagerWrapper;
+ @Mock
+ private ApplicationInfo mApplicationInfo;
+ @Mock
+ private Drawable mIcon;
private Context mContext;
private DefaultAppInfo mInfo;
@Before
- public void setUp() {
+ public void setUp() throws PackageManager.NameNotFoundException {
MockitoAnnotations.initMocks(this);
- mContext = RuntimeEnvironment.application;
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
when(mPackageManagerWrapper.getPackageManager()).thenReturn(mPackageManager);
+ when(mPackageManagerWrapper.getApplicationInfoAsUser(anyString(), anyInt(),
+ anyInt())).thenReturn(mApplicationInfo);
+ when(mPackageManager.loadUnbadgedItemIcon(mPackageItemInfo, mApplicationInfo)).thenReturn(
+ mIcon);
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java
index 42a6225..804df51 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPickerFragmentTest.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 DefaultAppPickerFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java
index a02a2de..f16c05e 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAppPreferenceControllerTest.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 DefaultAppPreferenceControllerTest {
private static final String TEST_APP_NAME = "test";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
index 06d3b8b..61d7f34 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPickerTest.java
@@ -43,7 +43,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 DefaultAutofillPickerTest {
private static final String TEST_APP_KEY = "foo.bar/foo.bar.Baz";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
index bc72ee4..8a181d8 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultAutofillPreferenceControllerTest.java
@@ -46,7 +46,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 DefaultAutofillPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java
index e8a6c1e..934c4c6 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPickerTest.java
@@ -39,7 +39,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 DefaultBrowserPickerTest {
private static final String TEST_APP_KEY = "";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
index 8d527ff..b3406a1 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultBrowserPreferenceControllerTest.java
@@ -48,7 +48,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 DefaultBrowserPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
index 124817a..d499ac2 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultEmergencyPickerTest.java
@@ -41,7 +41,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 DefaultEmergencyPickerTest {
private static final String TEST_APP_KEY = "test_app";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java
index 4b82f1a..4680a08 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePickerTest.java
@@ -59,7 +59,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 DefaultHomePickerTest {
private static final String TEST_APP_KEY = "com.android.settings/DefaultEmergencyPickerTest";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
index 8a8cc29..cf19655 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultHomePreferenceControllerTest.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 DefaultHomePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java
index 6a73269..025d50a 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPaymentSettingsPreferenceControllerTest.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 DefaultPaymentSettingsPreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java
index f2b7db8..b1bea25 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultPhonePickerTest.java
@@ -43,7 +43,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 DefaultPhonePickerTest {
private static final String TEST_APP_KEY = "com.android.settings/PickerTest";
diff --git a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java
index 91e68ea..e9bdfe3 100644
--- a/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/defaultapps/DefaultSmsPickerTest.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 DefaultSmsPickerTest {
private static final String TEST_APP_KEY = "com.android.settings/PickerTest";
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java
index 982fb56..2dde6f4 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterItemTest.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 AppFilterItemTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java
index 3fe5e67..ccd8470 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/AppFilterRegistryTest.java
@@ -60,7 +60,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 AppFilterRegistryTest {
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
index c32b262..ebc0ddc 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ApplicationViewHolderTest.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 ApplicationViewHolderTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
index dfe8e4c..d208194 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/ManageApplicationsTest.java
@@ -73,7 +73,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
// TODO: Consider making the shadow class set global using a robolectric.properties file.
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java
index fc761cc..c7f2f53 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/MusicViewHolderControllerTest.java
@@ -17,6 +17,7 @@
package com.android.settings.applications.manageapplications;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.nullable;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -27,6 +28,7 @@
import android.os.UserHandle;
import android.os.storage.VolumeInfo;
import android.provider.DocumentsContract;
+import android.text.format.Formatter;
import android.view.View;
import android.widget.FrameLayout;
@@ -46,7 +48,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 MusicViewHolderControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Fragment mFragment;
@@ -75,7 +77,8 @@
public void storageShouldBeZeroBytesIfQueriedBeforeStorageQueryFinishes() {
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("0.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 0));
}
@Test
@@ -86,7 +89,8 @@
mController.queryStats();
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("1.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 1));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java b/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java
index 0a147ac..fd25921 100644
--- a/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java
+++ b/tests/robotests/src/com/android/settings/applications/manageapplications/PhotosViewHolderControllerTest.java
@@ -17,6 +17,7 @@
package com.android.settings.applications.manageapplications;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.nullable;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -26,6 +27,7 @@
import android.content.Intent;
import android.os.UserHandle;
import android.os.storage.VolumeInfo;
+import android.text.format.Formatter;
import android.view.View;
import android.widget.FrameLayout;
@@ -44,11 +46,12 @@
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 PhotosViewHolderControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Fragment mFragment;
- @Mock private StorageStatsSource mSource;
+ @Mock
+ private StorageStatsSource mSource;
private Context mContext;
private PhotosViewHolderController mController;
@@ -74,7 +77,8 @@
public void storageShouldBeZeroBytesIfQueriedBeforeStorageQueryFinishes() {
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("0.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 0));
}
@Test
@@ -85,7 +89,8 @@
mController.queryStats();
mController.setupView(mHolder);
- assertThat(mHolder.mSummary.getText().toString()).isEqualTo("11.00 B");
+ assertThat(mHolder.mSummary.getText().toString()).isEqualTo(
+ Formatter.formatFileSize(mContext, 11));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
index 5fc3ebc..39cc9a2 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityPreferenceControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Implements;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsActivityPreferenceControllerTest.ShadowBackupManager.class})
public class BackupSettingsActivityPreferenceControllerTest {
private static final String KEY_BACKUP_SETTINGS = "backup_settings";
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
index 44c7e10..cf3cb53 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsActivityTest.java
@@ -58,7 +58,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsActivityTest.ShadowBackupSettingsHelper.class,
BackupSettingsActivityTest.ShadowUserHandle.class})
public class BackupSettingsActivityTest {
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
index 9de0c6a..eb33cd6 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsHelperTest.java
@@ -50,7 +50,7 @@
import com.android.settingslib.drawer.SettingsDrawerActivity;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsHelperTest.ShadowBackupManagerStub.class})
public class BackupSettingsHelperTest {
diff --git a/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java
index 3ad49e7..83d9709 100644
--- a/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/backup/BackupSettingsPreferenceControllerTest.java
@@ -41,7 +41,7 @@
import android.support.v7.preference.PreferenceScreen;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {BackupSettingsPreferenceControllerTest.ShadowBackupSettingsHelper.class})
public class BackupSettingsPreferenceControllerTest {
private static final String BACKUP_SETTINGS = "backup_settings";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java b/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
index fd46b4b..3cc90bd 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/AlwaysDiscoverableTest.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 AlwaysDiscoverableTest {
@Mock
private LocalBluetoothAdapter mLocalAdapter;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
index 7b0a3f23..e7ce7e0 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsButtonsControllerTest.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,
shadows = SettingsShadowBluetoothDevice.class)
public class BluetoothDetailsButtonsControllerTest extends BluetoothDetailsControllerTestBase {
private BluetoothDetailsButtonsController mController;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
index 33a5ed5..b03ecc1 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDetailsControllerTestBase.java
@@ -28,14 +28,20 @@
import android.support.v7.preference.PreferenceScreen;
import com.android.settings.R;
+import com.android.settings.TestConfig;
+import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.core.lifecycle.Lifecycle;
import org.junit.Before;
+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 BluetoothDetailsControllerTestBase {
protected Context mContext;
protected Lifecycle mLifecycle;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
index 544b590..cd07a90 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceDetailsFragmentTest.java
@@ -53,7 +53,7 @@
import org.robolectric.fakes.RoboMenu;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothDeviceDetailsFragmentTest {
private BluetoothDeviceDetailsFragment mFragment;
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java
index 2e094e2..93de52d 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceNamePreferenceControllerTest.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 BluetoothDeviceNamePreferenceControllerTest {
private static final String DEVICE_NAME = "Nightshade";
private static final int ORDER = 1;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
index bc1151b..3dd97bb 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDevicePreferenceTest.java
@@ -49,7 +49,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 = SettingsShadowResources.class)
public class BluetoothDevicePreferenceTest {
private static final boolean SHOW_DEVICES_WITHOUT_NAMES = true;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java
index cde95cd..186e274 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothDeviceRenamePreferenceControllerTest.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 BluetoothDeviceRenamePreferenceControllerTest {
private static final String DEVICE_NAME = "Nightshade";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
index b973edb..102f0a7 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothEnablerTest.java
@@ -58,7 +58,7 @@
import static org.mockito.Mockito.when;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows = {
SettingsShadowResources.class, SettingsShadowResources.SettingsShadowTheme.class
})
public class BluetoothEnablerTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
index cdaf876..ed63fc4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothFilesPreferenceControllerTest.java
@@ -35,7 +35,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 BluetoothFilesPreferenceControllerTest {
private Context mContext;
private BluetoothFilesPreferenceController mController;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java
index c9d5746..534cace 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothMasterSwitchPreferenceControllerTest.java
@@ -47,7 +47,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 BluetoothMasterSwitchPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
index d1d4935..2b30ae4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDetailTest.java
@@ -52,7 +52,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 BluetoothPairingDetailTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
index fba11de..25a24d4 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingDialogTest.java
@@ -53,7 +53,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows=ShadowEventLogWriter.class)
public class BluetoothPairingDialogTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java
index 4459f61..192e447 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothPairingPreferenceControllerTest.java
@@ -49,7 +49,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 BluetoothPairingPreferenceControllerTest {
private static final int ORDER = 1;
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java
index 0061ee5..e7a66fa 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsSummaryProviderTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothSettingsSummaryProviderTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java
index c772560..b177729 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSettingsTest.java
@@ -50,7 +50,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 BluetoothSettingsTest {
private static final String FOOTAGE_MAC_STRING = "Bluetooth mac: xxxx";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java
index 0c27412..cb04347 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/BluetoothSummaryUpdaterTest.java
@@ -51,7 +51,7 @@
import java.util.Set;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BluetoothSummaryUpdaterTest {
private static final String DEVICE_NAME = "Nightshade";
private static final String DEVICE_KEYBOARD_NAME = "Bluetooth Keyboard";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
index 49efecb..169db24 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DeviceListPreferenceFragmentTest.java
@@ -49,7 +49,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 DeviceListPreferenceFragmentTest {
private static final String FOOTAGE_MAC_STRING = "Bluetooth mac: xxxx";
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
index 3294ffd..f9b392e 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DevicePickerFragmentTest.java
@@ -30,7 +30,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 DevicePickerFragmentTest {
@Mock
private LocalBluetoothAdapter mLocalAdapter;
diff --git a/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java b/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java
index a6793bb..56454b8 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/DeviceProfilesSettingsTest.java
@@ -56,7 +56,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows = {
ShadowEventLogWriter.class
})
public class DeviceProfilesSettingsTest {
diff --git a/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
index 9343721..71e9933 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/ForgetDeviceDialogFragmentTest.java
@@ -46,7 +46,7 @@
import org.robolectric.shadows.ShadowDialog;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ForgetDeviceDialogFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
index a8ef4e6..65fe46c 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/RemoteDeviceNameDialogFragmentTest.java
@@ -50,7 +50,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class RemoteDeviceNameDialogFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
index e0d4638..43583ed 100644
--- a/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
+++ b/tests/robotests/src/com/android/settings/bluetooth/UtilsTest.java
@@ -41,7 +41,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 = SettingsShadowResources.class)
public class UtilsTest {
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
index de83f5e..4bcb299 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/ConnectedDeviceDashboardFragment2Test.java
@@ -50,7 +50,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 ConnectedDeviceDashboardFragment2Test {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java
index 7edde6e..59a5172 100644
--- a/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/connecteddevice/UsbModePreferenceControllerTest.java
@@ -26,7 +26,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 UsbModePreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
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/dashboard/DashboardAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
index 14da5d6..fdb1470 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardAdapterTest.java
@@ -68,7 +68,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class,
@@ -222,14 +222,12 @@
doReturn(mockTypedArray).when(mContext).obtainStyledAttributes(any(int[].class));
doReturn(0x89000000).when(mockTypedArray).getColor(anyInt(), anyInt());
- final DashboardCategory category = mock(DashboardCategory.class);
- final List<Tile> tiles = new ArrayList<>();
+ final DashboardCategory category = new DashboardCategory();
final Icon mockIcon = mock(Icon.class);
final Tile tile = new Tile();
tile.isIconTintable = true;
tile.icon = mockIcon;
- tiles.add(tile);
- category.tiles = tiles;
+ category.addTile(tile);
mDashboardAdapter.setCategory(category);
@@ -250,10 +248,8 @@
public void testBindConditionAndSuggestion_shouldSetSuggestionAdapterAndNoCrash() {
mDashboardAdapter = new DashboardAdapter(mContext, null, null, null, null, null);
final List<Tile> suggestions = makeSuggestions("pkg1");
- final DashboardCategory category = mock(DashboardCategory.class);
- final List<Tile> tiles = new ArrayList<>();
- tiles.add(mock(Tile.class));
- category.tiles = tiles;
+ final DashboardCategory category = new DashboardCategory();
+ category.addTile(mock(Tile.class));
mDashboardAdapter.setCategoriesAndSuggestions(category, suggestions);
@@ -277,10 +273,8 @@
public void testBindConditionAndSuggestion_v2_shouldSetSuggestionAdapterAndNoCrash() {
mDashboardAdapter = new DashboardAdapter(mContext, null, null, null, null, null);
final List<Suggestion> suggestions = makeSuggestionsV2("pkg1");
- final DashboardCategory category = mock(DashboardCategory.class);
- final List<Tile> tiles = new ArrayList<>();
- tiles.add(mock(Tile.class));
- category.tiles = tiles;
+ final DashboardCategory category = new DashboardCategory();
+ category.addTile(mock(Tile.class));
mDashboardAdapter.setSuggestionsV2(suggestions);
@@ -310,10 +304,8 @@
null /* SuggestionDismissController.Callback */);
final List<Tile> suggestions = new ArrayList<>();
- final DashboardCategory category = mock(DashboardCategory.class);
- final List<Tile> tiles = new ArrayList<>();
- tiles.add(mock(Tile.class));
- category.tiles = tiles;
+ final DashboardCategory category = new DashboardCategory();
+ category.addTile(mock(Tile.class));
mDashboardAdapter.setCategoriesAndSuggestions(category, suggestions);
final RecyclerView data = mock(RecyclerView.class);
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
index cc4f741..33f379e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardDataTest.java
@@ -49,7 +49,7 @@
import java.util.Objects;
@RunWith(RobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DashboardDataTest {
private static final String TEST_SUGGESTION_TITLE = "Use fingerprint";
private static final String TEST_CATEGORY_TILE_TITLE = "Display";
@@ -57,13 +57,12 @@
private DashboardData mDashboardDataWithOneConditions;
private DashboardData mDashboardDataWithTwoConditions;
private DashboardData mDashboardDataWithNoItems;
+ private DashboardCategory mDashboardCategory;
@Mock
private Tile mTestCategoryTile;
@Mock
private Tile mTestSuggestion;
@Mock
- private DashboardCategory mDashboardCategory;
- @Mock
private Condition mTestCondition;
@Mock
private Condition mSecondCondition; // condition used to test insert in DiffUtil
@@ -72,6 +71,8 @@
public void SetUp() {
MockitoAnnotations.initMocks(this);
+ mDashboardCategory = new DashboardCategory();
+
// Build suggestions
final List<Tile> suggestions = new ArrayList<>();
mTestSuggestion.title = TEST_SUGGESTION_TITLE;
@@ -91,8 +92,8 @@
// Build category
mTestCategoryTile.title = TEST_CATEGORY_TILE_TITLE;
mDashboardCategory.title = "test";
- mDashboardCategory.tiles = new ArrayList<>();
- mDashboardCategory.tiles.add(mTestCategoryTile);
+
+ mDashboardCategory.addTile(mTestCategoryTile);
// Build DashboardData
mDashboardDataWithOneConditions = new DashboardData.Builder()
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
index a977872..3d36e6f 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java
@@ -17,10 +17,13 @@
package com.android.settings.dashboard;
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.robolectric.RuntimeEnvironment.application;
@@ -30,7 +33,8 @@
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
-import android.content.res.Resources;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
import android.graphics.Bitmap;
import android.graphics.drawable.Icon;
import android.os.Bundle;
@@ -60,6 +64,7 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.robolectric.Robolectric;
+import org.robolectric.RuntimeEnvironment;
import org.robolectric.annotation.Config;
import org.robolectric.shadows.ShadowActivity;
import org.robolectric.shadows.ShadowApplication;
@@ -69,7 +74,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowUserManager.class)
public class DashboardFeatureProviderImplTest {
@@ -79,21 +84,28 @@
private UserManager mUserManager;
@Mock
private CategoryManager mCategoryManager;
+ @Mock
+ private PackageManager mPackageManager;
private FakeFeatureFactory mFeatureFactory;
+ private Context mContext;
private DashboardFeatureProviderImpl mImpl;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
+ when(mPackageManager.resolveActivity(any(Intent.class), anyInt())).thenReturn(
+ new ResolveInfo());
FakeFeatureFactory.setupForTest(mActivity);
mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mActivity);
- mImpl = new DashboardFeatureProviderImpl(mActivity);
+ mImpl = new DashboardFeatureProviderImpl(mContext);
}
@Test
public void shouldHoldAppContext() {
- assertThat(mImpl.mContext).isEqualTo(mActivity.getApplicationContext());
+ assertThat(mImpl.mContext).isEqualTo(mContext.getApplicationContext());
}
@Test
@@ -342,7 +354,7 @@
}
@Test
- public void bindPreference_withIntentActionMetatdata_shouldSetLaunchAction() {
+ public void bindPreference_withIntentActionMetadata_shouldSetLaunchAction() {
Activity activity = Robolectric.buildActivity(Activity.class).get();
final ShadowApplication application = ShadowApplication.getInstance();
final Preference preference = new Preference(application.getApplicationContext());
@@ -419,7 +431,7 @@
mImpl = new DashboardFeatureProviderImpl(mActivity);
ReflectionHelpers.setField(mImpl, "mCategoryManager", mCategoryManager);
final DashboardCategory category = new DashboardCategory();
- category.tiles.add(new Tile());
+ category.addTile(new Tile());
when(mCategoryManager
.getTilesByCategory(any(Context.class), eq(CategoryKey.CATEGORY_HOMEPAGE)))
.thenReturn(category);
@@ -437,14 +449,13 @@
}
@Test
- public void testShouldTintIcon_shouldReturnValueFromResource() {
- final Resources res = mActivity.getApplicationContext().getResources();
- when(res.getBoolean(R.bool.config_tintSettingIcon))
- .thenReturn(false);
- assertThat(mImpl.shouldTintIcon()).isFalse();
-
- when(res.getBoolean(R.bool.config_tintSettingIcon))
- .thenReturn(true);
+ public void testShouldTintIcon_enabledInResources_shouldBeTrue() {
assertThat(mImpl.shouldTintIcon()).isTrue();
}
+
+ @Test
+ @Config(qualifiers = "mcc999")
+ public void testShouldTintIcon_disabledInResources_shouldBeFalse() {
+ assertThat(mImpl.shouldTintIcon()).isFalse();
+ }
}
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
index 9ba0807..14f3078 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardFragmentTest.java
@@ -58,15 +58,14 @@
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 DashboardFragmentTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
private Context mContext;
@Mock
- private DashboardCategory mDashboardCategory;
- @Mock
private FakeFeatureFactory mFakeFeatureFactory;
+ private DashboardCategory mDashboardCategory;
private TestFragment mTestFragment;
@Before
@@ -74,8 +73,8 @@
MockitoAnnotations.initMocks(this);
FakeFeatureFactory.setupForTest(mContext);
mFakeFeatureFactory = (FakeFeatureFactory) FeatureFactory.getFactory(mContext);
- mDashboardCategory.tiles = new ArrayList<>();
- mDashboardCategory.tiles.add(new Tile());
+ mDashboardCategory = new DashboardCategory();
+ mDashboardCategory.addTile(new Tile());
mTestFragment = new TestFragment(ShadowApplication.getInstance().getApplicationContext());
when(mFakeFeatureFactory.dashboardFeatureProvider
.getTilesForCategory(nullable(String.class)))
@@ -117,7 +116,7 @@
@Test
public void displayTilesAsPreference_withEmptyCategory_shouldNotAddTiles() {
- mDashboardCategory.tiles = null;
+ mDashboardCategory.removeTile(0);
mTestFragment.onCreatePreferences(new Bundle(), "rootKey");
verify(mTestFragment.mScreen, never()).addPreference(nullable(Preference.class));
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
index cda9a22..bb24435 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardItemAnimatorTest.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 DashboardItemAnimatorTest {
private DashboardItemAnimator mDashboardItemAnimator;
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
index f3ed57c..2437565 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardSummaryTest.java
@@ -47,7 +47,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 DashboardSummaryTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java
index c48f30c..6ea3222 100644
--- a/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/DashboardTilePlaceholderPreferenceControllerTest.java
@@ -37,7 +37,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 DashboardTilePlaceholderPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java b/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java
index 44b6139..92ed7b4 100644
--- a/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/SummaryLoaderTest.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 SummaryLoaderTest {
private static final String SUMMARY_1 = "summary1";
diff --git a/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
index 3dd5266..52c8fbb 100644
--- a/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/SupportItemAdapterTest.java
@@ -49,7 +49,7 @@
import static org.robolectric.Shadows.shadowOf;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SupportItemAdapterTest {
private static final String ACCOUNT_TYPE = "com.google";
private final Account USER_1 = new Account("user1", ACCOUNT_TYPE);
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
index d943fe3..03165c6 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionAdapterTest.java
@@ -43,7 +43,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 ConditionAdapterTest {
@Mock
private Condition mCondition1;
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java
index d077e6f..623f762 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/ConditionTest.java
@@ -41,7 +41,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 ConditionTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java b/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java
index e46ae9e..aa81a1c 100644
--- a/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/conditional/DndConditionTest.java
@@ -35,7 +35,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 DndConditionTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java
index 114ee2b..9598c1e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/EventStoreTest.java
@@ -29,7 +29,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class EventStoreTest {
private EventStore mEventStore;
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
index 1a170c8..b052527 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionAdapterTest.java
@@ -62,7 +62,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 SuggestionAdapterTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java
index c48978c..ad97e18 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionControllerMixinTest.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,
shadows = {
ShadowSuggestionController.class
})
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
index 4aced2f..c94f200 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionDismissControllerTest.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 SuggestionDismissControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java
index 4d6a743..f5e342b 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionFeaturizerTest.java
@@ -32,7 +32,7 @@
import org.robolectric.RuntimeEnvironment;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionFeaturizerTest {
private EventStore mEventStore;
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java
index 1f32531..3698e4e 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionRankerTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.spy;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class SuggestionRankerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java
index 2122d54..6ddba03 100644
--- a/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.java
+++ b/tests/robotests/src/com/android/settings/dashboard/suggestions/SuggestionStateProviderTest.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 SuggestionStateProviderTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java
index 15ca6e4..4f7e216 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppDataUsagePreferenceTest.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,
shadows = ShadowThreadUtils.class)
public class AppDataUsagePreferenceTest {
diff --git a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
index 26071ed..75fec68 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppDataUsageTest.java
@@ -57,7 +57,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 = ShadowEntityHeaderController.class)
public class AppDataUsageTest {
diff --git a/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java b/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java
index ac28e1d..b6547ab 100644
--- a/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/AppPrefLoaderTest.java
@@ -44,7 +44,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 AppPrefLoaderTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java b/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java
index 8b635d2..d735342 100644
--- a/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/BillingCycleSettingsTest.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 BillingCycleSettingsTest {
private static final int LIMIT_BYTES = 123;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java
index 9ddce53..a5dea97 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataPlanSummaryPreferenceTest.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,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class
diff --git a/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java b/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java
index 748c317..cf790e9 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataPlanUsageSummaryTest.java
@@ -45,7 +45,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 DataPlanUsageSummaryTest {
@Mock
private ConnectivityManager mManager;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java
index ba2d5f1..1e2565e 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataPlansSyncTimePreferenceTest.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 final class DataPlansSyncTimePreferenceTest {
private static final String SYNC_TIME = "Today 12:24pm";
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java
index e60243b..57041fd 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageInfoControllerTest.java
@@ -13,7 +13,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 DataUsageInfoControllerTest {
private DataUsageInfoController mInfoController;
private DataUsageInfo info;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
index 9ab88d3..59c99f4 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageListTest.java
@@ -36,7 +36,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class DataUsageListTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java
index dc53ca1..179f743 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageSummaryTest.java
@@ -48,7 +48,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)
public class DataUsageSummaryTest {
@Mock
private ConnectivityManager mManager;
diff --git a/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java b/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java
index cdcd3a9..1dacc68 100644
--- a/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/DataUsageUtilsTest.java
@@ -33,7 +33,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 final class DataUsageUtilsTest {
@Mock private ConnectivityManager mManager;
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java b/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java
index 6eff393..e96b4e8 100644
--- a/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/ManageDataPlansPreferenceTest.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 final class ManageDataPlansPreferenceTest {
private Preference mPreference;
private PreferenceViewHolder mHolder;
diff --git a/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java b/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java
index f20e50c..081337f 100644
--- a/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.java
+++ b/tests/robotests/src/com/android/settings/datausage/UnrestrictedDataAccessTest.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 UnrestrictedDataAccessTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java
index 06969bb..f9784ef 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimeFormatPreferenceControllerTest.java
@@ -40,7 +40,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 AutoTimeFormatPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java
index d28cad1..f4c1596 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimePreferenceControllerTest.java
@@ -35,7 +35,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AutoTimePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
index 5cbef72..950fd0d 100644
--- a/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/AutoTimeZonePreferenceControllerTest.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,
shadows = ShadowConnectivityManager.class)
public class AutoTimeZonePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
index f1d34f8..000dd2c 100644
--- a/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/DatePreferenceControllerTest.java
@@ -37,7 +37,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 DatePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java b/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
index ada59f4..524a88e 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeChangeListenerMixinTest.java
@@ -39,7 +39,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TimeChangeListenerMixinTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java
index cd13513..2e975c3 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeFormatPreferenceControllerTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class TimeFormatPreferenceControllerTest {
@Mock(answer = RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java
index 89c5f47..afec523 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimePreferenceControllerTest.java
@@ -37,7 +37,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 TimePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
index ec26448..aa10a70 100644
--- a/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/TimeZonePreferenceControllerTest.java
@@ -37,7 +37,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 TimeZonePreferenceControllerTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java b/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java
index 4c1794c..10e5e5c 100644
--- a/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/ZonePickerComparatorTest.java
@@ -23,7 +23,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 ZonePickerComparatorTest {
// Strings in Chinese are sorted by alphabet order of their Pinyin.
diff --git a/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java b/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java
index 92807e9..09ff1cd 100644
--- a/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java
+++ b/tests/robotests/src/com/android/settings/datetime/ZonePickerTest.java
@@ -39,7 +39,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 ZonePickerTest {
private Activity mActivity;
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/AmbientDisplayAlwaysOnPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java
index dfe81db..d1d479a 100644
--- a/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AmbientDisplayAlwaysOnPreferenceControllerTest.java
@@ -17,7 +17,11 @@
package com.android.settings.display;
import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -41,22 +45,27 @@
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,
shadows = {ShadowSecureSettings.class})
public class AmbientDisplayAlwaysOnPreferenceControllerTest {
- @Mock Context mContext;
- @Mock AmbientDisplayConfiguration mConfig;
- @Mock SwitchPreference mSwitchPreference;
+ @Mock
+ private Context mContext;
+ @Mock
+ private AmbientDisplayConfiguration mConfig;
+ @Mock
+ private SwitchPreference mSwitchPreference;
- AmbientDisplayAlwaysOnPreferenceController mController;
- boolean mCallbackInvoked;
+ private AmbientDisplayAlwaysOnPreferenceController mController;
+ private boolean mCallbackInvoked;
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
mController = new AmbientDisplayAlwaysOnPreferenceController(mContext, mConfig,
- () -> { mCallbackInvoked = true; });
+ () -> {
+ mCallbackInvoked = true;
+ });
}
@Test
@@ -91,7 +100,7 @@
mController.onPreferenceChange(mSwitchPreference, true);
assertThat(Settings.Secure.getInt(null, Settings.Secure.DOZE_ALWAYS_ON, -1))
- .isEqualTo(1);
+ .isEqualTo(1);
}
@Test
@@ -99,39 +108,45 @@
mController.onPreferenceChange(mSwitchPreference, false);
assertThat(Settings.Secure.getInt(null, Settings.Secure.DOZE_ALWAYS_ON, -1))
- .isEqualTo(0);
+ .isEqualTo(0);
}
@Test
public void isAvailable_available() throws Exception {
- when(mConfig.alwaysOnAvailableForUser(anyInt()))
- .thenReturn(true);
+ mController = spy(mController);
+ doReturn(true).when(mController).alwaysOnAvailableForUser(any());
assertThat(mController.isAvailable()).isTrue();
}
@Test
public void isAvailable_unavailable() throws Exception {
- when(mConfig.alwaysOnAvailableForUser(anyInt()))
- .thenReturn(false);
+ mController = spy(mController);
+ doReturn(false).when(mController).alwaysOnAvailableForUser(any());
+
assertThat(mController.isAvailable()).isFalse();
}
@Test
public void testPreferenceController_ProperResultPayloadType() {
+ mController = spy(mController);
+ doReturn(false).when(mController).alwaysOnAvailableForUser(any());
assertThat(mController.getResultPayload()).isInstanceOf(InlineSwitchPayload.class);
}
@Test
@Config(shadows = ShadowSecureSettings.class)
public void testSetValue_updatesCorrectly() {
- int newValue = 1;
- ContentResolver resolver = mContext.getContentResolver();
- Settings.Secure.putInt(resolver, Settings.Secure.DOZE_ALWAYS_ON, 0);
+ mController = spy(mController);
+ doReturn(false).when(mController).alwaysOnAvailableForUser(any());
+ final int newValue = 1;
+ final ContentResolver resolver = mContext.getContentResolver();
+ Settings.Secure.putInt(resolver, Settings.Secure.DOZE_ALWAYS_ON, 0 /* value */);
((InlinePayload) mController.getResultPayload()).setValue(mContext, newValue);
- int updatedValue = Settings.Secure.getInt(resolver, Settings.Secure.DOZE_ALWAYS_ON, 1);
+ final int updatedValue = Settings.Secure.getInt(resolver,
+ Settings.Secure.DOZE_ALWAYS_ON, 1 /* default */);
assertThat(updatedValue).isEqualTo(newValue);
}
@@ -139,11 +154,13 @@
@Test
@Config(shadows = ShadowSecureSettings.class)
public void testGetValue_correctValueReturned() {
- int currentValue = 1;
- ContentResolver resolver = mContext.getContentResolver();
+ mController = spy(mController);
+ doReturn(false).when(mController).alwaysOnAvailableForUser(any());
+ final int currentValue = 1;
+ final ContentResolver resolver = mContext.getContentResolver();
Settings.Secure.putInt(resolver, Settings.Secure.DOZE_ALWAYS_ON, currentValue);
- int newValue = ((InlinePayload) mController.getResultPayload()).getValue(mContext);
+ final int newValue = ((InlinePayload) mController.getResultPayload()).getValue(mContext);
assertThat(newValue).isEqualTo(currentValue);
}
diff --git a/tests/robotests/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceControllerTest.java
index e1ce694..d442c82 100644
--- a/tests/robotests/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AmbientDisplayNotificationsPreferenceControllerTest.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,
shadows = {ShadowSecureSettings.class})
public class AmbientDisplayNotificationsPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/display/AmbientDisplayPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AmbientDisplayPreferenceControllerTest.java
index 2933517..123dd85 100644
--- a/tests/robotests/src/com/android/settings/display/AmbientDisplayPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AmbientDisplayPreferenceControllerTest.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,
shadows = {ShadowSecureSettings.class})
public class AmbientDisplayPreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/display/AppGridViewTest.java b/tests/robotests/src/com/android/settings/display/AppGridViewTest.java
index d0a92c9..a2cc76d 100644
--- a/tests/robotests/src/com/android/settings/display/AppGridViewTest.java
+++ b/tests/robotests/src/com/android/settings/display/AppGridViewTest.java
@@ -18,9 +18,16 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
import android.content.Context;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
+import android.graphics.drawable.Drawable;
import android.util.IconDrawableFactory;
import com.android.settings.TestConfig;
@@ -35,13 +42,19 @@
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 AppGridViewTest {
@Mock
private ResolveInfo mInfo;
@Mock
private ActivityInfo mActivityInfo;
+ @Mock
+ private ApplicationInfo mApplicationInfo;
+ @Mock
+ private Drawable mIcon;
+ @Mock
+ private PackageManager mPackageManager;
private Context mContext;
private IconDrawableFactory mIconFactory;
@@ -49,13 +62,16 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
mInfo.activityInfo = mActivityInfo;
- mContext = RuntimeEnvironment.application;
+ mInfo.activityInfo.applicationInfo = mApplicationInfo;
+ mContext = spy(RuntimeEnvironment.application);
+ doReturn(mPackageManager).when(mContext).getPackageManager();
mIconFactory = IconDrawableFactory.newInstance(mContext);
}
@Test
public void appEntry_shouldLoadIcon() {
-
+ when(mPackageManager.loadUnbadgedItemIcon(mActivityInfo, mApplicationInfo)).thenReturn(
+ mIcon);
final AppGridView.ActivityEntry activityEntry = new AppGridView.ActivityEntry(
mInfo, "label", mIconFactory);
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/display/AutoRotatePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java
index 091ae1a..febbaf1 100644
--- a/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/AutoRotatePreferenceControllerTest.java
@@ -48,7 +48,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowSystemSettings.class
)
public class AutoRotatePreferenceControllerTest {
diff --git a/tests/robotests/src/com/android/settings/display/BatteryPercentagePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/BatteryPercentagePreferenceControllerTest.java
index 73c5374..655cf51 100644
--- a/tests/robotests/src/com/android/settings/display/BatteryPercentagePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/BatteryPercentagePreferenceControllerTest.java
@@ -31,7 +31,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 BatteryPercentagePreferenceControllerTest {
@Mock private Context mContext;
private BatteryPercentagePreferenceController mController;
diff --git a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
index 95144bd..f8999b5 100644
--- a/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/BrightnessLevelPreferenceControllerTest.java
@@ -46,7 +46,7 @@
import org.robolectric.shadows.ShadowContentResolver;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BrightnessLevelPreferenceControllerTest {
@Mock
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
index dc3d27a..dc9dc5b 100644
--- a/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/display/ColorModePreferenceFragmentTest.java
@@ -46,7 +46,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 ColorModePreferenceFragmentTest {
private ColorModePreferenceFragment mFragment;
diff --git a/tests/robotests/src/com/android/settings/display/ShowOperatorNamePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/ShowOperatorNamePreferenceControllerTest.java
index 23b43d6..4d701ca 100644
--- a/tests/robotests/src/com/android/settings/display/ShowOperatorNamePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/ShowOperatorNamePreferenceControllerTest.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 ShowOperatorNamePreferenceControllerTest {
private static final String KEY_SHOW_OPERATOR_NAME = "show_operator_name";
diff --git a/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java
index 3d99f65..289b8c1 100644
--- a/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/ThemePreferenceControllerTest.java
@@ -47,7 +47,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 ThemePreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java
index 480e41f..48997c3 100644
--- a/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/TimeoutPreferenceControllerTest.java
@@ -33,7 +33,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 TimeoutPreferenceControllerTest {
private static final int TIMEOUT = 30;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/display/VrDisplayPreferencePickerTest.java b/tests/robotests/src/com/android/settings/display/VrDisplayPreferencePickerTest.java
index 191a8fb..f874007 100644
--- a/tests/robotests/src/com/android/settings/display/VrDisplayPreferencePickerTest.java
+++ b/tests/robotests/src/com/android/settings/display/VrDisplayPreferencePickerTest.java
@@ -39,7 +39,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 VrDisplayPreferencePickerTest {
private VrDisplayPreferencePicker mPicker;
diff --git a/tests/robotests/src/com/android/settings/display/WallpaperPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/display/WallpaperPreferenceControllerTest.java
index 1419ad5..17d12c0 100644
--- a/tests/robotests/src/com/android/settings/display/WallpaperPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/display/WallpaperPreferenceControllerTest.java
@@ -43,7 +43,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 WallpaperPreferenceControllerTest {
private static final String WALLPAPER_PACKAGE = "TestPkg";
diff --git a/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java b/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java
index bd25d92..e0a59b5 100644
--- a/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.java
+++ b/tests/robotests/src/com/android/settings/dream/CurrentDreamPickerTest.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 CurrentDreamPickerTest {
private static String COMPONENT_KEY = "mocked_component_name_string";
diff --git a/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java
index e3493a1..b0ef640 100644
--- a/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dream/CurrentDreamPreferenceControllerTest.java
@@ -41,7 +41,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 CurrentDreamPreferenceControllerTest {
private static String TAG = "CurrentDreamPreferenceControllerTest";
diff --git a/tests/robotests/src/com/android/settings/dream/DreamSettingsTest.java b/tests/robotests/src/com/android/settings/dream/DreamSettingsTest.java
index 73526e5..ba3aab5 100644
--- a/tests/robotests/src/com/android/settings/dream/DreamSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/dream/DreamSettingsTest.java
@@ -33,7 +33,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 DreamSettingsTest {
private static final List<String> KEYS = Arrays.asList(
DreamSettings.WHILE_CHARGING_ONLY,
diff --git a/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
index 444591a..7e310c3 100644
--- a/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dream/StartNowPreferenceControllerTest.java
@@ -40,7 +40,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 StartNowPreferenceControllerTest {
private StartNowPreferenceController mController;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dream/WhenToDreamPickerTest.java b/tests/robotests/src/com/android/settings/dream/WhenToDreamPickerTest.java
index bafc2d4..542e0b7 100644
--- a/tests/robotests/src/com/android/settings/dream/WhenToDreamPickerTest.java
+++ b/tests/robotests/src/com/android/settings/dream/WhenToDreamPickerTest.java
@@ -37,7 +37,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 WhenToDreamPickerTest {
private WhenToDreamPicker mPicker;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/dream/WhenToDreamPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/dream/WhenToDreamPreferenceControllerTest.java
index 2acf82b..4763f29 100644
--- a/tests/robotests/src/com/android/settings/dream/WhenToDreamPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/dream/WhenToDreamPreferenceControllerTest.java
@@ -37,7 +37,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 WhenToDreamPreferenceControllerTest {
private WhenToDreamPreferenceController mController;
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/enterprise/AdminActionPreferenceControllerBaseTest.java b/tests/robotests/src/com/android/settings/enterprise/AdminActionPreferenceControllerBaseTest.java
index 111e503..24a96b1 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AdminActionPreferenceControllerBaseTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AdminActionPreferenceControllerBaseTest.java
@@ -31,7 +31,7 @@
* Tests for {@link AdminActionPreferenceControllerBase}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AdminActionPreferenceControllerBaseTest extends
AdminActionPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedCameraPermissionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedCameraPermissionPreferenceControllerTest.java
index 1154aa7..b003ad8 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedCameraPermissionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedCameraPermissionPreferenceControllerTest.java
@@ -28,7 +28,7 @@
* Tests for {@link AdminGrantedCameraPermissionPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AdminGrantedCameraPermissionPreferenceControllerTest extends
AdminGrantedPermissionsPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedLocationPermissionsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedLocationPermissionsPreferenceControllerTest.java
index 1c30da1..2fb3e21 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedLocationPermissionsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedLocationPermissionsPreferenceControllerTest.java
@@ -28,7 +28,7 @@
* Tests for {@link AdminGrantedLocationPermissionsPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AdminGrantedLocationPermissionsPreferenceControllerTest extends
AdminGrantedPermissionsPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedMicrophonePermissionPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedMicrophonePermissionPreferenceControllerTest.java
index 624022b..9ee8100 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedMicrophonePermissionPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedMicrophonePermissionPreferenceControllerTest.java
@@ -28,7 +28,7 @@
* Tests for {@link AdminGrantedMicrophonePermissionPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AdminGrantedMicrophonePermissionPreferenceControllerTest extends
AdminGrantedPermissionsPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedPermissionsPreferenceControllerBaseTest.java b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedPermissionsPreferenceControllerBaseTest.java
index a5d1d1a..918c5fb 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AdminGrantedPermissionsPreferenceControllerBaseTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AdminGrantedPermissionsPreferenceControllerBaseTest.java
@@ -26,7 +26,7 @@
* Tests for {@link AdminGrantedPermissionsPreferenceControllerBase}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AdminGrantedPermissionsPreferenceControllerBaseTest extends
AdminGrantedPermissionsPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java
index 365b9be..17649bb 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnCurrentUserPreferenceControllerTest.java
@@ -39,7 +39,7 @@
* Tests for {@link AlwaysOnVpnCurrentUserPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AlwaysOnVpnCurrentUserPreferenceControllerTest {
private static final String VPN_SET_DEVICE = "VPN set";
diff --git a/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnManagedProfilePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnManagedProfilePreferenceControllerTest.java
index 5f921cd..d54505b 100644
--- a/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnManagedProfilePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/AlwaysOnVpnManagedProfilePreferenceControllerTest.java
@@ -38,7 +38,7 @@
* Tests for {@link AlwaysOnVpnManagedProfilePreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class AlwaysOnVpnManagedProfilePreferenceControllerTest {
private static final String KEY_ALWAYS_ON_VPN_MANAGED_PROFILE = "always_on_vpn_managed_profile";
diff --git a/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java b/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java
index 80d4aaf..fce2719 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ApplicationListFragmentTest.java
@@ -46,7 +46,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 ApplicationListFragmentTest {
private static final int USER_ID = 0;
private static final int USER_APP_UID = 0;
diff --git a/tests/robotests/src/com/android/settings/enterprise/ApplicationListPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/ApplicationListPreferenceControllerTest.java
index 81223a5..963b2ce 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ApplicationListPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ApplicationListPreferenceControllerTest.java
@@ -17,11 +17,15 @@
package com.android.settings.enterprise;
import static com.android.settings.testutils.ApplicationTestUtils.buildInfo;
+
import static com.google.common.truth.Truth.assertThat;
+
import static org.mockito.Answers.RETURNS_DEEP_STUBS;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -29,6 +33,7 @@
import android.content.Context;
import android.content.pm.PackageManager;
import android.content.pm.UserInfo;
+import android.os.UserManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
@@ -54,7 +59,7 @@
import java.util.Set;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class ApplicationListPreferenceControllerTest {
private static final int MAIN_USER_ID = 0;
@@ -74,6 +79,8 @@
private PackageManager mPackageManager;
@Mock(answer = RETURNS_DEEP_STUBS)
private SettingsPreferenceFragment mFragment;
+ @Mock
+ private UserManager mUserManager;
private Context mContext;
private ApplicationListPreferenceController mController;
@@ -82,7 +89,8 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
final ShadowApplication shadowContext = ShadowApplication.getInstance();
- mContext = shadowContext.getApplicationContext();
+ mContext = spy(shadowContext.getApplicationContext());
+ doReturn(mUserManager).when(mContext).getSystemService(UserManager.class);
when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
when(mFragment.getPreferenceManager().getContext()).thenReturn(mContext);
when(mPackageManager.getText(eq(APP_1), anyInt(), any())).thenReturn(APP_1);
diff --git a/tests/robotests/src/com/android/settings/enterprise/BugReportsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/BugReportsPreferenceControllerTest.java
index 0b97353..cc1de27 100644
--- a/tests/robotests/src/com/android/settings/enterprise/BugReportsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/BugReportsPreferenceControllerTest.java
@@ -32,7 +32,7 @@
* Tests for {@link BugReportsPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class BugReportsPreferenceControllerTest extends
AdminActionPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/CaCertsCurrentUserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/CaCertsCurrentUserPreferenceControllerTest.java
index 5ee1145..c933d18 100644
--- a/tests/robotests/src/com/android/settings/enterprise/CaCertsCurrentUserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/CaCertsCurrentUserPreferenceControllerTest.java
@@ -35,7 +35,7 @@
* Tests for {@link CaCertsCurrentUserPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class CaCertsCurrentUserPreferenceControllerTest extends
CaCertsPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/CaCertsManagedProfilePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/CaCertsManagedProfilePreferenceControllerTest.java
index 2aa5306..d246488 100644
--- a/tests/robotests/src/com/android/settings/enterprise/CaCertsManagedProfilePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/CaCertsManagedProfilePreferenceControllerTest.java
@@ -28,7 +28,7 @@
* Tests for {@link CaCertsManagedProfilePreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class CaCertsManagedProfilePreferenceControllerTest extends
CaCertsPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/CaCertsPreferenceControllerBaseTest.java b/tests/robotests/src/com/android/settings/enterprise/CaCertsPreferenceControllerBaseTest.java
index ec76b2b..7a6bc88 100644
--- a/tests/robotests/src/com/android/settings/enterprise/CaCertsPreferenceControllerBaseTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/CaCertsPreferenceControllerBaseTest.java
@@ -28,7 +28,7 @@
* Tests for {@link CaCertsPreferenceControllerBase}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class CaCertsPreferenceControllerBaseTest extends CaCertsPreferenceControllerTestBase {
private static final String PREF_KEY = "pref";
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterpriseInstalledPackagesPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterpriseInstalledPackagesPreferenceControllerTest.java
index b4f7827..7ecd0e3 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterpriseInstalledPackagesPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterpriseInstalledPackagesPreferenceControllerTest.java
@@ -45,7 +45,7 @@
* Tests for {@link EnterpriseInstalledPackagesPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class EnterpriseInstalledPackagesPreferenceControllerTest {
private static final String KEY_NUMBER_ENTERPRISE_INSTALLED_PACKAGES
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
index 1ea2567..516ccb5 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyFeatureProviderImplTest.java
@@ -57,7 +57,7 @@
* Tests for {@link EnterprisePrivacyFeatureProviderImpl}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class EnterprisePrivacyFeatureProviderImplTest {
private final ComponentName OWNER = new ComponentName("dummy", "component");
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyPreferenceControllerTest.java
index 18f16f4..dd97cc0 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacyPreferenceControllerTest.java
@@ -39,7 +39,7 @@
* Tests for {@link EnterprisePrivacyPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class EnterprisePrivacyPreferenceControllerTest {
private static final String MANAGED_GENERIC = "managed by organization";
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
index a2b539d..1a37e63 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterprisePrivacySettingsTest.java
@@ -44,7 +44,7 @@
* Tests for {@link EnterprisePrivacySettings}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class EnterprisePrivacySettingsTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java
index 567c06f..c47a0ac 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListFragmentTest.java
@@ -42,7 +42,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 EnterpriseSetDefaultAppsListFragmentTest {
@Mock(answer = RETURNS_DEEP_STUBS)
private PreferenceScreen mScreen;
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceControllerTest.java
index c38f56a..cf66967 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsListPreferenceControllerTest.java
@@ -59,7 +59,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 EnterpriseSetDefaultAppsListPreferenceControllerTest {
private static final int USER_ID = 0;
private static final int APP_UID = 0;
diff --git a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsPreferenceControllerTest.java
index 9eb6d66..1223558 100644
--- a/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/EnterpriseSetDefaultAppsPreferenceControllerTest.java
@@ -52,7 +52,7 @@
* Tests for {@link EnterpriseSetDefaultAppsPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class EnterpriseSetDefaultAppsPreferenceControllerTest {
private static final String KEY_DEFAULT_APPS = "number_enterprise_set_default_apps";
diff --git a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java
index 8453d62..77d6ea0 100644
--- a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeCurrentUserPreferenceControllerTest.java
@@ -28,7 +28,7 @@
* Tests for {@link FailedPasswordWipeCurrentUserPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class FailedPasswordWipeCurrentUserPreferenceControllerTest extends
FailedPasswordWipePreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeManagedProfilePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeManagedProfilePreferenceControllerTest.java
index a001a9c..c88c22b 100644
--- a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeManagedProfilePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipeManagedProfilePreferenceControllerTest.java
@@ -28,7 +28,7 @@
* Tests for {@link FailedPasswordWipeManagedProfilePreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class FailedPasswordWipeManagedProfilePreferenceControllerTest extends
FailedPasswordWipePreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePreferenceControllerBaseTest.java b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePreferenceControllerBaseTest.java
index f80667c..ecc490f 100644
--- a/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePreferenceControllerBaseTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/FailedPasswordWipePreferenceControllerBaseTest.java
@@ -26,7 +26,7 @@
* Tests for {@link FailedPasswordWipePreferenceControllerBase}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class FailedPasswordWipePreferenceControllerBaseTest extends
FailedPasswordWipePreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java
index b9c24bf..e31b40f 100644
--- a/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/GlobalHttpProxyPreferenceControllerTest.java
@@ -38,7 +38,7 @@
* Tests for {@link GlobalHttpProxyPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class GlobalHttpProxyPreferenceControllerTest {
private static final String KEY_GLOBAL_HTTP_PROXY = "global_http_proxy";
diff --git a/tests/robotests/src/com/android/settings/enterprise/ImePreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/ImePreferenceControllerTest.java
index 1e05383..caa5121 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ImePreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ImePreferenceControllerTest.java
@@ -39,7 +39,7 @@
* Tests for {@link ImePreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class ImePreferenceControllerTest {
private static final String DEFAULT_IME_LABEL = "Test IME";
diff --git a/tests/robotests/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceControllerTest.java
index 2df05c2..f46ecce 100644
--- a/tests/robotests/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/ManageDeviceAdminPreferenceControllerTest.java
@@ -39,7 +39,7 @@
* Tests for {@link ManageDeviceAdminPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class ManageDeviceAdminPreferenceControllerTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/enterprise/NetworkLogsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/NetworkLogsPreferenceControllerTest.java
index 43b793d..e8f7398 100644
--- a/tests/robotests/src/com/android/settings/enterprise/NetworkLogsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/NetworkLogsPreferenceControllerTest.java
@@ -32,7 +32,7 @@
* Tests for {@link NetworkLogsPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class NetworkLogsPreferenceControllerTest extends
AdminActionPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/enterprise/SecurityLogsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/enterprise/SecurityLogsPreferenceControllerTest.java
index 11e219a..7a597dc 100644
--- a/tests/robotests/src/com/android/settings/enterprise/SecurityLogsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/enterprise/SecurityLogsPreferenceControllerTest.java
@@ -32,7 +32,7 @@
* Tests for {@link SecurityLogsPreferenceController}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public final class SecurityLogsPreferenceControllerTest extends
AdminActionPreferenceControllerTestBase {
diff --git a/tests/robotests/src/com/android/settings/fingerprint/DeleteFingerprintDialogTest.java b/tests/robotests/src/com/android/settings/fingerprint/DeleteFingerprintDialogTest.java
index c3c1b42..125977f 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/DeleteFingerprintDialogTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/DeleteFingerprintDialogTest.java
@@ -17,6 +17,10 @@
package com.android.settings.fingerprint;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+
import android.app.Dialog;
import android.hardware.fingerprint.Fingerprint;
@@ -26,6 +30,7 @@
.DeleteFingerprintDialog;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.ShadowEventLogWriter;
+import com.android.settings.testutils.shadow.ShadowFragment;
import org.junit.Before;
import org.junit.Test;
@@ -35,27 +40,25 @@
import org.robolectric.annotation.Config;
import org.robolectric.util.FragmentTestUtil;
-import static org.mockito.Mockito.never;
-import static org.mockito.Mockito.verify;
-
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = {
- ShadowEventLogWriter.class
+ ShadowEventLogWriter.class,
+ ShadowFragment.class
})
public class DeleteFingerprintDialogTest {
@Mock
- private FingerprintSettingsFragment mTarget;
- @Mock
private Fingerprint mFingerprint;
- private DeleteFingerprintDialog mFragment;
+ @Mock
+ private FingerprintSettingsFragment mTarget;
+ private DeleteFingerprintDialog mFragment;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
- mFragment = DeleteFingerprintDialog.newInstance(mFingerprint, mTarget);
+ mFragment = spy(DeleteFingerprintDialog.newInstance(mFingerprint, mTarget));
}
@Test
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java
index ace535e..190d65d 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollEnrollingTest.java
@@ -57,7 +57,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = Config.NEWEST_SDK,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowUtils.class,
ShadowVibrator.class
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollFindSensorTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollFindSensorTest.java
index d495b74..d479e1e 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollFindSensorTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollFindSensorTest.java
@@ -55,7 +55,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollSuggestionActivityTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollSuggestionActivityTest.java
index e299fd5..2856325 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollSuggestionActivityTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintEnrollSuggestionActivityTest.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 FingerprintEnrollSuggestionActivityTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintLocationAnimationVideoViewTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintLocationAnimationVideoViewTest.java
index 7b7e440..f80b324 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintLocationAnimationVideoViewTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintLocationAnimationVideoViewTest.java
@@ -37,7 +37,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 FingerprintLocationAnimationVideoViewTest {
private Context mContext;
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintPreferenceTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintPreferenceTest.java
index 29c6f10..23e0e73 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintPreferenceTest.java
@@ -39,7 +39,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class FingerprintPreferenceTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/fingerprint/FingerprintSuggestionActivityTest.java b/tests/robotests/src/com/android/settings/fingerprint/FingerprintSuggestionActivityTest.java
index 0254bcb..0e4446f 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/FingerprintSuggestionActivityTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/FingerprintSuggestionActivityTest.java
@@ -50,7 +50,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowEventLogWriter.class,
ShadowLockPatternUtils.class,
diff --git a/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensorTest.java b/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensorTest.java
index c3899e9..f9d1994 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensorTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollFindSensorTest.java
@@ -47,7 +47,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroductionTest.java b/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroductionTest.java
index 2d98bf4..bf5c187 100644
--- a/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroductionTest.java
+++ b/tests/robotests/src/com/android/settings/fingerprint/SetupFingerprintEnrollIntroductionTest.java
@@ -60,7 +60,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
ShadowEventLogWriter.class,
ShadowFingerprintManager.class,
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
index c9fcf26..99b0945 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/AdvancedPowerUsageDetailTest.java
@@ -78,7 +78,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,
shadows = {ShadowEntityHeaderController.class, ShadowActivityManager.class})
public class AdvancedPowerUsageDetailTest {
private static final String APP_LABEL = "app label";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/AppButtonsPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/AppButtonsPreferenceControllerTest.java
index ad5f5b0..5c28a06 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/AppButtonsPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/AppButtonsPreferenceControllerTest.java
@@ -66,7 +66,7 @@
import org.robolectric.util.ReflectionHelpers;
@RunWith(RobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class AppButtonsPreferenceControllerTest {
private static final String PACKAGE_NAME = "com.android.settings";
private static final String RESOURCE_STRING = "string";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceControllerTest.java
index e010cf3..cb5914f 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BackgroundActivityPreferenceControllerTest.java
@@ -39,6 +39,7 @@
import com.android.settings.R;
import com.android.settings.TestConfig;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settings.testutils.shadow.ShadowFragment;
import com.android.settings.wrapper.DevicePolicyManagerWrapper;
import org.junit.Before;
@@ -57,10 +58,11 @@
@RunWith(RobolectricTestRunner.class)
@Config(
manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
- SettingsShadowResources.SettingsShadowTheme.class
+ SettingsShadowResources.SettingsShadowTheme.class,
+ ShadowFragment.class
})
public class BackgroundActivityPreferenceControllerTest {
private static final int UID_LOW_SDK = 1234;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryBroadcastReceiverTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryBroadcastReceiverTest.java
index a163a43..30b3448 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryBroadcastReceiverTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryBroadcastReceiverTest.java
@@ -41,7 +41,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BatteryBroadcastReceiverTest {
private static final String BATTERY_INIT_LEVEL = "100%";
private static final String BATTERY_INIT_STATUS = "Not charging";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java
index a57b6ca..04040ac 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryEntryTest.java
@@ -43,7 +43,7 @@
import static org.mockito.Mockito.when;
@RunWith(RobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BatteryEntryTest {
private static final int APP_UID = 123;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
index 719cc33..e433b3c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHeaderPreferenceControllerTest.java
@@ -43,6 +43,7 @@
import com.android.settings.applications.LayoutPreference;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
import com.android.settings.testutils.shadow.SettingsShadowResources;
+import com.android.settings.testutils.shadow.SettingsShadowResourcesImpl;
import com.android.settings.testutils.shadow.ShadowEntityHeaderController;
import com.android.settings.widget.EntityHeaderController;
import com.android.settingslib.core.lifecycle.Lifecycle;
@@ -58,9 +59,10 @@
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
+ SettingsShadowResourcesImpl.class,
SettingsShadowResources.SettingsShadowTheme.class,
ShadowEntityHeaderController.class
})
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java
index 0d03512..60d06cd 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryHistoryPreferenceTest.java
@@ -44,7 +44,8 @@
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O
+ ,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoLoaderTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoLoaderTest.java
index b87089a..5029897 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoLoaderTest.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 BatteryInfoLoaderTest {
private static final long TEST_TIME_REMAINING = 1000L;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
index d82a89b..dd6b709 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryInfoTest.java
@@ -58,7 +58,7 @@
import java.util.concurrent.TimeUnit;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BatteryInfoTest {
private static final String STATUS_FULL = "Full";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryMeterViewTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryMeterViewTest.java
index 3a1fad0..fba6a24 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryMeterViewTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryMeterViewTest.java
@@ -39,7 +39,7 @@
@RunWith(SettingsRobolectricTestRunner.class)
// TODO: Consider making the shadow class set global using a robolectric.properties file.
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceControllerTest.java
index 77e3198..8b8541a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryOptimizationPreferenceControllerTest.java
@@ -45,7 +45,7 @@
import org.robolectric.annotation.Config;
@RunWith(RobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BatteryOptimizationPreferenceControllerTest {
private static final String PKG_IN_WHITELIST = "com.pkg.in.whitelist";
private static final String PKG_NOT_IN_WHITELIST = "com.pkg.not.in.whitelist";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java
index c75a6a6..eeca72f 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverControllerTest.java
@@ -37,7 +37,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 BatterySaverControllerTest {
@Mock
private MasterSwitchPreference mBatterySaverPref;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
index 259bcd2..944f755 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverReceiverTest.java
@@ -33,7 +33,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 BatterySaverReceiverTest {
@Mock
private BatterySaverReceiver.BatterySaverListener mBatterySaverListener;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverSettingsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverSettingsTest.java
index 0e32f6b..a7bcf53 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverSettingsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatterySaverSettingsTest.java
@@ -35,7 +35,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 BatterySaverSettingsTest {
private Context mContext;
private BatterySaverSettings mBatterySaverSettings;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryStatsHelperLoaderTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryStatsHelperLoaderTest.java
index 5f8d7cf..5ba98f2 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryStatsHelperLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryStatsHelperLoaderTest.java
@@ -36,7 +36,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 BatteryStatsHelperLoaderTest {
@Mock
private BatteryUtils mBatteryUtils;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
index c08b01d..56abf48 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/BatteryUtilsTest.java
@@ -69,7 +69,7 @@
import static org.mockito.Mockito.spy;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class BatteryUtilsTest {
// unit that used to converted ms to us
private static final long UNIT = 1000;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/ButtonActionDialogFragmentTest.java b/tests/robotests/src/com/android/settings/fuelgauge/ButtonActionDialogFragmentTest.java
index dec445d..468c160 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/ButtonActionDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/ButtonActionDialogFragmentTest.java
@@ -45,7 +45,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows = {
ShadowEventLogWriter.class
})
public class ButtonActionDialogFragmentTest {
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/HighPowerDetailTest.java b/tests/robotests/src/com/android/settings/fuelgauge/HighPowerDetailTest.java
index d87020e..fe3cd29 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/HighPowerDetailTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/HighPowerDetailTest.java
@@ -36,7 +36,7 @@
import static org.mockito.Mockito.verify;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class HighPowerDetailTest {
@Mock(answer = Answers.RETURNS_DEEP_STUBS)
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerGaugePreferenceTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerGaugePreferenceTest.java
index 32f6a96..e2f5fad 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerGaugePreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerGaugePreferenceTest.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 PowerGaugePreferenceTest {
private static final String SUBTITLE = "Summary";
private static final String CONTENT_DESCRIPTION = "Content description";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java
index 2b5e704..2056262 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAdvancedTest.java
@@ -63,7 +63,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 PowerUsageAdvancedTest {
private static final int FAKE_UID_1 = 50;
private static final int FAKE_UID_2 = 100;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetailsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetailsTest.java
index c992d0a..c6040c0 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetailsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageAnomalyDetailsTest.java
@@ -59,7 +59,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 PowerUsageAnomalyDetailsTest {
private static final String NAME_APP_1 = "app1";
private static final String NAME_APP_2 = "app2";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageBaseTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageBaseTest.java
index 9e0d4de..df829aa 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageBaseTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageBaseTest.java
@@ -47,7 +47,7 @@
* Unit tests for {@link PowerUsageBase}.
*/
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowDashboardFragment.class)
public class PowerUsageBaseTest {
@Mock
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImplTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImplTest.java
index afda69f..6961b60 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImplTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageFeatureProviderImplTest.java
@@ -33,7 +33,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 PowerUsageFeatureProviderImplTest {
private static final int UID_OTHER = Process.FIRST_APPLICATION_UID + 2;
private static final int UID_CALENDAR = Process.FIRST_APPLICATION_UID + 3;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
index 4385409..5be2fe6 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/PowerUsageSummaryTest.java
@@ -86,7 +86,7 @@
// TODO: Improve this test class so that it starts up the real activity and fragment.
@RunWith(SettingsRobolectricTestRunner.class)
@Config(manifest = TestConfig.MANIFEST_PATH,
- sdk = TestConfig.SDK_VERSION,
+ sdk = TestConfig.SDK_VERSION_O,
shadows = {
SettingsShadowResources.class,
SettingsShadowResources.SettingsShadowTheme.class,
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java
index 46db6b3..4ecd1dd 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDetectionPolicyTest.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 AnomalyDetectionPolicyTest {
private static final String ANOMALY_DETECTION_CONSTANTS_VALUE =
"anomaly_detection_enabled=true"
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDialogFragmentTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDialogFragmentTest.java
index 6b3791a..ccce08f 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDialogFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyDialogFragmentTest.java
@@ -49,7 +49,7 @@
import org.robolectric.util.FragmentTestUtil;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION,
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O,
shadows = ShadowRuntimePermissionPresenter.class)
public class AnomalyDialogFragmentTest {
private static final String PACKAGE_NAME = "com.android.app";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyLoaderTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyLoaderTest.java
index 48749d5..dfb7d21 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyLoaderTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyLoaderTest.java
@@ -49,7 +49,8 @@
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 AnomalyLoaderTest {
private static final String PACKAGE_NAME = "com.android.settings";
private static final CharSequence DISPLAY_NAME = "Settings";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyPreferenceTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyPreferenceTest.java
index c0157ae..7061b8a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyPreferenceTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyPreferenceTest.java
@@ -31,7 +31,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 AnomalyPreferenceTest {
@Anomaly.AnomalyType
private static final int ANOMALY_TYPE = Anomaly.AnomalyType.WAKE_LOCK;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalySummaryPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalySummaryPreferenceControllerTest.java
index 3f48d0a..1114e6a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalySummaryPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalySummaryPreferenceControllerTest.java
@@ -30,6 +30,7 @@
import android.content.Context;
import android.support.v14.preference.PreferenceFragment;
import android.support.v7.preference.Preference;
+import android.support.v7.preference.PreferenceScreen;
import com.android.settings.SettingsActivity;
import com.android.settings.testutils.SettingsRobolectricTestRunner;
@@ -48,7 +49,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 AnomalySummaryPreferenceControllerTest {
@Anomaly.AnomalyType
private static final int ANOMALY_TYPE = Anomaly.AnomalyType.WAKE_LOCK;
@@ -56,7 +57,7 @@
private static final String DISPLAY_NAME = "appName";
private static final int UID = 111;
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
+ @Mock
private PreferenceFragment mFragment;
@Mock
private FragmentManager mFragmentManager;
@@ -64,6 +65,9 @@
private FragmentTransaction mFragmentTransaction;
@Mock
private SettingsActivity mSettingsActivity;
+ @Mock
+ private PreferenceScreen mPreferenceScreen;
+
private AnomalySummaryPreferenceController mAnomalySummaryPreferenceController;
private Preference mPreference;
private Context mContext;
@@ -76,11 +80,12 @@
mContext = RuntimeEnvironment.application;
mPreference = new Preference(mContext);
mPreference.setKey(AnomalySummaryPreferenceController.ANOMALY_KEY);
- when(mFragment.getPreferenceScreen().findPreference(any())).thenReturn(mPreference);
+ when(mFragment.getPreferenceScreen()).thenReturn(mPreferenceScreen);
when(mFragment.getFragmentManager()).thenReturn(mFragmentManager);
when(mFragmentManager.beginTransaction()).thenReturn(mFragmentTransaction);
when(mFragment.getContext()).thenReturn(mContext);
when(mSettingsActivity.getApplicationContext()).thenReturn(mContext);
+ when(mPreferenceScreen.findPreference(any())).thenReturn(mPreference);
mAnomalyList = new ArrayList<>();
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyTest.java
index 13a5b31..dae1141 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyTest.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 AnomalyTest {
private static int TYPE = Anomaly.AnomalyType.WAKE_LOCK;
private static int UID = 111;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyUtilsTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyUtilsTest.java
index 38391c9..d37d01e 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyUtilsTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/AnomalyUtilsTest.java
@@ -45,7 +45,7 @@
import java.util.List;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION, shadows = {
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O, shadows = {
ShadowKeyValueListParserWrapperImpl.class})
public class AnomalyUtilsTest {
private static final String PACKAGE_NAME_WAKEUP = "com.android.app1";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.java
index 8db1a8c..6f3e9b4 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/AnomalyActionTest.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 AnomalyActionTest {
private static final String PACKAGE_NAME = "com.android.app";
private static final int UID = 111;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckActionTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckActionTest.java
index 7e5fc4a..e72039a 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckActionTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/BackgroundCheckActionTest.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 BackgroundCheckActionTest {
private static final String PACKAGE_NAME = "com.android.app";
private static final int UID = 111;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/ForceStopActionTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/ForceStopActionTest.java
index 89b1a16..fcb029c 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/ForceStopActionTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/ForceStopActionTest.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 ForceStopActionTest {
private static final String PACKAGE_NAME = "com.android.app";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckActionTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckActionTest.java
index 234dd12..d2b6fcb 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckActionTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/LocationCheckActionTest.java
@@ -37,7 +37,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 =
ShadowPermissionChecker.class)
public class LocationCheckActionTest {
private static final String PACKAGE_NAME = "com.android.app";
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/StopAndBackgroundActionTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/StopAndBackgroundActionTest.java
index c06bddd..de7402b 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/StopAndBackgroundActionTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/action/StopAndBackgroundActionTest.java
@@ -36,7 +36,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 StopAndBackgroundActionTest {
private static final String PACKAGE_NAME = "com.android.app";
private static final int UID = 111;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/BluetoothScanAnomalyDetectorTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/BluetoothScanAnomalyDetectorTest.java
index edf026a..b148ce9 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/BluetoothScanAnomalyDetectorTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/BluetoothScanAnomalyDetectorTest.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 BluetoothScanAnomalyDetectorTest {
private static final String TARGET_PACKAGE_NAME = "com.android.app";
private static final int ANOMALY_UID = 111;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeLockAnomalyDetectorTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeLockAnomalyDetectorTest.java
index d7682ea..0991d89 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeLockAnomalyDetectorTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeLockAnomalyDetectorTest.java
@@ -55,7 +55,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 WakeLockAnomalyDetectorTest {
private static final String TARGET_PACKAGE_NAME = "com.android.app";
private static final long ANOMALY_WAKELOCK_TIME_MS = 2 * DateUtils.HOUR_IN_MILLIS;
diff --git a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java
index 13a5ab8..f014f8d 100644
--- a/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java
+++ b/tests/robotests/src/com/android/settings/fuelgauge/anomaly/checker/WakeupAlarmAnomalyDetectorTest.java
@@ -56,7 +56,7 @@
import java.util.Set;
@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
+@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION_O)
public class WakeupAlarmAnomalyDetectorTest {
private static final String TARGET_PACKAGE_NAME = "com.android.target";
private static final String ANOMALY_PACKAGE_NAME = "com.android.anomaly";
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);
- }
}
diff --git a/tests/robotests/src/com/android/settings/search/SiteMapManagerTest.java b/tests/robotests/src/com/android/settings/search/SiteMapManagerTest.java
deleted file mode 100644
index b441b66..0000000
--- a/tests/robotests/src/com/android/settings/search/SiteMapManagerTest.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.search;
-
-import android.content.ContentValues;
-import android.content.Context;
-import android.database.sqlite.SQLiteDatabase;
-import android.os.Bundle;
-
-import com.android.settings.SettingsActivity;
-import com.android.settings.testutils.SettingsRobolectricTestRunner;
-import com.android.settings.TestConfig;
-import com.android.settings.dashboard.SiteMapManager;
-import com.android.settings.search.IndexDatabaseHelper.SiteMapColumns;
-import com.android.settings.system.SystemDashboardFragment;
-import com.android.settings.testutils.DatabaseTestUtils;
-import com.android.settings.testutils.FakeFeatureFactory;
-import com.android.settingslib.drawer.CategoryKey;
-import com.android.settingslib.drawer.DashboardCategory;
-import com.android.settingslib.drawer.Tile;
-
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.Config;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static com.google.common.truth.Truth.assertThat;
-import static org.mockito.Mockito.when;
-
-@RunWith(SettingsRobolectricTestRunner.class)
-@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
-public class SiteMapManagerTest {
-
- private static final int STATIC_DB_DEPTH = 4;
- private static final String CLASS_PREFIX = "class_";
- private static final String TITLE_PREFIX = "title_";
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private Context mMockContext;
- private Context mContext;
- private SQLiteDatabase mDb;
- private SiteMapManager mSiteMapManager;
- private FakeFeatureFactory mFeatureFactory;
-
- @Before
- public void setUp() {
- MockitoAnnotations.initMocks(this);
- FakeFeatureFactory.setupForTest(mMockContext);
- mFeatureFactory = (FakeFeatureFactory) FakeFeatureFactory.getFactory(mMockContext);
-
- mContext = RuntimeEnvironment.application;
- mDb = IndexDatabaseHelper.getInstance(mContext).getWritableDatabase();
- buildDb();
- mSiteMapManager = new SiteMapManager();
- }
-
- @After
- public void cleanUp() {
- DatabaseTestUtils.clearDb(mContext);
- }
-
- @Test
- public void buildBreadCrumb_onlyFromSiteMapDb_breadcrumbShouldLinkUp() {
- List<String> breadcrumb = mSiteMapManager.buildBreadCrumb(mContext,
- CLASS_PREFIX + 0, TITLE_PREFIX + 0);
- assertThat(breadcrumb.size()).isEqualTo(STATIC_DB_DEPTH + 1);
- for (int i = 0; i < STATIC_DB_DEPTH; i++) {
- assertThat(breadcrumb.get(i)).isEqualTo(TITLE_PREFIX + (STATIC_DB_DEPTH - i));
- }
- }
-
- @Test
- public void buildBreadCrumb_fromSiteMapDbAndDashboardProvider_breadcrumbShouldLinkUp() {
- final String iaClass = SystemDashboardFragment.class.getName();
- final String iaTitle = "ia_title";
-
- ContentValues index = new ContentValues();
- index.put(IndexDatabaseHelper.IndexColumns.CLASS_NAME, iaClass);
- index.put(IndexDatabaseHelper.IndexColumns.SCREEN_TITLE, iaTitle);
- mDb.replaceOrThrow(IndexDatabaseHelper.Tables.TABLE_PREFS_INDEX, null, index);
-
- final DashboardCategory category = new DashboardCategory();
- category.key = CategoryKey.CATEGORY_SYSTEM;
- category.tiles.add(new Tile());
- category.tiles.get(0).title = TITLE_PREFIX + STATIC_DB_DEPTH;
- category.tiles.get(0).metaData = new Bundle();
- category.tiles.get(0).metaData.putString(SettingsActivity.META_DATA_KEY_FRAGMENT_CLASS,
- CLASS_PREFIX + STATIC_DB_DEPTH);
- when(mFeatureFactory.dashboardFeatureProvider.getAllCategories())
- .thenReturn(Arrays.asList(category));
-
- final List<String> breadcrumb = mSiteMapManager.buildBreadCrumb(mContext,
- CLASS_PREFIX + 0, TITLE_PREFIX + 0);
-
- assertThat(breadcrumb.size()).isEqualTo(STATIC_DB_DEPTH + 2);
- assertThat(breadcrumb.get(0))
- .isEqualTo(iaTitle);
- }
-
- @Test
- public void buildBreadCrumb_classNotIndexed_shouldNotHaveBreadCrumb() {
- final String title = "wrong_title";
-
- final List<String> breadcrumb = mSiteMapManager.buildBreadCrumb(mContext,
- "wrong_class", title);
-
- assertThat(breadcrumb.size()).isEqualTo(1);
- assertThat(breadcrumb.get(0)).isEqualTo(title);
- }
-
- private void buildDb() {
- for (int i = 0; i < STATIC_DB_DEPTH; i++) {
- final ContentValues siteMapPair = new ContentValues();
- siteMapPair.put(SiteMapColumns.DOCID, i);
- siteMapPair.put(SiteMapColumns.PARENT_CLASS, CLASS_PREFIX + (i + 1));
- siteMapPair.put(SiteMapColumns.PARENT_TITLE, TITLE_PREFIX + (i + 1));
- siteMapPair.put(SiteMapColumns.CHILD_CLASS, CLASS_PREFIX + i);
- siteMapPair.put(SiteMapColumns.CHILD_TITLE, TITLE_PREFIX + i);
- mDb.replaceOrThrow(IndexDatabaseHelper.Tables.TABLE_SITE_MAP, null, siteMapPair);
- }
- }
-}
diff --git a/tests/robotests/src/com/android/settings/testutils/shadow/ShadowFragment.java b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowFragment.java
new file mode 100644
index 0000000..4596559
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/testutils/shadow/ShadowFragment.java
@@ -0,0 +1,47 @@
+/*
+ * 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.testutils.shadow;
+
+import android.app.Fragment;
+import android.app.FragmentManager;
+
+import org.robolectric.annotation.Implementation;
+import org.robolectric.annotation.Implements;
+
+/**
+ * Override the {@link #setTargetFragment(Fragment, int)} to skip an illegal state exception
+ * in SDK 26. SDK 26 requires that the target fragment be in the same {@link FragmentManager} as
+ * the current {@link Fragment}. This is infeasible with our current framework.
+ */
+@Implements(
+ value = Fragment.class,
+ minSdk = 26
+)
+public class ShadowFragment {
+
+ private Fragment mTargetFragment;
+
+ @Implementation
+ public void setTargetFragment(Fragment fragment, int requestCode) {
+ mTargetFragment = fragment;
+ }
+
+ @Implementation
+ final public Fragment getTargetFragment() {
+ return mTargetFragment;
+ }
+}
diff --git a/tests/unit/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java b/tests/unit/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
new file mode 100644
index 0000000..aed94a0
--- /dev/null
+++ b/tests/unit/src/com/android/settings/search/SettingsSearchIndexablesProviderTest.java
@@ -0,0 +1,62 @@
+/*
+ * 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.search;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+import android.database.Cursor;
+import android.net.Uri;
+import android.provider.SearchIndexablesContract;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+@SmallTest
+public class SettingsSearchIndexablesProviderTest {
+
+ private Context mContext;
+
+
+ @Before
+ public void setUp() {
+ mContext = InstrumentationRegistry.getTargetContext();
+ }
+
+ @Test
+ public void testSiteMapPairsFetched() {
+ final Uri uri = Uri.parse("content://" + mContext.getPackageName() + "/" +
+ SearchIndexablesContract.SITE_MAP_PAIRS_PATH);
+ final Cursor cursor = mContext.getContentResolver().query(uri, null, null, null, null);
+
+ final int size = cursor.getCount();
+ assertThat(size).isGreaterThan(0);
+ while (cursor.moveToNext()) {
+ assertThat(cursor.getString(cursor.getColumnIndexOrThrow(
+ SearchIndexablesContract.SiteMapColumns.PARENT_CLASS)))
+ .isNotEmpty();
+ assertThat(cursor.getString(cursor.getColumnIndexOrThrow(
+ SearchIndexablesContract.SiteMapColumns.CHILD_CLASS)))
+ .isNotEmpty();
+ }
+ }
+}