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

Commit 73221d1f authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Fix an issue where the wrong position would be used for app bubbles" into main

parents a4e1327b 0909b6b4
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -84,8 +84,6 @@ import com.android.wm.shell.transition.Transitions.TransitionHandler
import com.android.wm.shell.unfold.ShellUnfoldProgressProvider
import com.google.common.truth.Truth.assertThat
import com.google.common.util.concurrent.MoreExecutors.directExecutor
import java.util.Optional
import java.util.concurrent.Executor
import org.junit.After
import org.junit.Assume.assumeTrue
import org.junit.Before
@@ -103,6 +101,8 @@ import org.mockito.kotlin.never
import org.mockito.kotlin.verify
import platform.test.runner.parameterized.ParameterizedAndroidJunit4
import platform.test.runner.parameterized.Parameters
import java.util.Optional
import java.util.concurrent.Executor

/** Tests for [BubbleController].
 *
@@ -456,12 +456,14 @@ class BubbleControllerTest(flags: FlagsParameterization) {
    fun expandStackAndSelectBubbleForExistingTransition_reusesExistingBubble() {
        assumeTrue(BubbleAnythingFlagHelper.enableCreateAnyBubble())

        val bubbleStateListener = FakeBubblesStateListener()

        // switch to bubble bar mode because the transition currently requires bubble layer view
        bubblePositioner.update(deviceConfigUnfolded)
        bubblePositioner.isShowingInBubbleBar = true
        getInstrumentation().runOnMainSync {
            bubbleController.setLauncherHasBubbleBar(true)
            bubbleController.registerBubbleStateListener(FakeBubblesStateListener())
            bubbleController.registerBubbleStateListener(bubbleStateListener)
        }

        val taskInfo = ActivityManager.RunningTaskInfo().apply {
@@ -484,6 +486,7 @@ class BubbleControllerTest(flags: FlagsParameterization) {
            ) {}
        }

        assertThat(bubbleStateListener.lastUpdate!!.bubbleBarLocation).isNull()
        assertThat(bubbleData.selectedBubble).isEqualTo(bubble)
        assertThat(bubbleController.isStackExpanded).isTrue()
    }
+4 −1
Original line number Diff line number Diff line
@@ -21,8 +21,11 @@ import com.android.wm.shell.shared.bubbles.BubbleBarUpdate

/** A fake implementation of [Bubbles.BubbleStateListener] */
class FakeBubblesStateListener : Bubbles.BubbleStateListener {
    var lastUpdate: BubbleBarUpdate? = null

    override fun onBubbleStateChange(update: BubbleBarUpdate?) {}
    override fun onBubbleStateChange(update: BubbleBarUpdate?) {
        lastUpdate = update
    }

    override fun animateBubbleBarLocation(location: BubbleBarLocation?) {}

+2 −2
Original line number Diff line number Diff line
@@ -1751,8 +1751,8 @@ public class BubbleController implements ConfigurationChangeListener,

        Bubble b = mBubbleData.getBubbleInStackWithTaskId(taskInfo.taskId);
        if (b != null) {
            // Reuse the existing bubble
            mBubbleData.setSelectedBubbleAndExpandStack(b, BubbleBarLocation.DEFAULT);
            // Reuse the existing bubble; pass null for location to use existing location.
            mBubbleData.setSelectedBubbleAndExpandStack(b, null /* bubbleBarLocation */);
        } else {
            // Create a new bubble and show it, remove from overflow
            b = mBubbleData.getOrCreateBubble(taskInfo);