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

Commit 5a8864ee authored by Ats Jenk's avatar Ats Jenk
Browse files

Create a custom transition type for convert to bubble

Custom transition type allows us to detect when desktop drag ends up in
a bubble.

Bug: 388851898
Test: atest BubbleTransitionsTest DragToDesktopTransitionHandlerTest
Test: manual, convert fullscreen task to bubble from handle menu and by
  dragging
Flag: com.android.wm.shell.enable_bubble_to_fullscreen
Change-Id: I62acfff0b79f4397e1e4b73415d9ef60887627cc
parent 9f89e861
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -22,6 +22,8 @@ import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.View.INVISIBLE;
import static android.view.WindowManager.TRANSIT_CHANGE;

import static com.android.wm.shell.transition.Transitions.TRANSIT_CONVERT_TO_BUBBLE;

import android.annotation.NonNull;
import android.annotation.Nullable;
import android.app.ActivityManager;
@@ -265,7 +267,7 @@ public class BubbleTransitions {
                state.mVisible = true;
            }
            mTaskViewTransitions.enqueueExternal(tv.getController(), () -> {
                mTransition = mTransitions.startTransition(TRANSIT_CHANGE, wct, this);
                mTransition = mTransitions.startTransition(TRANSIT_CONVERT_TO_BUBBLE, wct, this);
                return mTransition;
            });
        }
+2 −7
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import com.android.wm.shell.shared.split.SplitScreenConstants.SPLIT_POSITION_UND
import com.android.wm.shell.shared.split.SplitScreenConstants.SplitPosition
import com.android.wm.shell.splitscreen.SplitScreenController
import com.android.wm.shell.transition.Transitions
import com.android.wm.shell.transition.Transitions.TRANSIT_CONVERT_TO_BUBBLE
import com.android.wm.shell.transition.Transitions.TransitionHandler
import com.android.wm.shell.windowdecor.MoveToDesktopAnimator
import com.android.wm.shell.windowdecor.MoveToDesktopAnimator.Companion.DRAG_FREEFORM_SCALE
@@ -530,13 +531,7 @@ sealed class DragToDesktopTransitionHandler(
        }
        // In case of bubble animation, finish the initial desktop drag animation, but keep the
        // current animation running and have bubbles take over
        if (
            state.cancelState == CancelState.CANCEL_BUBBLE_LEFT ||
                state.cancelState == CancelState.CANCEL_BUBBLE_RIGHT
        ) {
            // TODO(b/388851898): once bubbles sends a specific type of transition for the enter
            //  bubble, add a check for that transition type to ensure that any other transition
            //  would not end up here
        if (info.type == TRANSIT_CONVERT_TO_BUBBLE) {
            state.startTransitionFinishCb?.onTransitionFinished(/* wct= */ null)
            clearState()
            return
+4 −0
Original line number Diff line number Diff line
@@ -196,6 +196,9 @@ public class Transitions implements RemoteCallable<Transitions>,
    /** Transition type for app compat reachability. */
    public static final int TRANSIT_MOVE_LETTERBOX_REACHABILITY = TRANSIT_FIRST_CUSTOM + 23;

    /** Transition type for converting a task to a bubble. */
    public static final int TRANSIT_CONVERT_TO_BUBBLE = TRANSIT_FIRST_CUSTOM + 24;

    /** Transition type for desktop mode transitions. */
    public static final int TRANSIT_DESKTOP_MODE_TYPES =
            WindowManager.TRANSIT_FIRST_CUSTOM + 100;
@@ -1867,6 +1870,7 @@ public class Transitions implements RemoteCallable<Transitions>,
            case TRANSIT_MINIMIZE -> "MINIMIZE";
            case TRANSIT_START_RECENTS_TRANSITION -> "START_RECENTS_TRANSITION";
            case TRANSIT_END_RECENTS_TRANSITION -> "END_RECENTS_TRANSITION";
            case TRANSIT_CONVERT_TO_BUBBLE -> "CONVERT_TO_BUBBLE";
            default -> "";
        };
        if (typeStr.isEmpty()) {
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,8 @@ package com.android.wm.shell.bubbles;

import static android.view.WindowManager.TRANSIT_CHANGE;

import static com.android.wm.shell.transition.Transitions.TRANSIT_CONVERT_TO_BUBBLE;

import static com.google.common.truth.Truth.assertThat;

import static org.junit.Assert.assertFalse;
@@ -137,7 +139,7 @@ public class BubbleTransitionsTest extends ShellTestCase {
    }

    private TransitionInfo setupFullscreenTaskTransition(ActivityManager.RunningTaskInfo taskInfo) {
        final TransitionInfo info = new TransitionInfo(TRANSIT_CHANGE, 0);
        final TransitionInfo info = new TransitionInfo(TRANSIT_CONVERT_TO_BUBBLE, 0);
        final TransitionInfo.Change chg = new TransitionInfo.Change(taskInfo.token,
                mock(SurfaceControl.class));
        chg.setTaskInfo(taskInfo);