Loading packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt +4 −3 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import javax.inject.Provider private const val TAG = "MediaCarouselController" private val settingsIntent = Intent().setAction(ACTION_MEDIA_CONTROLS_SETTINGS) private const val DEBUG = false /** * Class that is responsible for keeping the view carousel up to date. Loading Loading @@ -237,7 +238,7 @@ class MediaCarouselController @Inject constructor( data: SmartspaceMediaData, shouldPrioritize: Boolean ) { Log.d(TAG, "My Smartspace media update is here") if (DEBUG) Log.d(TAG, "Loading Smartspace media update") if (data.isActive) { addSmartspaceMediaRecommendations(key, data, shouldPrioritize) MediaPlayerData.getMediaPlayer(key, null)?.let { Loading Loading @@ -266,7 +267,7 @@ class MediaCarouselController @Inject constructor( } override fun onSmartspaceMediaDataRemoved(key: String, immediately: Boolean) { Log.d(TAG, "My Smartspace media removal request is received") if (DEBUG) Log.d(TAG, "My Smartspace media removal request is received") if (immediately || visualStabilityManager.isReorderingAllowed) { onMediaDataRemoved(key) } else { Loading Loading @@ -384,7 +385,7 @@ class MediaCarouselController @Inject constructor( data: SmartspaceMediaData, shouldPrioritize: Boolean ) { Log.d(TAG, "Updating smartspace target in carousel") if (DEBUG) Log.d(TAG, "Updating smartspace target in carousel") if (MediaPlayerData.getMediaPlayer(key, null) != null) { Log.w(TAG, "Skip adding smartspace target in carousel") return Loading packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +13 −11 Original line number Diff line number Diff line Loading @@ -453,7 +453,8 @@ class MediaDataManager( if (smartspaceMediaData.targetId != key) { return } Log.d(TAG, "Dismissing Smartspace media target") if (DEBUG) Log.d(TAG, "Dismissing Smartspace media target") if (smartspaceMediaData.isActive) { smartspaceMediaData = EMPTY_SMARTSPACE_MEDIA_DATA.copy( targetId = smartspaceMediaData.targetId) Loading Loading @@ -709,17 +710,19 @@ class MediaDataManager( override fun onSmartspaceTargetsUpdated(targets: List<Parcelable>) { if (!allowMediaRecommendations) { if (DEBUG) Log.d(TAG, "Smartspace recommendation is disabled in Settings.") return } val mediaTargets = targets.filterIsInstance<SmartspaceTarget>() when (mediaTargets.size) { 0 -> { Log.d(TAG, "Empty Smartspace media target") if (!smartspaceMediaData.isActive) { return } if (DEBUG) { Log.d(TAG, "Set Smartspace media to be inactive for the data update") } smartspaceMediaData = EMPTY_SMARTSPACE_MEDIA_DATA.copy( targetId = smartspaceMediaData.targetId) notifySmartspaceMediaDataRemoved(smartspaceMediaData.targetId, immediately = false) Loading @@ -728,14 +731,13 @@ class MediaDataManager( val newMediaTarget = mediaTargets.get(0) if (smartspaceMediaData.targetId == newMediaTarget.smartspaceTargetId) { // The same Smartspace updates can be received. Skip the duplicate updates. Log.d(TAG, "Same Smartspace media update exists. Skip loading data.") } else { Log.d(TAG, "Forwarding Smartspace media update.") return } if (DEBUG) Log.d(TAG, "Forwarding Smartspace media update.") smartspaceMediaData = toSmartspaceMediaData(newMediaTarget, isActive = true) notifySmartspaceMediaDataLoaded( smartspaceMediaData.targetId, smartspaceMediaData) } } else -> { // There should NOT be more than 1 Smartspace media update. When it happens, it // indicates a bad state or an error. Reset the status accordingly. Loading Loading @@ -883,7 +885,7 @@ class MediaDataManager( private fun packageName(target: SmartspaceTarget): String? { val recommendationList = target.iconGrid if (recommendationList == null || recommendationList.isEmpty()) { Log.d(TAG, "Empty or media recommendation list.") Log.w(TAG, "Empty or null media recommendation list.") return null } for (recommendation in recommendationList) { Loading @@ -893,7 +895,7 @@ class MediaDataManager( packageName -> return packageName } } } Log.d(TAG, "No valid package name is provided.") Log.w(TAG, "No valid package name is provided.") return null } Loading Loading
packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt +4 −3 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ import javax.inject.Provider private const val TAG = "MediaCarouselController" private val settingsIntent = Intent().setAction(ACTION_MEDIA_CONTROLS_SETTINGS) private const val DEBUG = false /** * Class that is responsible for keeping the view carousel up to date. Loading Loading @@ -237,7 +238,7 @@ class MediaCarouselController @Inject constructor( data: SmartspaceMediaData, shouldPrioritize: Boolean ) { Log.d(TAG, "My Smartspace media update is here") if (DEBUG) Log.d(TAG, "Loading Smartspace media update") if (data.isActive) { addSmartspaceMediaRecommendations(key, data, shouldPrioritize) MediaPlayerData.getMediaPlayer(key, null)?.let { Loading Loading @@ -266,7 +267,7 @@ class MediaCarouselController @Inject constructor( } override fun onSmartspaceMediaDataRemoved(key: String, immediately: Boolean) { Log.d(TAG, "My Smartspace media removal request is received") if (DEBUG) Log.d(TAG, "My Smartspace media removal request is received") if (immediately || visualStabilityManager.isReorderingAllowed) { onMediaDataRemoved(key) } else { Loading Loading @@ -384,7 +385,7 @@ class MediaCarouselController @Inject constructor( data: SmartspaceMediaData, shouldPrioritize: Boolean ) { Log.d(TAG, "Updating smartspace target in carousel") if (DEBUG) Log.d(TAG, "Updating smartspace target in carousel") if (MediaPlayerData.getMediaPlayer(key, null) != null) { Log.w(TAG, "Skip adding smartspace target in carousel") return Loading
packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt +13 −11 Original line number Diff line number Diff line Loading @@ -453,7 +453,8 @@ class MediaDataManager( if (smartspaceMediaData.targetId != key) { return } Log.d(TAG, "Dismissing Smartspace media target") if (DEBUG) Log.d(TAG, "Dismissing Smartspace media target") if (smartspaceMediaData.isActive) { smartspaceMediaData = EMPTY_SMARTSPACE_MEDIA_DATA.copy( targetId = smartspaceMediaData.targetId) Loading Loading @@ -709,17 +710,19 @@ class MediaDataManager( override fun onSmartspaceTargetsUpdated(targets: List<Parcelable>) { if (!allowMediaRecommendations) { if (DEBUG) Log.d(TAG, "Smartspace recommendation is disabled in Settings.") return } val mediaTargets = targets.filterIsInstance<SmartspaceTarget>() when (mediaTargets.size) { 0 -> { Log.d(TAG, "Empty Smartspace media target") if (!smartspaceMediaData.isActive) { return } if (DEBUG) { Log.d(TAG, "Set Smartspace media to be inactive for the data update") } smartspaceMediaData = EMPTY_SMARTSPACE_MEDIA_DATA.copy( targetId = smartspaceMediaData.targetId) notifySmartspaceMediaDataRemoved(smartspaceMediaData.targetId, immediately = false) Loading @@ -728,14 +731,13 @@ class MediaDataManager( val newMediaTarget = mediaTargets.get(0) if (smartspaceMediaData.targetId == newMediaTarget.smartspaceTargetId) { // The same Smartspace updates can be received. Skip the duplicate updates. Log.d(TAG, "Same Smartspace media update exists. Skip loading data.") } else { Log.d(TAG, "Forwarding Smartspace media update.") return } if (DEBUG) Log.d(TAG, "Forwarding Smartspace media update.") smartspaceMediaData = toSmartspaceMediaData(newMediaTarget, isActive = true) notifySmartspaceMediaDataLoaded( smartspaceMediaData.targetId, smartspaceMediaData) } } else -> { // There should NOT be more than 1 Smartspace media update. When it happens, it // indicates a bad state or an error. Reset the status accordingly. Loading Loading @@ -883,7 +885,7 @@ class MediaDataManager( private fun packageName(target: SmartspaceTarget): String? { val recommendationList = target.iconGrid if (recommendationList == null || recommendationList.isEmpty()) { Log.d(TAG, "Empty or media recommendation list.") Log.w(TAG, "Empty or null media recommendation list.") return null } for (recommendation in recommendationList) { Loading @@ -893,7 +895,7 @@ class MediaDataManager( packageName -> return packageName } } } Log.d(TAG, "No valid package name is provided.") Log.w(TAG, "No valid package name is provided.") return null } Loading