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

Commit d804bbc2 authored by Chris Li's avatar Chris Li Committed by Android (Google) Code Review
Browse files

Merge "Address BubbleTransitions comments" into main

parents 0f902e22 45c26e68
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -304,7 +304,7 @@ public class BubbleTransitions {
        for (int i = 0; i < info.getChanges().size(); i++) {
            final TransitionInfo.Change chg = info.getChanges().get(i);
            final ActivityManager.RunningTaskInfo taskInfo = chg.getTaskInfo();
            // Exclude activity transition scenarios.
            // Exclude non-standard activity transition scenarios.
            if (taskInfo == null || taskInfo.getActivityType() != ACTIVITY_TYPE_STANDARD) {
                continue;
            }
@@ -330,7 +330,7 @@ public class BubbleTransitions {
        for (int i = 0; i < info.getChanges().size(); i++) {
            final TransitionInfo.Change chg = info.getChanges().get(i);
            final ActivityManager.RunningTaskInfo taskInfo = chg.getTaskInfo();
            // Exclude activity transition scenarios.
            // Exclude non-standard activity transition scenarios.
            if (taskInfo == null || taskInfo.getActivityType() != ACTIVITY_TYPE_STANDARD) {
                continue;
            }
@@ -351,7 +351,7 @@ public class BubbleTransitions {
     * Whether the transition contains any Task that is changed from expanded App Bubbled to
     * non-Bubbled.
     */
    public boolean containsNonBubbledExpandedTaskInStack(@NonNull TransitionInfo info) {
    public boolean containsExpandedBubbledTaskNoLongerBubbled(@NonNull TransitionInfo info) {
        if (!mBubbleData.isExpanded() || mBubbleData.getSelectedBubble() == null) {
            // No expanded.
            return false;
+1 −1
Original line number Diff line number Diff line
@@ -481,7 +481,7 @@ class DefaultMixedTransition extends DefaultMixedHandler.MixedTransition {
            // The trigger Task is no longer in Bubble (Case 1/2/4)
            ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " No bubbling task found");

            if (bubbleTransitions.containsNonBubbledExpandedTaskInStack(info)) {
            if (bubbleTransitions.containsExpandedBubbledTaskNoLongerBubbled(info)) {
                // The expanded Bubbled Task is no longer Bubbled (Case 2)
                ProtoLog.w(ShellProtoLogGroup.WM_SHELL_TRANSITIONS,
                        " An activity launch converted the expanded Bubbled Task to non-Bubbled");
+23 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
import static android.view.WindowManager.TRANSIT_CHANGE;
import static android.view.WindowManager.TRANSIT_CLOSE;
import static android.view.WindowManager.TRANSIT_OPEN;
import static android.view.WindowManager.TRANSIT_TO_BACK;
import static android.view.WindowManager.TRANSIT_TO_FRONT;

import static com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_BAR;
@@ -1123,4 +1124,26 @@ public class BubbleTransitionsTest extends ShellTestCase {

        assertThat(mBubbleTransitions.getClosingBubbleTask(info)).isEqualTo(closingBubble);
    }

    @Test
    public void testGetClosingBubbleTask_excludeChangeAndToBack() {
        final SurfaceControl leash = new SurfaceControl.Builder().setName("testLeash").build();
        final ActivityManager.RunningTaskInfo taskInfo0 = setupAppBubble();
        final ActivityManager.RunningTaskInfo taskInfo1 = setupAppBubble();

        final TransitionInfo info = new TransitionInfo(TRANSIT_OPEN, 0);
        final TransitionInfo.Change openingBubble = new TransitionInfo.Change(
                taskInfo0.token, leash);
        openingBubble.setTaskInfo(taskInfo0);
        openingBubble.setMode(TRANSIT_CHANGE);
        final TransitionInfo.Change closingBubble = new TransitionInfo.Change(
                taskInfo1.token, leash);
        closingBubble.setTaskInfo(taskInfo1);
        closingBubble.setMode(TRANSIT_TO_BACK);
        info.addChange(openingBubble);
        info.addChange(closingBubble);
        info.addRoot(new TransitionInfo.Root(0, mock(SurfaceControl.class), 0, 0));

        assertThat(mBubbleTransitions.getClosingBubbleTask(info)).isNull();
    }
}