Loading core/java/android/provider/Settings.java +2 −4 Original line number Diff line number Diff line Loading @@ -9850,12 +9850,10 @@ public final class Settings { public static final String MEDIA_CONTROLS_RESUME = "qs_media_resumption"; /** * Controls which packages are blocked from persisting in media controls when resumption is * enabled. The list of packages is set by the user in the Settings app. * @see Settings.Secure#MEDIA_CONTROLS_RESUME * Controls whether contextual suggestions can be shown in the media controls. * @hide */ public static final String MEDIA_CONTROLS_RESUME_BLOCKED = "qs_media_resumption_blocked"; public static final String MEDIA_CONTROLS_RECOMMENDATION = "qs_media_recommend"; /** * Controls magnification mode when magnification is enabled via a system-wide triple tap Loading packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -169,7 +169,7 @@ public class SecureSettings { Settings.Secure.AWARE_TAP_PAUSE_TOUCH_COUNT, Settings.Secure.PEOPLE_STRIP, Settings.Secure.MEDIA_CONTROLS_RESUME, Settings.Secure.MEDIA_CONTROLS_RESUME_BLOCKED, Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION, 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 −2 Original line number Diff line number Diff line Loading @@ -251,8 +251,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.TAP_GESTURE, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.PEOPLE_STRIP, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RESUME, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RESUME_BLOCKED, COLON_SEPARATED_PACKAGE_LIST_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RECOMMENDATION, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_MAGNIFICATION_MODE, new InclusiveIntegerRangeValidator( Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN, Loading packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +4 −22 Original line number Diff line number Diff line Loading @@ -138,17 +138,6 @@ class MediaDataManager( private val mediaEntries: LinkedHashMap<String, MediaData> = LinkedHashMap() // There should ONLY be at most one Smartspace media recommendation. private var smartspaceMediaTarget: SmartspaceTarget? = null internal var appsBlockedFromResume: MutableSet<String> = Utils.getBlockedMediaApps(context) set(value) { // Update list appsBlockedFromResume.clear() appsBlockedFromResume.addAll(value) // Remove any existing resume players that are now blocked appsBlockedFromResume.forEach { removeAllForPackage(it) } } private var smartspaceSession: SmartspaceSession? = null @Inject Loading Loading @@ -690,7 +679,9 @@ class MediaDataManager( } override fun onSmartspaceTargetsUpdated(targets: List<Parcelable>) { Log.d(TAG, "My Smartspace media updates are here") if (!Utils.allowMediaRecommendations(context)) { return } val mediaTargets = targets.filterIsInstance<SmartspaceTarget>() when (mediaTargets.size) { 0 -> { Loading Loading @@ -736,8 +727,7 @@ class MediaDataManager( fun onNotificationRemoved(key: String) { Assert.isMainThread() val removed = mediaEntries.remove(key) if (useMediaResumption && removed?.resumeAction != null && !isBlockedFromResume(removed.packageName) && removed?.isLocalSession == true) { if (useMediaResumption && removed?.resumeAction != null && removed?.isLocalSession) { Log.d(TAG, "Not removing $key because resumable") // Move to resume key (aka package name) if that key doesn't already exist. val resumeAction = getResumeMediaAction(removed.resumeAction!!) Loading Loading @@ -765,13 +755,6 @@ class MediaDataManager( } } private fun isBlockedFromResume(packageName: String?): Boolean { if (packageName == null) { return true } return appsBlockedFromResume.contains(packageName) } fun setMediaResumptionEnabled(isEnabled: Boolean) { if (useMediaResumption == isEnabled) { return Loading Loading @@ -844,7 +827,6 @@ class MediaDataManager( println("externalListeners: ${mediaDataFilter.listeners}") println("mediaEntries: $mediaEntries") println("useMediaResumption: $useMediaResumption") println("appsBlockedFromResume: $appsBlockedFromResume") } } } packages/SystemUI/src/com/android/systemui/media/MediaResumeListener.kt +3 −15 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ class MediaResumeListener @Inject constructor( private var useMediaResumption: Boolean = Utils.useMediaResumption(context) private val resumeComponents: ConcurrentLinkedQueue<ComponentName> = ConcurrentLinkedQueue() private var blockedApps: MutableSet<String> = Utils.getBlockedMediaApps(context) private lateinit var mediaDataManager: MediaDataManager Loading Loading @@ -123,14 +122,6 @@ class MediaResumeListener @Inject constructor( mediaDataManager.setMediaResumptionEnabled(useMediaResumption) } }, Settings.Secure.MEDIA_CONTROLS_RESUME) // Listen to changes in which apps are allowed to persist tunerService.addTunable(object : TunerService.Tunable { override fun onTuningChanged(key: String?, newValue: String?) { blockedApps = Utils.getBlockedMediaApps(context) mediaDataManager.appsBlockedFromResume = blockedApps } }, Settings.Secure.MEDIA_CONTROLS_RESUME_BLOCKED) } private fun loadSavedComponents() { Loading Loading @@ -159,12 +150,10 @@ class MediaResumeListener @Inject constructor( } resumeComponents.forEach { if (!blockedApps.contains(it.packageName)) { val browser = mediaBrowserFactory.create(mediaBrowserCallback, it) browser.findRecentMedia() } } } override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) { if (useMediaResumption) { Loading @@ -172,8 +161,7 @@ class MediaResumeListener @Inject constructor( mediaBrowser?.disconnect() mediaBrowser = null // If we don't have a resume action, check if we haven't already if (data.resumeAction == null && !data.hasCheckedForResume && !blockedApps.contains(data.packageName) && data.isLocalSession) { if (data.resumeAction == null && !data.hasCheckedForResume && data.isLocalSession) { // TODO also check for a media button receiver intended for restarting (b/154127084) Log.d(TAG, "Checking for service component for " + data.packageName) val pm = context.packageManager Loading Loading
core/java/android/provider/Settings.java +2 −4 Original line number Diff line number Diff line Loading @@ -9850,12 +9850,10 @@ public final class Settings { public static final String MEDIA_CONTROLS_RESUME = "qs_media_resumption"; /** * Controls which packages are blocked from persisting in media controls when resumption is * enabled. The list of packages is set by the user in the Settings app. * @see Settings.Secure#MEDIA_CONTROLS_RESUME * Controls whether contextual suggestions can be shown in the media controls. * @hide */ public static final String MEDIA_CONTROLS_RESUME_BLOCKED = "qs_media_resumption_blocked"; public static final String MEDIA_CONTROLS_RECOMMENDATION = "qs_media_recommend"; /** * Controls magnification mode when magnification is enabled via a system-wide triple tap Loading
packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +1 −1 Original line number Diff line number Diff line Loading @@ -169,7 +169,7 @@ public class SecureSettings { Settings.Secure.AWARE_TAP_PAUSE_TOUCH_COUNT, Settings.Secure.PEOPLE_STRIP, Settings.Secure.MEDIA_CONTROLS_RESUME, Settings.Secure.MEDIA_CONTROLS_RESUME_BLOCKED, Settings.Secure.MEDIA_CONTROLS_RECOMMENDATION, 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 −2 Original line number Diff line number Diff line Loading @@ -251,8 +251,7 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.TAP_GESTURE, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.PEOPLE_STRIP, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RESUME, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RESUME_BLOCKED, COLON_SEPARATED_PACKAGE_LIST_VALIDATOR); VALIDATORS.put(Secure.MEDIA_CONTROLS_RECOMMENDATION, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_MAGNIFICATION_MODE, new InclusiveIntegerRangeValidator( Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN, Loading
packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +4 −22 Original line number Diff line number Diff line Loading @@ -138,17 +138,6 @@ class MediaDataManager( private val mediaEntries: LinkedHashMap<String, MediaData> = LinkedHashMap() // There should ONLY be at most one Smartspace media recommendation. private var smartspaceMediaTarget: SmartspaceTarget? = null internal var appsBlockedFromResume: MutableSet<String> = Utils.getBlockedMediaApps(context) set(value) { // Update list appsBlockedFromResume.clear() appsBlockedFromResume.addAll(value) // Remove any existing resume players that are now blocked appsBlockedFromResume.forEach { removeAllForPackage(it) } } private var smartspaceSession: SmartspaceSession? = null @Inject Loading Loading @@ -690,7 +679,9 @@ class MediaDataManager( } override fun onSmartspaceTargetsUpdated(targets: List<Parcelable>) { Log.d(TAG, "My Smartspace media updates are here") if (!Utils.allowMediaRecommendations(context)) { return } val mediaTargets = targets.filterIsInstance<SmartspaceTarget>() when (mediaTargets.size) { 0 -> { Loading Loading @@ -736,8 +727,7 @@ class MediaDataManager( fun onNotificationRemoved(key: String) { Assert.isMainThread() val removed = mediaEntries.remove(key) if (useMediaResumption && removed?.resumeAction != null && !isBlockedFromResume(removed.packageName) && removed?.isLocalSession == true) { if (useMediaResumption && removed?.resumeAction != null && removed?.isLocalSession) { Log.d(TAG, "Not removing $key because resumable") // Move to resume key (aka package name) if that key doesn't already exist. val resumeAction = getResumeMediaAction(removed.resumeAction!!) Loading Loading @@ -765,13 +755,6 @@ class MediaDataManager( } } private fun isBlockedFromResume(packageName: String?): Boolean { if (packageName == null) { return true } return appsBlockedFromResume.contains(packageName) } fun setMediaResumptionEnabled(isEnabled: Boolean) { if (useMediaResumption == isEnabled) { return Loading Loading @@ -844,7 +827,6 @@ class MediaDataManager( println("externalListeners: ${mediaDataFilter.listeners}") println("mediaEntries: $mediaEntries") println("useMediaResumption: $useMediaResumption") println("appsBlockedFromResume: $appsBlockedFromResume") } } }
packages/SystemUI/src/com/android/systemui/media/MediaResumeListener.kt +3 −15 Original line number Diff line number Diff line Loading @@ -58,7 +58,6 @@ class MediaResumeListener @Inject constructor( private var useMediaResumption: Boolean = Utils.useMediaResumption(context) private val resumeComponents: ConcurrentLinkedQueue<ComponentName> = ConcurrentLinkedQueue() private var blockedApps: MutableSet<String> = Utils.getBlockedMediaApps(context) private lateinit var mediaDataManager: MediaDataManager Loading Loading @@ -123,14 +122,6 @@ class MediaResumeListener @Inject constructor( mediaDataManager.setMediaResumptionEnabled(useMediaResumption) } }, Settings.Secure.MEDIA_CONTROLS_RESUME) // Listen to changes in which apps are allowed to persist tunerService.addTunable(object : TunerService.Tunable { override fun onTuningChanged(key: String?, newValue: String?) { blockedApps = Utils.getBlockedMediaApps(context) mediaDataManager.appsBlockedFromResume = blockedApps } }, Settings.Secure.MEDIA_CONTROLS_RESUME_BLOCKED) } private fun loadSavedComponents() { Loading Loading @@ -159,12 +150,10 @@ class MediaResumeListener @Inject constructor( } resumeComponents.forEach { if (!blockedApps.contains(it.packageName)) { val browser = mediaBrowserFactory.create(mediaBrowserCallback, it) browser.findRecentMedia() } } } override fun onMediaDataLoaded(key: String, oldKey: String?, data: MediaData) { if (useMediaResumption) { Loading @@ -172,8 +161,7 @@ class MediaResumeListener @Inject constructor( mediaBrowser?.disconnect() mediaBrowser = null // If we don't have a resume action, check if we haven't already if (data.resumeAction == null && !data.hasCheckedForResume && !blockedApps.contains(data.packageName) && data.isLocalSession) { if (data.resumeAction == null && !data.hasCheckedForResume && data.isLocalSession) { // TODO also check for a media button receiver intended for restarting (b/154127084) Log.d(TAG, "Checking for service component for " + data.packageName) val pm = context.packageManager Loading