Revert "Create QS media player setting"
This reverts commit 665c36eae2ecf342fa52a7697665714d5f2a07b5.
Reason for revert: New media experience landed
Fixes: 156369996
Change-Id: Icb997a3508cec1e15f523b8ca5b923deacee66b4
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 43925c1..d4f3f73 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -11760,11 +11760,6 @@
<!-- Summary for the top level Privacy Settings [CHAR LIMIT=NONE]-->
<string name="privacy_dashboard_summary">Permissions, account activity, personal data</string>
- <!-- UI debug setting: show media player on quick settings title [CHAR LIMIT=60] -->
- <string name="quick_settings_media_player">Media resumption</string>
- <!-- UI debug setting: show media player on quick settings summary [CHAR_LIMIT=NONE] -->
- <string name="quick_settings_media_player_summary">Shows and persists media player in Quick Settings. Requires reboot.</string>
-
<!-- Label for button in contextual card for users to remove the card [CHAR LIMIT=30] -->
<string name="contextual_card_dismiss_remove">Remove</string>
<!-- Label for button in contextual card for users to keep the card [CHAR LIMIT=30] -->
diff --git a/res/xml/development_settings.xml b/res/xml/development_settings.xml
index df703f5..72855f0 100644
--- a/res/xml/development_settings.xml
+++ b/res/xml/development_settings.xml
@@ -525,11 +525,6 @@
android:title="@string/usb_audio_disable_routing"
android:summary="@string/usb_audio_disable_routing_summary" />
- <SwitchPreference
- android:key="quick_settings_media_player"
- android:title="@string/quick_settings_media_player"
- android:summary="@string/quick_settings_media_player_summary" />
-
</PreferenceCategory>
<PreferenceCategory
diff --git a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
index 73ff534..b668aef 100644
--- a/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
+++ b/src/com/android/settings/development/DevelopmentSettingsDashboardFragment.java
@@ -491,7 +491,6 @@
controllers.add(new DebugNonRectClipOperationsPreferenceController(context));
controllers.add(new ForceDarkPreferenceController(context));
controllers.add(new EnableBlursPreferenceController(context));
- controllers.add(new QuickSettingsMediaPlayerPreferenceController(context));
controllers.add(new ForceMSAAPreferenceController(context));
controllers.add(new HardwareOverlaysPreferenceController(context));
controllers.add(new SimulateColorSpacePreferenceController(context));
diff --git a/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceController.java b/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceController.java
deleted file mode 100644
index 47f3adc..0000000
--- a/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceController.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (C) 2020 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.development;
-
-import android.content.Context;
-import android.provider.Settings;
-
-import androidx.annotation.VisibleForTesting;
-import androidx.preference.Preference;
-import androidx.preference.SwitchPreference;
-
-import com.android.settings.core.PreferenceControllerMixin;
-import com.android.settingslib.development.DeveloperOptionsPreferenceController;
-
-/**
- * Controls whether the media player should be visible in quick settings.
- */
-public class QuickSettingsMediaPlayerPreferenceController extends
- DeveloperOptionsPreferenceController implements Preference.OnPreferenceChangeListener,
- PreferenceControllerMixin {
- private static final String PREFERENCE_KEY = "quick_settings_media_player";
- @VisibleForTesting
- static final String SETTING_NAME = Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS;
- @VisibleForTesting
- static final int SETTING_VALUE_ON = 1;
- @VisibleForTesting
- static final int SETTING_VALUE_OFF = 0;
-
- public QuickSettingsMediaPlayerPreferenceController(Context context) {
- super(context);
- }
-
- @Override
- public String getPreferenceKey() {
- return PREFERENCE_KEY;
- }
-
- @Override
- public boolean onPreferenceChange(Preference preference, Object newValue) {
- final boolean isEnabled = (Boolean) newValue;
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME,
- isEnabled ? SETTING_VALUE_ON : SETTING_VALUE_OFF);
- return true;
- }
-
- @Override
- public void updateState(Preference preference) {
- final int mode = Settings.Global.getInt(mContext.getContentResolver(), SETTING_NAME,
- SETTING_VALUE_OFF);
- ((SwitchPreference) mPreference).setChecked(mode != SETTING_VALUE_OFF);
- }
-
- @Override
- protected void onDeveloperOptionsSwitchDisabled() {
- super.onDeveloperOptionsSwitchDisabled();
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_OFF);
- ((SwitchPreference) mPreference).setChecked(false);
- }
-}
diff --git a/tests/robotests/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceControllerTest.java
deleted file mode 100644
index 10eed2f..0000000
--- a/tests/robotests/src/com/android/settings/development/QuickSettingsMediaPlayerPreferenceControllerTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Copyright (C) 2020 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.development;
-
-import static com.android.settings.development.QuickSettingsMediaPlayerPreferenceController.SETTING_NAME;
-import static com.android.settings.development.QuickSettingsMediaPlayerPreferenceController.SETTING_VALUE_OFF;
-import static com.android.settings.development.QuickSettingsMediaPlayerPreferenceController.SETTING_VALUE_ON;
-
-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.provider.Settings;
-
-import androidx.preference.PreferenceScreen;
-import androidx.preference.SwitchPreference;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnit;
-import org.mockito.junit.MockitoRule;
-import org.robolectric.RobolectricTestRunner;
-import org.robolectric.RuntimeEnvironment;
-
-@RunWith(RobolectricTestRunner.class)
-public class QuickSettingsMediaPlayerPreferenceControllerTest {
- @Mock
- private SwitchPreference mPreference;
- @Mock
- private PreferenceScreen mPreferenceScreen;
- @Rule
- public MockitoRule mMockitoRule = MockitoJUnit.rule();
-
- private Context mContext;
- private QuickSettingsMediaPlayerPreferenceController mController;
-
- @Before
- public void setup() {
- mContext = RuntimeEnvironment.application;
- mController = new QuickSettingsMediaPlayerPreferenceController(mContext);
- when(mPreferenceScreen.findPreference(mController.getPreferenceKey()))
- .thenReturn(mPreference);
- mController.displayPreference(mPreferenceScreen);
- }
-
- @Test
- public void onPreferenceChanged_turnOnPreference_shouldEnable() {
- mController.onPreferenceChange(mPreference, true /* new value */);
-
- final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- SETTING_NAME, -1 /* default */);
-
- assertThat(mode).isEqualTo(SETTING_VALUE_ON);
- }
-
- @Test
- public void onPreferenceChanged_turnOffPreference_shouldDisable() {
- mController.onPreferenceChange(mPreference, false /* new value */);
-
- final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- SETTING_NAME, -1 /* default */);
-
- assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
- }
-
- @Test
- public void updateState_settingEnabled_preferenceShouldBeChecked() {
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_ON);
- mController.updateState(mPreference);
-
- verify(mPreference).setChecked(true);
- }
-
- @Test
- public void updateState_settingDisabled_preferenceShouldNotBeChecked() {
- Settings.Global.putInt(mContext.getContentResolver(), SETTING_NAME, SETTING_VALUE_OFF);
- mController.updateState(mPreference);
-
- verify(mPreference).setChecked(false);
- }
-
- @Test
- public void onDeveloperOptionsSwitchDisabled_shouldDisable() {
- mController.onDeveloperOptionsSwitchDisabled();
- final int mode = Settings.Global.getInt(mContext.getContentResolver(),
- SETTING_NAME, -1 /* default */);
-
- assertThat(mode).isEqualTo(SETTING_VALUE_OFF);
- verify(mPreference).setEnabled(false);
- verify(mPreference).setChecked(false);
- }
-}