diff options
| -rw-r--r-- | core/res/res/values/config.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 2 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/util/Utils.java | 10 | ||||
| -rw-r--r-- | services/core/java/com/android/server/notification/PreferencesHelper.java | 10 |
4 files changed, 18 insertions, 7 deletions
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 387a1083c6d6..bf8e55fd986f 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -6856,4 +6856,7 @@ <!-- Whether the View-based scroll haptic feedback implementation is enabled for {@link InputDevice#SOURCE_ROTARY_ENCODER}s. --> <bool name="config_viewBasedRotaryEncoderHapticsEnabled">false</bool> + + <!-- Whether the media player is shown on the quick settings --> + <bool name="config_quickSettingsShowMediaPlayer">true</bool> </resources> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index a5b102836816..5791ddb8addf 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -5298,4 +5298,6 @@ <java-symbol type="array" name="config_tvExternalInputLoggingDeviceBrandNames" /> <java-symbol type="bool" name="config_viewRotaryEncoderHapticScrollFedbackEnabled" /> <java-symbol type="bool" name="config_viewBasedRotaryEncoderHapticsEnabled" /> + + <java-symbol type="bool" name="config_quickSettingsShowMediaPlayer" /> </resources> diff --git a/packages/SystemUI/src/com/android/systemui/util/Utils.java b/packages/SystemUI/src/com/android/systemui/util/Utils.java index f5edb7bb5b73..fa6d0552c9e9 100644 --- a/packages/SystemUI/src/com/android/systemui/util/Utils.java +++ b/packages/SystemUI/src/com/android/systemui/util/Utils.java @@ -83,17 +83,19 @@ public class Utils { /** * Allow the media player to be shown in the QS area, controlled by 2 flags. - * Off by default, but can be disabled by setting to 0 + * On by default, but can be disabled by setting either flag to 0/false. */ public static boolean useQsMediaPlayer(Context context) { - // TODO(b/192412820): Replace SHOW_MEDIA_ON_QUICK_SETTINGS with compile-time value // Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS can't be toggled at runtime, so simply // cache the first result we fetch and use that going forward. Do this to avoid unnecessary // binder calls which may happen on the critical path. if (sUseQsMediaPlayer == null) { - int flag = Settings.Global.getInt(context.getContentResolver(), + // TODO(b/192412820): Consolidate SHOW_MEDIA_ON_QUICK_SETTINGS into compile-time value. + final int settingsFlag = Settings.Global.getInt(context.getContentResolver(), Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS, 1); - sUseQsMediaPlayer = flag > 0; + final boolean configFlag = context.getResources() + .getBoolean(com.android.internal.R.bool.config_quickSettingsShowMediaPlayer); + sUseQsMediaPlayer = settingsFlag > 0 && configFlag; } return sUseQsMediaPlayer; } diff --git a/services/core/java/com/android/server/notification/PreferencesHelper.java b/services/core/java/com/android/server/notification/PreferencesHelper.java index fd86870e5163..1bafcfe94267 100644 --- a/services/core/java/com/android/server/notification/PreferencesHelper.java +++ b/services/core/java/com/android/server/notification/PreferencesHelper.java @@ -161,7 +161,6 @@ public class PreferencesHelper implements RankingConfig { static final boolean DEFAULT_BUBBLES_ENABLED = true; @VisibleForTesting static final int DEFAULT_BUBBLE_PREFERENCE = BUBBLE_PREFERENCE_NONE; - static final boolean DEFAULT_MEDIA_NOTIFICATION_FILTERING = true; private static final int NOTIFICATION_UPDATE_LOG_SUBTYPE_FROM_APP = 0; private static final int NOTIFICATION_UPDATE_LOG_SUBTYPE_FROM_USER = 1; @@ -200,7 +199,7 @@ public class PreferencesHelper implements RankingConfig { private SparseBooleanArray mBubblesEnabled; private SparseBooleanArray mLockScreenShowNotifications; private SparseBooleanArray mLockScreenPrivateNotifications; - private boolean mIsMediaNotificationFilteringEnabled = DEFAULT_MEDIA_NOTIFICATION_FILTERING; + private boolean mIsMediaNotificationFilteringEnabled; // When modes_api flag is enabled, this value only tracks whether the current user has any // channels marked as "priority channels", but not necessarily whether they are permitted // to bypass DND by current zen policy. @@ -224,6 +223,8 @@ public class PreferencesHelper implements RankingConfig { mAppOps = appOpsManager; mUserProfiles = userProfiles; mShowReviewPermissionsNotification = showReviewPermissionsNotification; + mIsMediaNotificationFilteringEnabled = context.getResources() + .getBoolean(R.bool.config_quickSettingsShowMediaPlayer); XML_VERSION = 4; @@ -2692,8 +2693,11 @@ public class PreferencesHelper implements RankingConfig { /** Requests check of the feature setting for showing media notifications in quick settings. */ public void updateMediaNotificationFilteringEnabled() { + // TODO(b/192412820): Consolidate SHOW_MEDIA_ON_QUICK_SETTINGS into compile-time value. final boolean newValue = Settings.Global.getInt(mContext.getContentResolver(), - Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS, 1) > 0; + Settings.Global.SHOW_MEDIA_ON_QUICK_SETTINGS, 1) > 0 + && mContext.getResources().getBoolean( + R.bool.config_quickSettingsShowMediaPlayer); if (newValue != mIsMediaNotificationFilteringEnabled) { mIsMediaNotificationFilteringEnabled = newValue; updateConfig(); |