Loading packages/SystemUI/src/com/android/systemui/media/MediaDataFilter.kt +4 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import javax.inject.Inject import javax.inject.Singleton private const val TAG = "MediaDataFilter" private const val DEBUG = true /** * Filters data updates from [MediaDataCombineLatest] based on the current user ID, and handles user Loading Loading @@ -98,7 +99,7 @@ class MediaDataFilter @Inject constructor( // are up to date mediaEntries.clear() keyCopy.forEach { Log.d(TAG, "Removing $it after user change") if (DEBUG) Log.d(TAG, "Removing $it after user change") listenersCopy.forEach { listener -> listener.onMediaDataRemoved(it) } Loading @@ -106,7 +107,7 @@ class MediaDataFilter @Inject constructor( dataSource.getData().forEach { (key, data) -> if (lockscreenUserManager.isCurrentProfile(data.userId)) { Log.d(TAG, "Re-adding $key after user change") if (DEBUG) Log.d(TAG, "Re-adding $key after user change") mediaEntries.put(key, data) listenersCopy.forEach { listener -> listener.onMediaDataLoaded(key, null, data) Loading @@ -119,6 +120,7 @@ class MediaDataFilter @Inject constructor( * Invoked when the user has dismissed the media carousel */ fun onSwipeToDismiss() { if (DEBUG) Log.d(TAG, "Media carousel swiped away") val mediaKeys = mediaEntries.keys.toSet() mediaKeys.forEach { mediaDataManager.setTimedOut(it, timedOut = true) Loading packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +9 −5 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ private val ART_URIS = arrayOf( ) private const val TAG = "MediaDataManager" private const val DEBUG = true private const val DEFAULT_LUMINOSITY = 0.25f private const val LUMINOSITY_THRESHOLD = 0.05f private const val SATURATION_MULTIPLIER = 0.8f Loading Loading @@ -265,7 +266,7 @@ class MediaDataManager( fun removeListener(listener: Listener) = listeners.remove(listener) /** * Called whenever the player has been paused or stopped for a while. * Called whenever the player has been paused or stopped for a while, or swiped from QQS. * This will make the player not active anymore, hiding it from QQS and Keyguard. * @see MediaData.active */ Loading @@ -275,6 +276,7 @@ class MediaDataManager( return } it.active = !timedOut if (DEBUG) Log.d(TAG, "Updating $token timedOut: $timedOut") onMediaDataLoaded(token, token, it) } } Loading Loading @@ -307,7 +309,9 @@ class MediaDataManager( return } if (DEBUG) { Log.d(TAG, "adding track for $userId from browser: $desc") } // Album art var artworkBitmap = desc.iconBitmap Loading Loading @@ -408,7 +412,7 @@ class MediaDataManager( if (actions != null) { for ((index, action) in actions.withIndex()) { if (action.getIcon() == null) { Log.i(TAG, "No icon for action $index ${action.title}") if (DEBUG) Log.i(TAG, "No icon for action $index ${action.title}") actionsToShowCollapsed.remove(index) continue } Loading Loading @@ -455,7 +459,7 @@ class MediaDataManager( if (!TextUtils.isEmpty(uriString)) { val albumArt = loadBitmapFromUri(Uri.parse(uriString)) if (albumArt != null) { Log.d(TAG, "loaded art from $uri") if (DEBUG) Log.d(TAG, "loaded art from $uri") return albumArt } } Loading Loading @@ -546,7 +550,7 @@ class MediaDataManager( val removed = mediaEntries.remove(key) if (useMediaResumption && removed?.resumeAction != null && !isBlockedFromResume(removed?.packageName)) { Log.d(TAG, "Not removing $key because resumable") if (DEBUG) 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!!) val updated = removed.copy(token = null, actions = listOf(resumeAction), Loading Loading
packages/SystemUI/src/com/android/systemui/media/MediaDataFilter.kt +4 −2 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import javax.inject.Inject import javax.inject.Singleton private const val TAG = "MediaDataFilter" private const val DEBUG = true /** * Filters data updates from [MediaDataCombineLatest] based on the current user ID, and handles user Loading Loading @@ -98,7 +99,7 @@ class MediaDataFilter @Inject constructor( // are up to date mediaEntries.clear() keyCopy.forEach { Log.d(TAG, "Removing $it after user change") if (DEBUG) Log.d(TAG, "Removing $it after user change") listenersCopy.forEach { listener -> listener.onMediaDataRemoved(it) } Loading @@ -106,7 +107,7 @@ class MediaDataFilter @Inject constructor( dataSource.getData().forEach { (key, data) -> if (lockscreenUserManager.isCurrentProfile(data.userId)) { Log.d(TAG, "Re-adding $key after user change") if (DEBUG) Log.d(TAG, "Re-adding $key after user change") mediaEntries.put(key, data) listenersCopy.forEach { listener -> listener.onMediaDataLoaded(key, null, data) Loading @@ -119,6 +120,7 @@ class MediaDataFilter @Inject constructor( * Invoked when the user has dismissed the media carousel */ fun onSwipeToDismiss() { if (DEBUG) Log.d(TAG, "Media carousel swiped away") val mediaKeys = mediaEntries.keys.toSet() mediaKeys.forEach { mediaDataManager.setTimedOut(it, timedOut = true) Loading
packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +9 −5 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ private val ART_URIS = arrayOf( ) private const val TAG = "MediaDataManager" private const val DEBUG = true private const val DEFAULT_LUMINOSITY = 0.25f private const val LUMINOSITY_THRESHOLD = 0.05f private const val SATURATION_MULTIPLIER = 0.8f Loading Loading @@ -265,7 +266,7 @@ class MediaDataManager( fun removeListener(listener: Listener) = listeners.remove(listener) /** * Called whenever the player has been paused or stopped for a while. * Called whenever the player has been paused or stopped for a while, or swiped from QQS. * This will make the player not active anymore, hiding it from QQS and Keyguard. * @see MediaData.active */ Loading @@ -275,6 +276,7 @@ class MediaDataManager( return } it.active = !timedOut if (DEBUG) Log.d(TAG, "Updating $token timedOut: $timedOut") onMediaDataLoaded(token, token, it) } } Loading Loading @@ -307,7 +309,9 @@ class MediaDataManager( return } if (DEBUG) { Log.d(TAG, "adding track for $userId from browser: $desc") } // Album art var artworkBitmap = desc.iconBitmap Loading Loading @@ -408,7 +412,7 @@ class MediaDataManager( if (actions != null) { for ((index, action) in actions.withIndex()) { if (action.getIcon() == null) { Log.i(TAG, "No icon for action $index ${action.title}") if (DEBUG) Log.i(TAG, "No icon for action $index ${action.title}") actionsToShowCollapsed.remove(index) continue } Loading Loading @@ -455,7 +459,7 @@ class MediaDataManager( if (!TextUtils.isEmpty(uriString)) { val albumArt = loadBitmapFromUri(Uri.parse(uriString)) if (albumArt != null) { Log.d(TAG, "loaded art from $uri") if (DEBUG) Log.d(TAG, "loaded art from $uri") return albumArt } } Loading Loading @@ -546,7 +550,7 @@ class MediaDataManager( val removed = mediaEntries.remove(key) if (useMediaResumption && removed?.resumeAction != null && !isBlockedFromResume(removed?.packageName)) { Log.d(TAG, "Not removing $key because resumable") if (DEBUG) 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!!) val updated = removed.copy(token = null, actions = listOf(resumeAction), Loading