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

Commit 77631918 authored by Louis Chang's avatar Louis Chang Committed by Android (Google) Code Review
Browse files

Merge "Migrate common properties to parent root task" into main

parents 8d3d3165 d54ef86e
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -652,6 +652,11 @@ public class BubbleController implements ConfigurationChangeListener,
                            wct.reorder(taskInfo.token, false /* onTop */);
                            wct.setInterceptBackPressedOnTaskRoot(taskInfo.token,
                                    true /* interceptBackPressed */);
                            wct.setTaskForceExcludedFromRecents(taskInfo.token,
                                    true /* forceExcluded */);
                            wct.setDisablePip(taskInfo.token, true /* disablePip */);
                            wct.setDisableLaunchAdjacent(taskInfo.token,
                                    true /* disableLaunchAdjacent */);
                            mTaskOrganizer.applyTransaction(wct);
                        }
                    });
+4 −1
Original line number Diff line number Diff line
@@ -228,8 +228,11 @@ public class BubbleTaskViewListener implements TaskView.Listener {

        final TaskViewTaskController tvc = mTaskView.getController();
        final boolean isAppBubble = mBubble != null && (mBubble.isApp() || mBubble.isShortcut());
        Rect launchBounds = new Rect();
        mTaskView.getBoundsOnScreen(launchBounds);
        final WindowContainerTransaction wct = getEnterBubbleTransaction(
                tvc.getTaskToken(), mExpandedViewManager.getAppBubbleRootTaskToken(), isAppBubble);
                tvc.getTaskToken(), mExpandedViewManager.getAppBubbleRootTaskToken(), launchBounds,
                isAppBubble);
        tvc.getTaskOrganizer().applyTransaction(wct);

        // With the task org, the taskAppeared callback will only happen once the task has
+2 −2
Original line number Diff line number Diff line
@@ -1152,8 +1152,8 @@ public class BubbleTransitions {
                } else {
                    opts.setTaskAlwaysOnTop(true);
                    opts.setLaunchNextToBubble(true);
                }
                    opts.setLaunchWindowingMode(WINDOWING_MODE_MULTI_WINDOW);
                }
                opts.setLaunchBounds(launchBounds);
                // TODO(b/437451940): start the pending intent or shortcut via WCT
                if (mBubble.isShortcut()) {
@@ -1484,7 +1484,7 @@ public class BubbleTransitions {
                    mTaskInfo.getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW
                            && mTaskInfo.getParentTaskId() != INVALID_TASK_ID;
            final WindowContainerTransaction wct = getEnterBubbleTransaction(
                    mTaskInfo.token, mBubbleController.getAppBubbleRootTaskToken(),
                    mTaskInfo.token, mBubbleController.getAppBubbleRootTaskToken(), launchBounds,
                    true /* isAppBubble */, reparentToTda);
            mHomeIntentProvider.addLaunchHomePendingIntent(wct, mTaskInfo.displayId,
                    mTaskInfo.userId);
+10 −4
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ object BubbleUtils {
    private fun getBubbleTransaction(
        token: WindowContainerToken,
        rootToken: WindowContainerToken?,
        bounds: Rect,
        toBubble: Boolean,
        isAppBubble: Boolean,
        reparentToTda: Boolean,
@@ -47,6 +48,7 @@ object BubbleUtils {
        if (BubbleAnythingFlagHelper.enableRootTaskForBubble() && isAppBubble) {
            if (toBubble && rootToken != null) {
                wct.reparent(token, rootToken, true /* onTop */)
                wct.setBounds(rootToken, bounds)
                wct.setAlwaysOnTop(rootToken, true /* alwaysOnTop */)
            } else {
                wct.reparent(token, null, true /* onTop */)
@@ -65,6 +67,8 @@ object BubbleUtils {
                    WindowConfiguration.WINDOWING_MODE_UNDEFINED,
            )
            wct.setInterceptBackPressedOnTaskRoot(token, toBubble)
            wct.setTaskForceExcludedFromRecents(token, toBubble /* forceExcluded */)
            wct.setDisablePip(token, toBubble /* disablePip */)
            if (!isAppBubble || !BubbleAnythingFlagHelper.enableRootTaskForBubble()) {
                wct.setAlwaysOnTop(token, toBubble /* alwaysOnTop */)
            }
@@ -74,12 +78,11 @@ object BubbleUtils {
                // Always reset everything when exit bubble.
                wct.setLaunchNextToBubble(token, toBubble /* launchNextToBubble */)
            }
        }
        // TODO: b/407669465 - review if those could also be set on the bubble root task.
        wct.setTaskForceExcludedFromRecents(token, toBubble /* forceExcluded */)
        wct.setDisablePip(token, toBubble /* disablePip */)
            if (BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
                wct.setDisableLaunchAdjacent(token, toBubble /* disableLaunchAdjacent */)
            }
        }
        if (BubbleAnythingFlagHelper.enableCreateAnyBubble()) {
            if (!toBubble) {
                // Clear bounds if moving out of Bubble.
                wct.setBounds(token, Rect())
@@ -108,12 +111,14 @@ object BubbleUtils {
    fun getEnterBubbleTransaction(
        token: WindowContainerToken,
        rootToken: WindowContainerToken?,
        bounds: Rect,
        isAppBubble: Boolean,
        reparentToTda: Boolean = false,
    ): WindowContainerTransaction {
        return getBubbleTransaction(
            token,
            rootToken,
            bounds,
            toBubble = true,
            isAppBubble,
            reparentToTda,
@@ -133,6 +138,7 @@ object BubbleUtils {
        return getBubbleTransaction(
            token,
            rootToken = null,
            bounds = Rect(),
            toBubble = false,
            // Everything will be reset, so doesn't matter for exit.
            isAppBubble = true,
+5 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.wm.shell.bubbles.util

import android.graphics.Rect
import android.os.Binder
import android.platform.test.annotations.DisableFlags
import android.platform.test.annotations.EnableFlags
@@ -52,6 +53,7 @@ class BubbleUtilsTest : ShellTestCase() {
    private val rootTaskToken = mock<WindowContainerToken> {
        on { asBinder() } doReturn binder
    }
    private val bounds = Rect(0, 0, 100, 100)
    private val captionInsetsOwner = Binder()

    @EnableFlags(FLAG_ENABLE_CREATE_ANY_BUBBLE)
@@ -59,7 +61,7 @@ class BubbleUtilsTest : ShellTestCase() {
    @Test
    fun testGetEnterBubbleTransaction(@TestParameter isAppBubble: Boolean) {
        val wctWithLaunchNextToBubble =
            getEnterBubbleTransaction(token, null /* rootToken */, isAppBubble)
            getEnterBubbleTransaction(token, null /* rootToken */, bounds, isAppBubble)

        verifyEnterBubbleTransaction(wctWithLaunchNextToBubble, token.asBinder(), isAppBubble)
    }
@@ -72,6 +74,7 @@ class BubbleUtilsTest : ShellTestCase() {
            getEnterBubbleTransaction(
                token,
                rootToken = null,
                bounds,
                isAppBubble,
                reparentToTda = true
            )
@@ -88,7 +91,7 @@ class BubbleUtilsTest : ShellTestCase() {
    @Test
    fun testRootBubbleGetEnterBubbleTransaction() {
        val isAppBubble = true
        val wct = getEnterBubbleTransaction(token, rootTaskToken, isAppBubble)
        val wct = getEnterBubbleTransaction(token, rootTaskToken, bounds, isAppBubble)

        verifyEnterBubbleTransaction(
            wct,
Loading