Merge "Fix BatteryInfo test fail" into sc-dev
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 2057c50..0fb4af0 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -278,7 +278,7 @@
<!-- Type of OCSP -->
<string-array name="eap_ocsp_type" translatable="true">
- <item>Do not validate</item>
+ <item>Do not verify</item>
<item>Request certificate status</item>
<item>Require certificate status</item>
<item>Require all non-trusted certificate statuses</item>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 2553500..9ab9a2c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -9966,6 +9966,12 @@
<!-- Runtime permissions preference summary, which describes what the permission manager does. [CHAR LIMIT=NONE] -->
<string name="runtime_permissions_summary_control_app_access">Control app access to your data</string>
+ <!-- Permissions usage title [CHAR LIMIT=NONE] -->
+ <string name="permissions_usage_title">Permissions usage</string>
+
+ <!-- Permissions usage summary, which describes what the permissions usage does [CHAR LIMIT=NONE] -->
+ <string name="permissions_usage_summary">Show which apps recently used permissions</string>
+
<!-- Label for showing apps that have not been used for months. [CHAR LIMIT=40]-->
<string name="unused_apps">Unused apps</string>
diff --git a/res/xml/accessibility_turn_screen_darker.xml b/res/xml/accessibility_turn_screen_darker.xml
deleted file mode 100644
index d87f23b..0000000
--- a/res/xml/accessibility_turn_screen_darker.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2021 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.
--->
-
-<PreferenceScreen
- xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:settings="http://schemas.android.com/apk/res-auto"
- android:key="accessibility_turn_screen_darker"
- android:persistent="false"
- android:title="@string/accessibility_turn_screen_darker_title">
-
- <SwitchPreference
- android:key="dark_ui_mode_accessibility"
- android:persistent="false"
- android:title="@string/dark_ui_mode"
- settings:controller="com.android.settings.display.DarkUIPreferenceController"
- settings:searchable="false"/>
-
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleColorInversionPreferenceFragment"
- android:icon="@drawable/ic_color_inversion"
- android:key="toggle_inversion_preference"
- android:persistent="false"
- android:title="@string/accessibility_display_inversion_preference_title"
- settings:controller="com.android.settings.accessibility.ColorInversionPreferenceController"/>
-
- <!--TODO(b/170973645): Get icon-->
- <Preference
- android:fragment="com.android.settings.accessibility.ToggleReduceBrightColorsPreferenceFragment"
- android:key="reduce_bright_colors_preference"
- android:persistent="false"
- android:title="@string/reduce_bright_colors_preference_title"
- settings:controller="com.android.settings.accessibility.ReduceBrightColorsPreferenceController"/>
-
- <Preference
- android:key="auto_brightness_entry"
- android:title="@string/auto_brightness_title"
- android:summary="@string/summary_placeholder"
- android:fragment="com.android.settings.display.AutoBrightnessSettings"
- settings:controller="com.android.settings.display.AutoBrightnessPreferenceController"/>
-
- <com.android.settings.widget.PrimarySwitchPreference
- android:key="night_display"
- android:title="@string/night_display_title"
- android:fragment="com.android.settings.display.NightDisplaySettings"
- settings:controller="com.android.settings.display.NightDisplayPreferenceController"
- settings:keywords="@string/keywords_display_night_display"/>
-
- <PreferenceCategory
- android:key="experimental_category"
- android:persistent="false"
- android:title="@string/experimental_category_title">
- </PreferenceCategory>
-</PreferenceScreen>
\ No newline at end of file
diff --git a/res/xml/media_controls_settings.xml b/res/xml/media_controls_settings.xml
index 3ace6a0..14a6875 100644
--- a/res/xml/media_controls_settings.xml
+++ b/res/xml/media_controls_settings.xml
@@ -20,14 +20,17 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/media_controls_title">
- <SwitchPreference
+ <com.android.settings.widget.SettingsMainSwitchPreference
android:key="media_controls_resume_switch"
android:title="@string/media_controls_summary"
- android:summary="@string/media_controls_resume_description"
app:keywords="@string/keywords_media_controls"
app:controller="com.android.settings.sound.MediaControlsPreferenceController"
app:allowDividerAbove="true" />
+ <com.android.settingslib.widget.TopIntroPreference
+ android:title="@string/media_controls_resume_description"
+ app:searchable="false" />
+
<PreferenceCategory
android:key="media_controls_resumable_apps"
android:title="@string/media_controls_apps_title"
diff --git a/res/xml/privacy_dashboard_settings.xml b/res/xml/privacy_dashboard_settings.xml
index bd6a954..fcd0de4 100644
--- a/res/xml/privacy_dashboard_settings.xml
+++ b/res/xml/privacy_dashboard_settings.xml
@@ -58,6 +58,16 @@
<intent android:action="android.intent.action.MANAGE_PERMISSIONS"/>
</Preference>
+ <!-- Permissions usage -->
+ <Preference
+ android:key="privacy_permissions_usage"
+ android:title="@string/permissions_usage_title"
+ android:summary="@string/permissions_usage_summary"
+ settings:searchable="false"
+ settings:controller="com.android.settings.privacy.PrivacyHubPreferenceController">
+ <intent android:action="android.intent.action.REVIEW_PERMISSION_USAGE"/>
+ </Preference>
+
<!-- Show passwords -->
<SwitchPreference
android:key="show_password"
diff --git a/src/com/android/settings/accessibility/AccessibilitySettings.java b/src/com/android/settings/accessibility/AccessibilitySettings.java
index 6b629ac..fb1564c 100644
--- a/src/com/android/settings/accessibility/AccessibilitySettings.java
+++ b/src/com/android/settings/accessibility/AccessibilitySettings.java
@@ -84,10 +84,6 @@
CATEGORY_INTERACTION_CONTROL, CATEGORY_DOWNLOADED_SERVICES
};
- // Preferences
- private static final String DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN =
- "magnification_preference_screen";
-
// Extras passed to sub-fragments.
static final String EXTRA_PREFERENCE_KEY = "preference_key";
static final String EXTRA_CHECKED = "checked";
@@ -155,19 +151,6 @@
private final Map<ComponentName, PreferenceCategory> mPreBundledServiceComponentToCategoryMap =
new ArrayMap<>();
- private Preference mDisplayMagnificationPreferenceScreen;
-
- /**
- * Check if the color transforms are color accelerated. Some transforms are experimental only
- * on non-accelerated platforms due to the performance implications.
- *
- * @param context The current context
- */
- public static boolean isColorTransformAccelerated(Context context) {
- return context.getResources()
- .getBoolean(com.android.internal.R.bool.config_setColorTransformAccelerated);
- }
-
public AccessibilitySettings() {
// Observe changes to anything that the shortcut can toggle, so we can reflect updates
final Collection<AccessibilityShortcutController.ToggleableFrameworkFeatureInfo> features =
@@ -305,10 +288,6 @@
PreferenceCategory prefCategory = findPreference(CATEGORIES[i]);
mCategoryToPrefCategoryMap.put(CATEGORIES[i], prefCategory);
}
-
- // Display magnification.
- mDisplayMagnificationPreferenceScreen = findPreference(
- DISPLAY_MAGNIFICATION_PREFERENCE_SCREEN);
}
private void updateAllPreferences() {
@@ -501,6 +480,7 @@
* installed accessibility services
* @return The list of {@link RestrictedPreference}
*/
+ @VisibleForTesting
List<RestrictedPreference> createAccessibilityServicePreferenceList(
List<AccessibilityServiceInfo> installedServices) {
@@ -566,6 +546,7 @@
* installed accessibility shortcuts
* @return The list of {@link RestrictedPreference}
*/
+ @VisibleForTesting
List<RestrictedPreference> createAccessibilityActivityPreferenceList(
List<AccessibilityShortcutInfo> installedShortcuts) {
final Set<ComponentName> enabledServices =
diff --git a/src/com/android/settings/accessibility/TurnScreenDarkerFragment.java b/src/com/android/settings/accessibility/TurnScreenDarkerFragment.java
deleted file mode 100644
index 0e0a600..0000000
--- a/src/com/android/settings/accessibility/TurnScreenDarkerFragment.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2021 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.accessibility;
-
-import android.app.settings.SettingsEnums;
-import android.content.Context;
-import android.hardware.display.ColorDisplayManager;
-import android.os.Bundle;
-import android.provider.Settings;
-
-import androidx.preference.Preference;
-import androidx.preference.PreferenceCategory;
-
-import com.android.settings.R;
-import com.android.settings.dashboard.DashboardFragment;
-import com.android.settings.display.DarkUIPreferenceController;
-import com.android.settings.search.BaseSearchIndexProvider;
-import com.android.settingslib.search.SearchIndexable;
-
-/** Accessibility settings for turning screen darker. */
-@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
-public class TurnScreenDarkerFragment extends DashboardFragment {
-
- private static final String TAG = "TurnDarkerFragment";
-
- private static final String CATEGORY_EXPERIMENTAL = "experimental_category";
-
- // Preferences
- private static final String TOGGLE_INVERSION_PREFERENCE = "toggle_inversion_preference";
- private static final String DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN =
- "reduce_bright_colors_preference";
-
- private Preference mToggleInversionPreference;
- private Preference mReduceBrightColorsPreference;
-
- @Override
- public int getMetricsCategory() {
- return SettingsEnums.ACCESSIBILITY_TURN_SCREEN_DARKER;
- }
-
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
- initializeAllPreferences();
- updateSystemPreferences();
- }
-
- @Override
- public void onAttach(Context context) {
- super.onAttach(context);
- use(DarkUIPreferenceController.class).setParentFragment(this);
- }
-
- @Override
- protected int getPreferenceScreenResId() {
- return R.xml.accessibility_turn_screen_darker;
- }
-
- @Override
- protected String getLogTag() {
- return TAG;
- }
-
- private void initializeAllPreferences() {
- // Display inversion.
- mToggleInversionPreference = findPreference(TOGGLE_INVERSION_PREFERENCE);
-
- // Reduce brightness.
- mReduceBrightColorsPreference =
- findPreference(DISPLAY_REDUCE_BRIGHT_COLORS_PREFERENCE_SCREEN);
- }
-
- /**
- * Updates preferences related to system configurations.
- */
- private void updateSystemPreferences() {
- final PreferenceCategory experimentalCategory = getPreferenceScreen().findPreference(
- CATEGORY_EXPERIMENTAL);
- if (ColorDisplayManager.isColorTransformAccelerated(getContext())) {
- mToggleInversionPreference.setSummary(AccessibilityUtil.getSummary(
- getContext(), Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED));
- getPreferenceScreen().removePreference(experimentalCategory);
- } else {
- // Move following preferences to experimental category if device don't supports HWC
- // hardware-accelerated color transform.
- getPreferenceScreen().removePreference(mToggleInversionPreference);
- getPreferenceScreen().removePreference(mReduceBrightColorsPreference);
- experimentalCategory.addPreference(mToggleInversionPreference);
- experimentalCategory.addPreference(mReduceBrightColorsPreference);
- }
- }
-
- public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
- new BaseSearchIndexProvider(R.xml.accessibility_turn_screen_darker);
-}
diff --git a/src/com/android/settings/privacy/PrivacyHubPreferenceController.java b/src/com/android/settings/privacy/PrivacyHubPreferenceController.java
new file mode 100644
index 0000000..b07b5f5
--- /dev/null
+++ b/src/com/android/settings/privacy/PrivacyHubPreferenceController.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2021 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.privacy;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.provider.DeviceConfig;
+
+import com.android.settings.core.BasePreferenceController;
+
+/**
+ * The preference controller for privacy hub top level preference.
+ */
+public final class PrivacyHubPreferenceController extends BasePreferenceController {
+ public static final String PROPERTY_PRIVACY_HUB_ENABLED = "privacy_hub_enabled";
+
+ public PrivacyHubPreferenceController(@NonNull Context context, @NonNull String key) {
+ super(context, key);
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return DeviceConfig.getBoolean(DeviceConfig.NAMESPACE_PRIVACY,
+ PROPERTY_PRIVACY_HUB_ENABLED, false) ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+}
diff --git a/src/com/android/settings/sound/MediaControlsPreferenceController.java b/src/com/android/settings/sound/MediaControlsPreferenceController.java
index 219eb24..06392ab 100644
--- a/src/com/android/settings/sound/MediaControlsPreferenceController.java
+++ b/src/com/android/settings/sound/MediaControlsPreferenceController.java
@@ -20,32 +20,47 @@
import android.content.Context;
import android.provider.Settings;
+import android.widget.Switch;
-import com.android.settings.core.TogglePreferenceController;
+import androidx.annotation.VisibleForTesting;
+import androidx.preference.PreferenceScreen;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.widget.SettingsMainSwitchPreference;
+import com.android.settingslib.widget.OnMainSwitchChangeListener;
/**
* Toggle for media controls settings
*/
-public class MediaControlsPreferenceController extends TogglePreferenceController {
+public class MediaControlsPreferenceController extends BasePreferenceController
+ implements OnMainSwitchChangeListener {
public MediaControlsPreferenceController(Context context, String key) {
super(context, key);
}
@Override
- public boolean isChecked() {
+ public void displayPreference(PreferenceScreen screen) {
+ super.displayPreference(screen);
+ SettingsMainSwitchPreference mainSwitch = screen.findPreference(mPreferenceKey);
+ mainSwitch.addOnSwitchChangeListener(this);
+ mainSwitch.setChecked(isChecked());
+ }
+
+ @VisibleForTesting
+ protected boolean isChecked() {
int val = Settings.Secure.getInt(mContext.getContentResolver(), MEDIA_CONTROLS_RESUME, 1);
return val == 1;
}
@Override
- public boolean setChecked(boolean isChecked) {
- int val = isChecked ? 1 : 0;
- return Settings.Secure.putInt(mContext.getContentResolver(), MEDIA_CONTROLS_RESUME, val);
+ public int getAvailabilityStatus() {
+ return AVAILABLE;
}
@Override
- public int getAvailabilityStatus() {
- return AVAILABLE;
+ public void onSwitchChanged(Switch switchView, boolean isChecked) {
+ int val = isChecked ? 1 : 0;
+ Settings.Secure.putInt(mContext.getContentResolver(), MEDIA_CONTROLS_RESUME, val);
}
}
diff --git a/src/com/android/settings/users/ProfileUpdateReceiver.java b/src/com/android/settings/users/ProfileUpdateReceiver.java
index 80fa10a..f80233c 100644
--- a/src/com/android/settings/users/ProfileUpdateReceiver.java
+++ b/src/com/android/settings/users/ProfileUpdateReceiver.java
@@ -50,14 +50,23 @@
return;
}
- int userId = UserHandle.myUserId();
- UserManager um = (UserManager) context.getSystemService(Context.USER_SERVICE);
- String profileName = Utils.getMeProfileName(context, false /* partial name */);
- if (profileName != null && profileName.length() > 0) {
- um.setUserName(userId, profileName);
+ final int userId = UserHandle.myUserId();
+ final UserManager um = context.getSystemService(UserManager.class);
+ final String newName = Utils.getMeProfileName(context, false /* partial name */);
+ if (newName != null && newName.length() > 0 && !isCurrentNameInteresting(context, um)) {
+ um.setUserName(userId, newName);
// Flag that we've written the profile one time at least. No need to do it in the
// future.
prefs.edit().putBoolean(KEY_PROFILE_NAME_COPIED_ONCE, true).commit();
}
}
+
+ /** Returns whether the current user name is different from the default one. */
+ private static boolean isCurrentNameInteresting(Context context, UserManager um) {
+ final String currentName = um.getUserName();
+ final String defaultName = um.isRestrictedProfile() || um.isProfile() ?
+ context.getString(com.android.settingslib.R.string.user_new_profile_name) :
+ context.getString(com.android.settingslib.R.string.user_new_user_name);
+ return currentName != null && !currentName.equals(defaultName);
+ }
}
diff --git a/src/com/android/settings/users/UserPreference.java b/src/com/android/settings/users/UserPreference.java
index 0b78d78..a6427ae 100644
--- a/src/com/android/settings/users/UserPreference.java
+++ b/src/com/android/settings/users/UserPreference.java
@@ -36,7 +36,6 @@
private static final int ALPHA_DISABLED = 102;
public static final int USERID_UNKNOWN = -10;
- public static final int USERID_GUEST_DEFAULTS = -11;
public static final Comparator<UserPreference> SERIAL_NUMBER_COMPARATOR =
(p1, p2) -> {
@@ -93,8 +92,6 @@
// If the userId is unknown
if (mUserId == USERID_UNKNOWN) {
return Integer.MAX_VALUE;
- } else if (mUserId == USERID_GUEST_DEFAULTS) {
- return Integer.MAX_VALUE - 1;
}
mSerialNumber = ((UserManager) getContext().getSystemService(Context.USER_SERVICE))
.getUserSerialNumber(mUserId);
diff --git a/src/com/android/settings/users/UserSettings.java b/src/com/android/settings/users/UserSettings.java
index 6e82aab..64f9a2c 100644
--- a/src/com/android/settings/users/UserSettings.java
+++ b/src/com/android/settings/users/UserSettings.java
@@ -49,6 +49,7 @@
import android.view.MenuInflater;
import android.view.MenuItem;
import android.widget.SimpleAdapter;
+import android.widget.Toast;
import androidx.annotation.VisibleForTesting;
import androidx.annotation.WorkerThread;
@@ -493,6 +494,13 @@
}
}
+ private void onUserCreationFailed() {
+ Toast.makeText(getContext(),
+ com.android.settingslib.R.string.add_user_failed,
+ Toast.LENGTH_SHORT).show();
+ hideUserCreatingDialog();
+ }
+
private void openUserDetails(UserInfo userInfo, boolean newUser) {
Bundle extras = new Bundle();
extras.putInt(UserDetailsSettings.EXTRA_USER_ID, userInfo.id);
@@ -791,7 +799,7 @@
mAddingUser = false;
mPendingUserIcon = null;
mPendingUserName = null;
- ThreadUtils.postOnMainThread(() -> hideUserCreatingDialog());
+ ThreadUtils.postOnMainThread(() -> onUserCreationFailed());
return;
}
@@ -1082,6 +1090,12 @@
mMetricsFeatureProvider.action(getActivity(), SettingsEnums.ACTION_USER_GUEST_ADD);
UserInfo guest = mUserManager.createGuest(
getContext(), getString(com.android.settingslib.R.string.user_guest));
+ if (guest == null) {
+ Toast.makeText(getContext(),
+ com.android.settingslib.R.string.add_user_failed,
+ Toast.LENGTH_SHORT).show();
+ return true;
+ }
openUserDetails(guest, true);
return true;
}
diff --git a/src/com/android/settings/widget/FilterTouchesSwitchPreference.java b/src/com/android/settings/widget/FilterTouchesSwitchPreference.java
index 5721854..1b4d681 100644
--- a/src/com/android/settings/widget/FilterTouchesSwitchPreference.java
+++ b/src/com/android/settings/widget/FilterTouchesSwitchPreference.java
@@ -47,7 +47,6 @@
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
- setSingleLineTitle(true);
super.onBindViewHolder(holder);
final View switchView = holder.findViewById(android.R.id.switch_widget);
if (switchView != null) {
diff --git a/tests/robotests/src/com/android/settings/accessibility/TurnScreenDarkerFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/TurnScreenDarkerFragmentTest.java
deleted file mode 100644
index f256201..0000000
--- a/tests/robotests/src/com/android/settings/accessibility/TurnScreenDarkerFragmentTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2021 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.accessibility;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.content.Context;
-
-import androidx.test.core.app.ApplicationProvider;
-
-import com.android.settings.R;
-import com.android.settings.testutils.XmlTestUtils;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RobolectricTestRunner;
-
-import java.util.List;
-
-/** Tests for {@link TurnScreenDarkerFragment}. */
-@RunWith(RobolectricTestRunner.class)
-public class TurnScreenDarkerFragmentTest {
-
- private Context mContext = ApplicationProvider.getApplicationContext();
-
- @Test
- public void getNonIndexableKeys_existInXmlLayout() {
- final List<String> niks = TurnScreenDarkerFragment.SEARCH_INDEX_DATA_PROVIDER
- .getNonIndexableKeys(mContext);
- final List<String> keys =
- XmlTestUtils.getKeysFromPreferenceXml(mContext,
- R.xml.accessibility_turn_screen_darker);
-
- assertThat(keys).containsAtLeastElementsIn(niks);
- }
-}
diff --git a/tests/unit/src/com/android/settings/sound/MediaControlsPreferenceControllerTest.java b/tests/unit/src/com/android/settings/sound/MediaControlsPreferenceControllerTest.java
index 510928d..71bb5ee 100644
--- a/tests/unit/src/com/android/settings/sound/MediaControlsPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/sound/MediaControlsPreferenceControllerTest.java
@@ -76,7 +76,7 @@
assertThat(mController.isChecked()).isTrue();
- mController.setChecked(false);
+ mController.onSwitchChanged(null /* switchView */, false);
assertThat(Settings.Secure.getInt(mContentResolver,
Settings.Secure.MEDIA_CONTROLS_RESUME, -1)).isEqualTo(0);
@@ -89,7 +89,7 @@
assertThat(mController.isChecked()).isFalse();
- mController.setChecked(true);
+ mController.onSwitchChanged(null /* switchView */, true);
assertThat(Settings.Secure.getInt(mContentResolver,
Settings.Secure.MEDIA_CONTROLS_RESUME, -1)).isEqualTo(1);