Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb507c47 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

Merge "Close guts during transitions" into sc-dev am: 90cff49c

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14489218

Change-Id: Ieadbdbb8fe56b4dd2e32f366b4edc62c1aaa16d9
parents 00513137 90cff49c
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -535,12 +535,20 @@ class MediaCarouselController @Inject constructor(
            this.desiredLocation = desiredLocation
            this.desiredHostState = it
            currentlyExpanded = it.expansion > 0

            val shouldCloseGuts = !currentlyExpanded && !mediaManager.hasActiveMedia() &&
                    desiredHostState.showsOnlyActiveMedia

            for (mediaPlayer in MediaPlayerData.players()) {
                if (animate) {
                    mediaPlayer.mediaViewController.animatePendingStateChange(
                            duration = duration,
                            delay = startDelay)
                }
                if (shouldCloseGuts && mediaPlayer.mediaViewController.isGutsVisible) {
                    mediaPlayer.closeGuts(!animate)
                }

                mediaPlayer.mediaViewController.onLocationPreChange(desiredLocation)
            }
            mediaCarouselScrollHandler.showsSettingsButton = !it.showsOnlyActiveMedia
@@ -556,9 +564,9 @@ class MediaCarouselController @Inject constructor(
        }
    }

    fun closeGuts() {
    fun closeGuts(immediate: Boolean = true) {
        MediaPlayerData.players().forEach {
            it.closeGuts(true)
            it.closeGuts(immediate)
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -59,7 +59,7 @@ class MediaCarouselScrollHandler(
    private val mainExecutor: DelayableExecutor,
    private val dismissCallback: () -> Unit,
    private var translationChangedListener: () -> Unit,
    private val closeGuts: () -> Unit,
    private val closeGuts: (immediate: Boolean) -> Unit,
    private val falsingCollector: FalsingCollector,
    private val falsingManager: FalsingManager,
    private val logSmartspaceImpression: () -> Unit
@@ -473,7 +473,7 @@ class MediaCarouselScrollHandler(
            if (oldIndex != visibleMediaIndex && visibleToUser) {
                logSmartspaceImpression()
            }
            closeGuts()
            closeGuts(false)
            updatePlayerVisibilities()
        }
        val relativeLocation = visibleMediaIndex.toFloat() + if (playerWidthPlusPadding > 0)
+2 −1
Original line number Diff line number Diff line
@@ -213,7 +213,8 @@ public class MediaControlPanel {
                mMediaViewController.openGuts();
                return true;
            } else {
                return false;
                closeGuts();
                return true;
            }
        });
        mPlayerViewHolder.getCancel().setOnClickListener(v -> {
+1 −0
Original line number Diff line number Diff line
@@ -273,6 +273,7 @@ class MediaHierarchyManager @Inject constructor(
                } else {
                    updateDesiredLocation()
                    qsExpanded = false
                    closeGuts()
                }
                mediaCarouselController.mediaCarouselScrollHandler.visibleToUser = isVisibleToUser()
            }
+1 −0
Original line number Diff line number Diff line
@@ -289,6 +289,7 @@ public class MediaControlPanelTest : SysuiTestCase() {

        captor.value.onLongClick(holder.player)
        verify(mediaViewController, never()).openGuts()
        verify(mediaViewController).closeGuts(false)
    }

    @Test
Loading