Loading core/java/android/provider/Settings.java +7 −0 Original line number Diff line number Diff line Loading @@ -10590,6 +10590,13 @@ public final class Settings { @Readable public static final String MEDIA_CONTROLS_RESUME = "qs_media_resumption"; /** * Whether to enable media controls on lock screen. * When enabled, media controls will appear on lock screen. * @hide */ public static final String MEDIA_CONTROLS_LOCK_SCREEN = "media_controls_lock_screen"; /** * Controls whether contextual suggestions can be shown in the media controls. * @hide Loading packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ public class SecureSettings { Settings.Secure.PEOPLE_STRIP, Settings.Secure.MEDIA_CONTROLS_RESUME, Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION, Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY, Loading packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.PEOPLE_STRIP, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RESUME, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RECOMMENDATION, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_LOCK_SCREEN, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_MAGNIFICATION_MODE, new InclusiveIntegerRangeValidator( Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN, Loading packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt +36 −4 Original line number Diff line number Diff line Loading @@ -18,19 +18,25 @@ package com.android.systemui.media import android.content.Context import android.content.res.Configuration import android.database.ContentObserver import android.net.Uri import android.os.Handler import android.os.UserHandle import android.provider.Settings import android.view.View import android.view.ViewGroup import androidx.annotation.VisibleForTesting import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.media.dagger.MediaModule.KEYGUARD import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.stack.MediaContainerView import com.android.systemui.statusbar.phone.KeyguardBypassController import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.util.LargeScreenUtils import com.android.systemui.util.settings.SecureSettings import javax.inject.Inject import javax.inject.Named Loading @@ -43,9 +49,10 @@ class KeyguardMediaController @Inject constructor( @param:Named(KEYGUARD) private val mediaHost: MediaHost, private val bypassController: KeyguardBypassController, private val statusBarStateController: SysuiStatusBarStateController, private val notifLockscreenUserManager: NotificationLockscreenUserManager, private val context: Context, configurationController: ConfigurationController private val secureSettings: SecureSettings, @Main private val handler: Handler, configurationController: ConfigurationController, ) { init { Loading @@ -60,6 +67,24 @@ class KeyguardMediaController @Inject constructor( } }) val settingsObserver: ContentObserver = object : ContentObserver(handler) { override fun onChange(selfChange: Boolean, uri: Uri?) { if (uri == lockScreenMediaPlayerUri) { allowMediaPlayerOnLockScreen = secureSettings.getBoolForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, true, UserHandle.USER_CURRENT ) refreshMediaPosition() } } } secureSettings.registerContentObserverForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, settingsObserver, UserHandle.USER_ALL) // First let's set the desired state that we want for this host mediaHost.expansion = MediaHostState.EXPANDED mediaHost.showsOnlyActiveMedia = true Loading Loading @@ -100,6 +125,13 @@ class KeyguardMediaController @Inject constructor( private set private var splitShadeContainer: ViewGroup? = null /** * Track the media player setting status on lock screen. */ private var allowMediaPlayerOnLockScreen: Boolean = true private val lockScreenMediaPlayerUri = secureSettings.getUriFor(Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN) /** * Attaches media container in single pane mode, situated at the top of the notifications list */ Loading Loading @@ -164,7 +196,7 @@ class KeyguardMediaController @Inject constructor( visible = mediaHost.visible && !bypassController.bypassEnabled && keyguardOrUserSwitcher && notifLockscreenUserManager.shouldShowLockscreenNotifications() allowMediaPlayerOnLockScreen if (visible) { showMediaPlayer() } else { Loading packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt +35 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,12 @@ import android.animation.ValueAnimator import android.annotation.IntDef import android.content.Context import android.content.res.Configuration import android.database.ContentObserver import android.graphics.Rect import android.net.Uri import android.os.Handler import android.os.UserHandle import android.provider.Settings import android.util.Log import android.util.MathUtils import android.view.View Loading @@ -33,12 +38,12 @@ import com.android.keyguard.KeyguardViewController import com.android.systemui.R import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dreams.DreamOverlayStateController import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.NotifPanelEvents import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.stack.StackStateAnimator Loading @@ -47,6 +52,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.LargeScreenUtils import com.android.systemui.util.animation.UniqueObjectHostView import com.android.systemui.util.settings.SecureSettings import com.android.systemui.util.traceSection import javax.inject.Inject Loading Loading @@ -85,14 +91,22 @@ class MediaHierarchyManager @Inject constructor( private val keyguardStateController: KeyguardStateController, private val bypassController: KeyguardBypassController, private val mediaCarouselController: MediaCarouselController, private val notifLockscreenUserManager: NotificationLockscreenUserManager, private val keyguardViewController: KeyguardViewController, private val dreamOverlayStateController: DreamOverlayStateController, configurationController: ConfigurationController, wakefulnessLifecycle: WakefulnessLifecycle, panelEventsEvents: NotifPanelEvents, private val secureSettings: SecureSettings, @Main private val handler: Handler, ) { /** * Track the media player setting status on lock screen. */ private var allowMediaPlayerOnLockScreen: Boolean = true private val lockScreenMediaPlayerUri = secureSettings.getUriFor(Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN) /** * Whether we "skip" QQS during panel expansion. * Loading Loading @@ -521,6 +535,23 @@ class MediaHierarchyManager @Inject constructor( updateDesiredLocation() } }) val settingsObserver: ContentObserver = object : ContentObserver(handler) { override fun onChange(selfChange: Boolean, uri: Uri?) { if (uri == lockScreenMediaPlayerUri) { allowMediaPlayerOnLockScreen = secureSettings.getBoolForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, true, UserHandle.USER_CURRENT ) } } } secureSettings.registerContentObserverForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, settingsObserver, UserHandle.USER_ALL) } private fun updateConfiguration() { Loading Loading @@ -1036,7 +1067,6 @@ class MediaHierarchyManager @Inject constructor( } val onLockscreen = (!bypassController.bypassEnabled && (statusbarState == StatusBarState.KEYGUARD)) val allowedOnLockscreen = notifLockscreenUserManager.shouldShowLockscreenNotifications() val location = when { dreamOverlayActive -> LOCATION_DREAM_OVERLAY (qsExpansion > 0.0f || inSplitShade) && !onLockscreen -> LOCATION_QS Loading @@ -1044,7 +1074,7 @@ class MediaHierarchyManager @Inject constructor( !hasActiveMedia -> LOCATION_QS onLockscreen && isSplitShadeExpanding() -> LOCATION_QS onLockscreen && isTransformingToFullShadeAndInQQS() -> LOCATION_QQS onLockscreen && allowedOnLockscreen -> LOCATION_LOCKSCREEN onLockscreen && allowMediaPlayerOnLockScreen -> LOCATION_LOCKSCREEN else -> LOCATION_QQS } // When we're on lock screen and the player is not active, we should keep it in QS. Loading Loading @@ -1116,7 +1146,7 @@ class MediaHierarchyManager @Inject constructor( return !statusBarStateController.isDozing && !keyguardViewController.isBouncerShowing && statusBarStateController.state == StatusBarState.KEYGUARD && notifLockscreenUserManager.shouldShowLockscreenNotifications() && allowMediaPlayerOnLockScreen && statusBarStateController.isExpanded && !qsExpanded } Loading Loading
core/java/android/provider/Settings.java +7 −0 Original line number Diff line number Diff line Loading @@ -10590,6 +10590,13 @@ public final class Settings { @Readable public static final String MEDIA_CONTROLS_RESUME = "qs_media_resumption"; /** * Whether to enable media controls on lock screen. * When enabled, media controls will appear on lock screen. * @hide */ public static final String MEDIA_CONTROLS_LOCK_SCREEN = "media_controls_lock_screen"; /** * Controls whether contextual suggestions can be shown in the media controls. * @hide Loading
packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −0 Original line number Diff line number Diff line Loading @@ -182,6 +182,7 @@ public class SecureSettings { Settings.Secure.PEOPLE_STRIP, Settings.Secure.MEDIA_CONTROLS_RESUME, Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION, Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY, Loading
packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +1 −0 Original line number Diff line number Diff line Loading @@ -277,6 +277,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.PEOPLE_STRIP, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RESUME, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RECOMMENDATION, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_LOCK_SCREEN, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_MAGNIFICATION_MODE, new InclusiveIntegerRangeValidator( Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN, Loading
packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt +36 −4 Original line number Diff line number Diff line Loading @@ -18,19 +18,25 @@ package com.android.systemui.media import android.content.Context import android.content.res.Configuration import android.database.ContentObserver import android.net.Uri import android.os.Handler import android.os.UserHandle import android.provider.Settings import android.view.View import android.view.ViewGroup import androidx.annotation.VisibleForTesting import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.media.dagger.MediaModule.KEYGUARD import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.stack.MediaContainerView import com.android.systemui.statusbar.phone.KeyguardBypassController import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.util.LargeScreenUtils import com.android.systemui.util.settings.SecureSettings import javax.inject.Inject import javax.inject.Named Loading @@ -43,9 +49,10 @@ class KeyguardMediaController @Inject constructor( @param:Named(KEYGUARD) private val mediaHost: MediaHost, private val bypassController: KeyguardBypassController, private val statusBarStateController: SysuiStatusBarStateController, private val notifLockscreenUserManager: NotificationLockscreenUserManager, private val context: Context, configurationController: ConfigurationController private val secureSettings: SecureSettings, @Main private val handler: Handler, configurationController: ConfigurationController, ) { init { Loading @@ -60,6 +67,24 @@ class KeyguardMediaController @Inject constructor( } }) val settingsObserver: ContentObserver = object : ContentObserver(handler) { override fun onChange(selfChange: Boolean, uri: Uri?) { if (uri == lockScreenMediaPlayerUri) { allowMediaPlayerOnLockScreen = secureSettings.getBoolForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, true, UserHandle.USER_CURRENT ) refreshMediaPosition() } } } secureSettings.registerContentObserverForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, settingsObserver, UserHandle.USER_ALL) // First let's set the desired state that we want for this host mediaHost.expansion = MediaHostState.EXPANDED mediaHost.showsOnlyActiveMedia = true Loading Loading @@ -100,6 +125,13 @@ class KeyguardMediaController @Inject constructor( private set private var splitShadeContainer: ViewGroup? = null /** * Track the media player setting status on lock screen. */ private var allowMediaPlayerOnLockScreen: Boolean = true private val lockScreenMediaPlayerUri = secureSettings.getUriFor(Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN) /** * Attaches media container in single pane mode, situated at the top of the notifications list */ Loading Loading @@ -164,7 +196,7 @@ class KeyguardMediaController @Inject constructor( visible = mediaHost.visible && !bypassController.bypassEnabled && keyguardOrUserSwitcher && notifLockscreenUserManager.shouldShowLockscreenNotifications() allowMediaPlayerOnLockScreen if (visible) { showMediaPlayer() } else { Loading
packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt +35 −5 Original line number Diff line number Diff line Loading @@ -22,7 +22,12 @@ import android.animation.ValueAnimator import android.annotation.IntDef import android.content.Context import android.content.res.Configuration import android.database.ContentObserver import android.graphics.Rect import android.net.Uri import android.os.Handler import android.os.UserHandle import android.provider.Settings import android.util.Log import android.util.MathUtils import android.view.View Loading @@ -33,12 +38,12 @@ import com.android.keyguard.KeyguardViewController import com.android.systemui.R import com.android.systemui.animation.Interpolators import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.dreams.DreamOverlayStateController import com.android.systemui.keyguard.WakefulnessLifecycle import com.android.systemui.plugins.statusbar.StatusBarStateController import com.android.systemui.shade.NotifPanelEvents import com.android.systemui.statusbar.CrossFadeHelper import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.stack.StackStateAnimator Loading @@ -47,6 +52,7 @@ import com.android.systemui.statusbar.policy.ConfigurationController import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.LargeScreenUtils import com.android.systemui.util.animation.UniqueObjectHostView import com.android.systemui.util.settings.SecureSettings import com.android.systemui.util.traceSection import javax.inject.Inject Loading Loading @@ -85,14 +91,22 @@ class MediaHierarchyManager @Inject constructor( private val keyguardStateController: KeyguardStateController, private val bypassController: KeyguardBypassController, private val mediaCarouselController: MediaCarouselController, private val notifLockscreenUserManager: NotificationLockscreenUserManager, private val keyguardViewController: KeyguardViewController, private val dreamOverlayStateController: DreamOverlayStateController, configurationController: ConfigurationController, wakefulnessLifecycle: WakefulnessLifecycle, panelEventsEvents: NotifPanelEvents, private val secureSettings: SecureSettings, @Main private val handler: Handler, ) { /** * Track the media player setting status on lock screen. */ private var allowMediaPlayerOnLockScreen: Boolean = true private val lockScreenMediaPlayerUri = secureSettings.getUriFor(Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN) /** * Whether we "skip" QQS during panel expansion. * Loading Loading @@ -521,6 +535,23 @@ class MediaHierarchyManager @Inject constructor( updateDesiredLocation() } }) val settingsObserver: ContentObserver = object : ContentObserver(handler) { override fun onChange(selfChange: Boolean, uri: Uri?) { if (uri == lockScreenMediaPlayerUri) { allowMediaPlayerOnLockScreen = secureSettings.getBoolForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, true, UserHandle.USER_CURRENT ) } } } secureSettings.registerContentObserverForUser( Settings.Secure.MEDIA_CONTROLS_LOCK_SCREEN, settingsObserver, UserHandle.USER_ALL) } private fun updateConfiguration() { Loading Loading @@ -1036,7 +1067,6 @@ class MediaHierarchyManager @Inject constructor( } val onLockscreen = (!bypassController.bypassEnabled && (statusbarState == StatusBarState.KEYGUARD)) val allowedOnLockscreen = notifLockscreenUserManager.shouldShowLockscreenNotifications() val location = when { dreamOverlayActive -> LOCATION_DREAM_OVERLAY (qsExpansion > 0.0f || inSplitShade) && !onLockscreen -> LOCATION_QS Loading @@ -1044,7 +1074,7 @@ class MediaHierarchyManager @Inject constructor( !hasActiveMedia -> LOCATION_QS onLockscreen && isSplitShadeExpanding() -> LOCATION_QS onLockscreen && isTransformingToFullShadeAndInQQS() -> LOCATION_QQS onLockscreen && allowedOnLockscreen -> LOCATION_LOCKSCREEN onLockscreen && allowMediaPlayerOnLockScreen -> LOCATION_LOCKSCREEN else -> LOCATION_QQS } // When we're on lock screen and the player is not active, we should keep it in QS. Loading Loading @@ -1116,7 +1146,7 @@ class MediaHierarchyManager @Inject constructor( return !statusBarStateController.isDozing && !keyguardViewController.isBouncerShowing && statusBarStateController.state == StatusBarState.KEYGUARD && notifLockscreenUserManager.shouldShowLockscreenNotifications() && allowMediaPlayerOnLockScreen && statusBarStateController.isExpanded && !qsExpanded } Loading