diff options
| author | 2022-05-19 17:56:44 -0400 | |
|---|---|---|
| committer | 2022-05-19 22:02:51 +0000 | |
| commit | 04fb2d8174e5511927bf739e85570d4dcf52540c (patch) | |
| tree | 1f8baee34af82275cc6cb4bde3c5c9d724c0a64d | |
| parent | 2a3709618b5540065e76b9968df2c9a307752d0d (diff) | |
Add lastActive to the media carousel sort comparator
See b/231339801 for more information.
Fixes: 231339801
Test: Augmented existing tests. Manually reproduced without fix and could not reproduce with it.
Change-Id: I5b365e2064b6680dc136903016ee9ae6b7d3ce7c
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt | 1 | ||||
| -rw-r--r-- | packages/SystemUI/tests/src/com/android/systemui/media/MediaCarouselControllerTest.kt | 11 |
2 files changed, 11 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt index 0f8687183e94..906aba13ce0f 100644 --- a/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt +++ b/packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt @@ -945,6 +945,7 @@ internal object MediaPlayerData { .thenByDescending { shouldPrioritizeSs == it.isSsMediaRec } .thenByDescending { !it.data.resumption } .thenByDescending { it.data.playbackLocation != MediaData.PLAYBACK_CAST_REMOTE } + .thenByDescending { it.data.lastActive } .thenByDescending { it.updateTime } .thenByDescending { it.data.notificationKey } diff --git a/packages/SystemUI/tests/src/com/android/systemui/media/MediaCarouselControllerTest.kt b/packages/SystemUI/tests/src/com/android/systemui/media/MediaCarouselControllerTest.kt index ceb811b8d8aa..219b3c8561b2 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/media/MediaCarouselControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/media/MediaCarouselControllerTest.kt @@ -136,9 +136,18 @@ class MediaCarouselControllerTest : SysuiTestCase() { val resume2 = Triple("resume 2", DATA.copy(active = false, isPlaying = false, - playbackLocation = MediaData.PLAYBACK_LOCAL, resumption = true), + playbackLocation = MediaData.PLAYBACK_LOCAL, resumption = true), 1000L) + val activeMoreRecent = Triple("active more recent", + DATA.copy(active = false, isPlaying = false, + playbackLocation = MediaData.PLAYBACK_LOCAL, resumption = true, lastActive = 2L), + 1000L) + + val activeLessRecent = Triple("active less recent", + DATA.copy(active = false, isPlaying = false, + playbackLocation = MediaData.PLAYBACK_LOCAL, resumption = true, lastActive = 1L), + 1000L) // Expected ordering for media players: // Actively playing local sessions // Actively playing cast sessions |