diff options
| author | 2024-10-02 00:35:00 +0000 | |
|---|---|---|
| committer | 2024-10-02 00:35:00 +0000 | |
| commit | c62abdb6fb84de31eade6ac0726a57f377bcdaaf (patch) | |
| tree | c99e0d55863cd8cc2b3a87d326bff64d0148e6ba | |
| parent | 3019b30387ece508038d2e7c223bc69d3c0789f8 (diff) | |
| parent | 71e9754e12ecd71882907aa4a5f52798c3a5f504 (diff) | |
Merge "[Flexiglass] avoid blocking media conversion from resume to active" into main
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessor.kt | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessor.kt b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessor.kt index fd7b6dcfebbc..affc7b741b2a 100644 --- a/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessor.kt +++ b/packages/SystemUI/src/com/android/systemui/media/controls/domain/pipeline/MediaDataProcessor.kt @@ -330,6 +330,7 @@ class MediaDataProcessor(      fun onNotificationAdded(key: String, sbn: StatusBarNotification) {          if (useQsMediaPlayer && isMediaNotification(sbn)) {              var isNewlyActiveEntry = false +            var isConvertingToActive = false              Assert.isMainThread()              val oldKey = findExistingEntry(key, sbn.packageName)              if (oldKey == null) { @@ -347,9 +348,10 @@ class MediaDataProcessor(                  // Resume -> active conversion; move to new key                  val oldData = mediaDataRepository.removeMediaEntry(oldKey)!!                  isNewlyActiveEntry = true +                isConvertingToActive = true                  mediaDataRepository.addMediaEntry(key, oldData)              } -            loadMediaData(key, sbn, oldKey, isNewlyActiveEntry) +            loadMediaData(key, sbn, oldKey, isNewlyActiveEntry, isConvertingToActive)          } else {              onNotificationRemoved(key)          } @@ -488,10 +490,11 @@ class MediaDataProcessor(          sbn: StatusBarNotification,          oldKey: String?,          isNewlyActiveEntry: Boolean = false, +        isConvertingToActive: Boolean = false,      ) {          if (Flags.mediaLoadMetadataViaMediaDataLoader()) {              applicationScope.launch { -                loadMediaDataWithLoader(key, sbn, oldKey, isNewlyActiveEntry) +                loadMediaDataWithLoader(key, sbn, oldKey, isNewlyActiveEntry, isConvertingToActive)              }          } else {              backgroundExecutor.execute { loadMediaDataInBg(key, sbn, oldKey, isNewlyActiveEntry) } @@ -835,10 +838,11 @@ class MediaDataProcessor(          sbn: StatusBarNotification,          oldKey: String?,          isNewlyActiveEntry: Boolean = false, +        isConvertingToActive: Boolean = false,      ) =          withContext(backgroundDispatcher) {              val lastActive = systemClock.elapsedRealtime() -            val result = mediaDataLoader.get().loadMediaData(key, sbn) +            val result = mediaDataLoader.get().loadMediaData(key, sbn, isConvertingToActive)              if (result == null) {                  Log.d(TAG, "No result from loadMediaData")                  return@withContext |