diff options
Diffstat (limited to 'libs')
13 files changed, 196 insertions, 66 deletions
diff --git a/libs/WindowManager/Shell/res/values/styles.xml b/libs/WindowManager/Shell/res/values/styles.xml index 08cda7b94a78..086c8a5651c3 100644 --- a/libs/WindowManager/Shell/res/values/styles.xml +++ b/libs/WindowManager/Shell/res/values/styles.xml @@ -51,7 +51,6 @@ <item name="android:clickable">true</item> <item name="android:focusable">true</item> <item name="android:orientation">horizontal</item> - <item name="android:background">?android:attr/selectableItemBackground</item> </style> <style name="DesktopModeHandleMenuActionButtonImage"> diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java index b3c25d495002..ad509bcc1ceb 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/dagger/WMShellBaseModule.java @@ -766,6 +766,7 @@ public abstract class WMShellBaseModule { @ShellMainThread ShellExecutor mainExecutor, @ShellMainThread Handler mainHandler, @ShellAnimationThread ShellExecutor animExecutor, + @ShellAnimationThread Handler animHandler, RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer, HomeTransitionObserver homeTransitionObserver, FocusTransitionObserver focusTransitionObserver) { @@ -775,7 +776,7 @@ public abstract class WMShellBaseModule { } return new Transitions(context, shellInit, shellCommandHandler, shellController, organizer, pool, displayController, displayInsetsController, mainExecutor, mainHandler, - animExecutor, rootTaskDisplayAreaOrganizer, homeTransitionObserver, + animExecutor, animHandler, rootTaskDisplayAreaOrganizer, homeTransitionObserver, focusTransitionObserver); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java index 1c5138f486e4..8bbe36dd6644 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicator.java @@ -57,7 +57,7 @@ import com.android.wm.shell.shared.bubbles.BubbleAnythingFlagHelper; import com.android.wm.shell.shared.bubbles.BubbleDropTargetBoundsProvider; import com.android.wm.shell.windowdecor.tiling.SnapEventHandler; -import java.util.Arrays; +import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -307,7 +307,8 @@ public class DesktopModeVisualIndicator { if (splitRightRegion.contains(x, y)) { result = IndicatorType.TO_SPLIT_RIGHT_INDICATOR; } - if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) { + if (BubbleAnythingFlagHelper.enableBubbleToFullscreen() + && mDragStartState == DragStartState.FROM_FULLSCREEN) { if (calculateBubbleLeftRegion(layout).contains(x, y)) { result = IndicatorType.TO_BUBBLE_LEFT_INDICATOR; } else if (calculateBubbleRightRegion(layout).contains(x, y)) { @@ -415,30 +416,59 @@ public class DesktopModeVisualIndicator { private List<Pair<Rect, IndicatorType>> initSmallTabletRegions(DisplayLayout layout, boolean isLeftRightSplit) { - boolean dragFromFullscreen = mDragStartState == DragStartState.FROM_FULLSCREEN; - boolean dragFromSplit = mDragStartState == DragStartState.FROM_SPLIT; - if (isLeftRightSplit && (dragFromFullscreen || dragFromSplit)) { + return switch (mDragStartState) { + case DragStartState.FROM_FULLSCREEN -> initSmallTabletRegionsFromFullscreen(layout, + isLeftRightSplit); + case DragStartState.FROM_SPLIT -> initSmallTabletRegionsFromSplit(layout, + isLeftRightSplit); + default -> Collections.emptyList(); + }; + } + + private List<Pair<Rect, IndicatorType>> initSmallTabletRegionsFromFullscreen( + DisplayLayout layout, boolean isLeftRightSplit) { + + List<Pair<Rect, IndicatorType>> result = new ArrayList<>(); + if (BubbleAnythingFlagHelper.enableBubbleToFullscreen()) { + result.add(new Pair<>(calculateBubbleLeftRegion(layout), TO_BUBBLE_LEFT_INDICATOR)); + result.add(new Pair<>(calculateBubbleRightRegion(layout), TO_BUBBLE_RIGHT_INDICATOR)); + } + + if (isLeftRightSplit) { int splitRegionWidth = mContext.getResources().getDimensionPixelSize( com.android.wm.shell.shared.R.dimen.drag_zone_h_split_from_app_width_fold); - return Arrays.asList( - new Pair<>(calculateBubbleLeftRegion(layout), TO_BUBBLE_LEFT_INDICATOR), - new Pair<>(calculateBubbleRightRegion(layout), TO_BUBBLE_RIGHT_INDICATOR), - new Pair<>(calculateSplitLeftRegion(layout, splitRegionWidth, - /* captionHeight= */ 0), TO_SPLIT_LEFT_INDICATOR), - new Pair<>(calculateSplitRightRegion(layout, splitRegionWidth, - /* captionHeight= */ 0), TO_SPLIT_RIGHT_INDICATOR), - new Pair<>(new Rect(), TO_FULLSCREEN_INDICATOR) // default to fullscreen - ); + result.add(new Pair<>(calculateSplitLeftRegion(layout, splitRegionWidth, + /* captionHeight= */ 0), TO_SPLIT_LEFT_INDICATOR)); + result.add(new Pair<>(calculateSplitRightRegion(layout, splitRegionWidth, + /* captionHeight= */ 0), TO_SPLIT_RIGHT_INDICATOR)); } - if (dragFromFullscreen) { - // If left/right split is not available, we can only drag fullscreen tasks - // TODO(b/401352409): add support for top/bottom split zones - return Arrays.asList( - new Pair<>(calculateBubbleLeftRegion(layout), TO_BUBBLE_LEFT_INDICATOR), - new Pair<>(calculateBubbleRightRegion(layout), TO_BUBBLE_RIGHT_INDICATOR), - new Pair<>(new Rect(), TO_FULLSCREEN_INDICATOR) // default to fullscreen - ); + // TODO(b/401352409): add support for top/bottom split zones + // default to fullscreen + result.add(new Pair<>(new Rect(), TO_FULLSCREEN_INDICATOR)); + return result; + } + + private List<Pair<Rect, IndicatorType>> initSmallTabletRegionsFromSplit(DisplayLayout layout, + boolean isLeftRightSplit) { + if (!isLeftRightSplit) { + // Dragging a top/bottom split is not supported on small tablets + return Collections.emptyList(); } - return Collections.emptyList(); + + List<Pair<Rect, IndicatorType>> result = new ArrayList<>(); + if (BubbleAnythingFlagHelper.enableBubbleAnything()) { + result.add(new Pair<>(calculateBubbleLeftRegion(layout), TO_BUBBLE_LEFT_INDICATOR)); + result.add(new Pair<>(calculateBubbleRightRegion(layout), TO_BUBBLE_RIGHT_INDICATOR)); + } + + int splitRegionWidth = mContext.getResources().getDimensionPixelSize( + com.android.wm.shell.shared.R.dimen.drag_zone_h_split_from_app_width_fold); + result.add(new Pair<>(calculateSplitLeftRegion(layout, splitRegionWidth, + /* captionHeight= */ 0), TO_SPLIT_LEFT_INDICATOR)); + result.add(new Pair<>(calculateSplitRightRegion(layout, splitRegionWidth, + /* captionHeight= */ 0), TO_SPLIT_RIGHT_INDICATOR)); + // default to fullscreen + result.add(new Pair<>(new Rect(), TO_FULLSCREEN_INDICATOR)); + return result; } } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java index 51ef0ec60c3a..9ec1c7d65a6e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipTransition.java @@ -50,7 +50,9 @@ import android.graphics.Point; import android.graphics.PointF; import android.graphics.Rect; import android.os.Bundle; +import android.os.Debug; import android.os.IBinder; +import android.util.Log; import android.view.SurfaceControl; import android.view.WindowManager; import android.window.TransitionInfo; @@ -315,6 +317,20 @@ public class PipTransition extends PipTransitionController implements return startAlphaTypeEnterAnimation(info, startTransaction, finishTransaction, finishCallback); } + + TransitionInfo.Change pipActivityChange = PipTransitionUtils + .getDeferConfigActivityChange(info, pipChange.getTaskInfo().getToken()); + if (pipActivityChange == null) { + // Legacy-enter and swipe-pip-to-home filters did not resolve a scheduled PiP entry. + // Bounds-type enter animation is the last resort, and it requires a config-at-end + // activity amongst the list of changes. If no such change, something went wrong. + Log.wtf(TAG, String.format(""" + PipTransition.startAnimation didn't handle a scheduled PiP entry + transitionInfo=%s, + callers=%s""", info, Debug.getCallers(4))); + return false; + } + return startBoundsTypeEnterAnimation(info, startTransaction, finishTransaction, finishCallback); } else if (transition == mExitViaExpandTransition) { @@ -839,26 +855,15 @@ public class PipTransition extends PipTransitionController implements return true; } - // Sometimes root PiP task can have TF children. These child containers can be collected - // even if they can promote to their parents: e.g. if they are marked as "organized". - // So we count the chain of containers under PiP task as one "real" changing target; - // iterate through changes bottom-to-top to properly identify parents. - int expectedTargetCount = 1; - WindowContainerToken lastPipChildToken = pipChange.getContainer(); - for (int i = info.getChanges().size() - 1; i >= 0; --i) { - TransitionInfo.Change change = info.getChanges().get(i); - if (change == pipChange || change.getContainer() == null) continue; - if (change.getParent() != null && change.getParent().equals(lastPipChildToken)) { - // Allow an extra change since our pinned root task has a child. - ++expectedTargetCount; - lastPipChildToken = change.getContainer(); - } - } - - // If the only root task change in the changes list is a opening type PiP task, - // then this is legacy-enter PiP. - return info.getChanges().size() == expectedTargetCount - && TransitionUtil.isOpeningMode(pipChange.getMode()); + // #getEnterPipTransaction() always attempts to mark PiP activity as config-at-end one. + // However, the activity will only actually be marked config-at-end by Core if it is + // both isVisible and isVisibleRequested, which is when we can't run bounds animation. + // + // So we can use the absence of a config-at-end activity as a signal that we should run + // a legacy-enter PiP animation instead. + return TransitionUtil.isOpeningMode(pipChange.getMode()) + && PipTransitionUtils.getDeferConfigActivityChange( + info, pipChange.getContainer()) == null; } return false; } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java index e9200834c5dd..5b6993863c5d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java @@ -133,6 +133,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { private final DisplayController mDisplayController; private final Context mContext; private final Handler mMainHandler; + private final Handler mAnimHandler; private final ShellExecutor mMainExecutor; private final ShellExecutor mAnimExecutor; private final TransitionAnimation mTransitionAnimation; @@ -171,6 +172,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { @NonNull TransactionPool transactionPool, @NonNull ShellExecutor mainExecutor, @NonNull Handler mainHandler, @NonNull ShellExecutor animExecutor, + @NonNull Handler animHandler, @NonNull RootTaskDisplayAreaOrganizer rootTDAOrganizer, @NonNull InteractionJankMonitor interactionJankMonitor) { mDisplayController = displayController; @@ -179,6 +181,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { mMainHandler = mainHandler; mMainExecutor = mainExecutor; mAnimExecutor = animExecutor; + mAnimHandler = animHandler; mTransitionAnimation = new TransitionAnimation(context, false /* debug */, Transitions.TAG); mCurrentUserId = UserHandle.myUserId(); mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class); @@ -349,10 +352,6 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { mAnimations.put(transition, animations); final boolean isTaskTransition = isTaskTransition(info); - if (isTaskTransition) { - mInteractionJankMonitor.begin(info.getRoot(0).getLeash(), mContext, - mMainHandler, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); - } final Runnable onAnimFinish = () -> { if (!animations.isEmpty()) return; @@ -642,6 +641,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { // now start animations. they are started on another thread, so we have to post them // *after* applying the startTransaction mAnimExecutor.execute(() -> { + if (isTaskTransition) { + mInteractionJankMonitor.begin(info.getRoot(0).getLeash(), mContext, + mAnimHandler, CUJ_DEFAULT_TASK_TO_TASK_ANIMATION); + } for (int i = 0; i < animations.size(); ++i) { animations.get(i).start(); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java index 3dc8733c879d..84724268cfc2 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/Transitions.java @@ -215,6 +215,7 @@ public class Transitions implements RemoteCallable<Transitions>, private final Context mContext; private final ShellExecutor mMainExecutor; private final ShellExecutor mAnimExecutor; + private final Handler mAnimHandler; private final TransitionPlayerImpl mPlayerImpl; private final DefaultTransitionHandler mDefaultTransitionHandler; private final RemoteTransitionHandler mRemoteTransitionHandler; @@ -319,11 +320,12 @@ public class Transitions implements RemoteCallable<Transitions>, @NonNull ShellExecutor mainExecutor, @NonNull Handler mainHandler, @NonNull ShellExecutor animExecutor, + @NonNull Handler animHandler, @NonNull HomeTransitionObserver homeTransitionObserver, @NonNull FocusTransitionObserver focusTransitionObserver) { this(context, shellInit, new ShellCommandHandler(), shellController, organizer, pool, displayController, displayInsetsController, mainExecutor, mainHandler, animExecutor, - new RootTaskDisplayAreaOrganizer(mainExecutor, context, shellInit), + animHandler, new RootTaskDisplayAreaOrganizer(mainExecutor, context, shellInit), homeTransitionObserver, focusTransitionObserver); } @@ -338,6 +340,7 @@ public class Transitions implements RemoteCallable<Transitions>, @NonNull ShellExecutor mainExecutor, @NonNull Handler mainHandler, @NonNull ShellExecutor animExecutor, + @NonNull Handler animHandler, @NonNull RootTaskDisplayAreaOrganizer rootTDAOrganizer, @NonNull HomeTransitionObserver homeTransitionObserver, @NonNull FocusTransitionObserver focusTransitionObserver) { @@ -345,11 +348,12 @@ public class Transitions implements RemoteCallable<Transitions>, mContext = context; mMainExecutor = mainExecutor; mAnimExecutor = animExecutor; + mAnimHandler = animHandler; mDisplayController = displayController; mPlayerImpl = new TransitionPlayerImpl(); mDefaultTransitionHandler = new DefaultTransitionHandler(context, shellInit, displayController, displayInsetsController, pool, mainExecutor, mainHandler, - animExecutor, rootTDAOrganizer, InteractionJankMonitor.getInstance()); + animExecutor, mAnimHandler, rootTDAOrganizer, InteractionJankMonitor.getInstance()); mRemoteTransitionHandler = new RemoteTransitionHandler(mMainExecutor); mShellCommandHandler = shellCommandHandler; mShellController = shellController; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt index cdadce57d610..71bb153e4b1e 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/HandleMenu.kt @@ -508,6 +508,9 @@ class HandleMenu( private val iconButtonRippleRadius = context.resources.getDimensionPixelSize( R.dimen.desktop_mode_handle_menu_icon_button_ripple_radius ) + private val handleMenuCornerRadius = context.resources.getDimensionPixelSize( + R.dimen.desktop_mode_handle_menu_corner_radius + ) private val iconButtonDrawableInsetsBase = DrawableInsets( t = iconButtondrawableBaseInset, b = iconButtondrawableBaseInset, l = iconButtondrawableBaseInset, @@ -866,14 +869,21 @@ class HandleMenu( private fun bindMoreActionsPill(style: MenuStyle) { moreActionsPill.background.setTint(style.backgroundColor) - - arrayOf( + val buttons = arrayOf( screenshotBtn to SHOULD_SHOW_SCREENSHOT_BUTTON, newWindowBtn to shouldShowNewWindowButton, manageWindowBtn to shouldShowManageWindowsButton, changeAspectRatioBtn to shouldShowChangeAspectRatioButton, restartBtn to shouldShowRestartButton, - ).forEach { (button, shouldShow) -> + ) + val firstVisible = buttons.find { it.second }?.first + val lastVisible = buttons.findLast { it.second }?.first + + buttons.forEach { (button, shouldShow) -> + val topRadius = + if (button == firstVisible) handleMenuCornerRadius.toFloat() else 0f + val bottomRadius = + if (button == lastVisible) handleMenuCornerRadius.toFloat() else 0f button.apply { isGone = !shouldShow textView.apply { @@ -881,6 +891,13 @@ class HandleMenu( startMarquee() } iconView.imageTintList = ColorStateList.valueOf(style.textColor) + background = createBackgroundDrawable( + color = style.textColor, + cornerRadius = floatArrayOf( + topRadius, topRadius, topRadius, topRadius, + bottomRadius, bottomRadius, bottomRadius, bottomRadius + ), + drawableInsets = DrawableInsets()) } } } @@ -899,6 +916,10 @@ class HandleMenu( openInAppOrBrowserBtn.apply { contentDescription = btnText + background = createBackgroundDrawable( + color = style.textColor, + cornerRadius = handleMenuCornerRadius, + drawableInsets = DrawableInsets()) textView.apply { text = btnText setTextColor(style.textColor) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt index f08cfa987cc7..33e743016d0d 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/windowdecor/common/ButtonBackgroundDrawableUtils.kt @@ -51,10 +51,20 @@ fun replaceColorAlpha(@ColorInt color: Int, alpha: Int): Int { */ fun createBackgroundDrawable( @ColorInt color: Int, cornerRadius: Int, drawableInsets: DrawableInsets +): Drawable = createBackgroundDrawable( + color, + FloatArray(8) { cornerRadius.toFloat() }, + drawableInsets) + +/** + * Creates a background drawable with specified color, corner radius, and insets. + */ +fun createBackgroundDrawable( + @ColorInt color: Int, cornerRadius: FloatArray, drawableInsets: DrawableInsets ): Drawable = LayerDrawable(arrayOf( ShapeDrawable().apply { shape = RoundRectShape( - FloatArray(8) { cornerRadius.toFloat() }, + cornerRadius, /* inset= */ null, /* innerRadii= */ null ) diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt index 652fae01c1b2..a4052890f08a 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/desktopmode/DesktopModeVisualIndicatorTest.kt @@ -283,14 +283,32 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, ) - fun testDefaultIndicators_bubblesEnabled() { + fun testDefaultIndicators_enableBubbleToFullscreen() { createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FULLSCREEN) var result = visualIndicator.updateIndicatorType(PointF(10f, 1500f)) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_LEFT_INDICATOR) - result = visualIndicator.updateIndicatorType(PointF(2300f, 1500f)) + result = visualIndicator.updateIndicatorType(PointF(2390f, 1500f)) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_RIGHT_INDICATOR) + + // Check that bubble zones are not available from split + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_SPLIT) + result = visualIndicator.updateIndicatorType(PointF(10f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_LEFT_INDICATOR) + result = visualIndicator.updateIndicatorType(PointF(2390f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_RIGHT_INDICATOR) + + // Check that bubble zones are not available from desktop + createVisualIndicator(DesktopModeVisualIndicator.DragStartState.FROM_FREEFORM) + result = visualIndicator.updateIndicatorType(PointF(10f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_LEFT_INDICATOR) + result = visualIndicator.updateIndicatorType(PointF(2390f, 1500f)) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_RIGHT_INDICATOR) } @Test @@ -298,7 +316,7 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, ) - fun testDefaultIndicators_foldable_leftRightSplit() { + fun testDefaultIndicators_foldable_enableBubbleToFullscreen_dragFromFullscreen() { setUpFoldable() createVisualIndicator( @@ -325,13 +343,47 @@ class DesktopModeVisualIndicatorTest : ShellTestCase() { result = visualIndicator.updateIndicatorType(foldRightBottom()) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_BUBBLE_RIGHT_INDICATOR) + } + + @Test + @EnableFlags( + com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_TO_FULLSCREEN, + com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE, + ) + @DisableFlags(com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_ANYTHING) + fun testDefaultIndicators_foldable_enableBubbleToFullscreen_dragFromSplit() { + setUpFoldable() createVisualIndicator( DesktopModeVisualIndicator.DragStartState.FROM_SPLIT, isSmallTablet = true, isLeftRightSplit = true, ) - result = visualIndicator.updateIndicatorType(foldCenter()) + var result = visualIndicator.updateIndicatorType(foldCenter()) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_FULLSCREEN_INDICATOR) + + // Check that bubbles are not available from split + result = visualIndicator.updateIndicatorType(foldLeftBottom()) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_LEFT_INDICATOR) + + result = visualIndicator.updateIndicatorType(foldRightBottom()) + assertThat(result) + .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_SPLIT_RIGHT_INDICATOR) + } + + @Test + @EnableFlags(com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_ANYTHING) + fun testDefaultIndicators_foldable_enableBubbleAnything_dragFromSplit() { + setUpFoldable() + + createVisualIndicator( + DesktopModeVisualIndicator.DragStartState.FROM_SPLIT, + isSmallTablet = true, + isLeftRightSplit = true, + ) + var result = visualIndicator.updateIndicatorType(foldCenter()) assertThat(result) .isEqualTo(DesktopModeVisualIndicator.IndicatorType.TO_FULLSCREEN_INDICATOR) diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java index 82373ff1bc41..64bd86134d92 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/StageCoordinatorTests.java @@ -167,6 +167,7 @@ public class StageCoordinatorTests extends ShellTestCase { private final TestShellExecutor mMainExecutor = new TestShellExecutor(); private final ShellExecutor mAnimExecutor = new TestShellExecutor(); private final Handler mMainHandler = new Handler(Looper.getMainLooper()); + private final Handler mAnimHandler = mock(Handler.class); private final DisplayAreaInfo mDisplayAreaInfo = new DisplayAreaInfo(new MockToken().token(), DEFAULT_DISPLAY, 0); private final ActivityManager.RunningTaskInfo mMainChildTaskInfo = @@ -629,7 +630,7 @@ public class StageCoordinatorTests extends ShellTestCase { ShellInit shellInit = new ShellInit(mMainExecutor); final Transitions t = new Transitions(mContext, shellInit, mock(ShellController.class), mTaskOrganizer, mTransactionPool, mock(DisplayController.class), - mDisplayInsetsController, mMainExecutor, mMainHandler, mAnimExecutor, + mDisplayInsetsController, mMainExecutor, mMainHandler, mAnimExecutor, mAnimHandler, mock(HomeTransitionObserver.class), mock(FocusTransitionObserver.class)); shellInit.init(); return t; diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/DefaultTransitionHandlerTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/DefaultTransitionHandlerTest.java index 6996d44af034..2dab39184247 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/DefaultTransitionHandlerTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/DefaultTransitionHandlerTest.java @@ -100,7 +100,8 @@ public class DefaultTransitionHandlerTest extends ShellTestCase { mTransitionHandler = new DefaultTransitionHandler( mContext, mShellInit, mDisplayController, mDisplayInsetsController, mTransactionPool, mMainExecutor, mMainHandler, mAnimExecutor, - mRootTaskDisplayAreaOrganizer, mock(InteractionJankMonitor.class)); + mock(Handler.class), mRootTaskDisplayAreaOrganizer, + mock(InteractionJankMonitor.class)); mShellInit.init(); } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java index 52634c08dafd..5d77766dc0db 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/HomeTransitionObserverTest.java @@ -88,6 +88,7 @@ public class HomeTransitionObserverTest extends ShellTestCase { private final ShellExecutor mAnimExecutor = new TestShellExecutor(); private final TestShellExecutor mMainExecutor = new TestShellExecutor(); private final Handler mMainHandler = new Handler(Looper.getMainLooper()); + private final Handler mAnimHandler = mock(Handler.class); private final DisplayController mDisplayController = mock(DisplayController.class); private final DisplayInsetsController mDisplayInsetsController = mock(DisplayInsetsController.class); @@ -105,7 +106,7 @@ public class HomeTransitionObserverTest extends ShellTestCase { mDisplayInsetsController, mock(ShellInit.class)); mTransition = new Transitions(mContext, mock(ShellInit.class), mock(ShellController.class), mOrganizer, mTransactionPool, mDisplayController, mDisplayInsetsController, - mMainExecutor, mMainHandler, mAnimExecutor, mHomeTransitionObserver, + mMainExecutor, mMainHandler, mAnimExecutor, mAnimHandler, mHomeTransitionObserver, mock(FocusTransitionObserver.class)); mHomeTransitionObserver.setHomeTransitionListener(mTransition, mListener); } diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java index 44bb2154f170..4dd9cab1d340 100644 --- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java +++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/transition/ShellTransitionTests.java @@ -146,6 +146,7 @@ public class ShellTransitionTests extends ShellTestCase { private final ShellExecutor mAnimExecutor = new TestShellExecutor(); private final TestTransitionHandler mDefaultHandler = new TestTransitionHandler(); private final Handler mMainHandler = new Handler(Looper.getMainLooper()); + private final Handler mAnimHandler = mock(Handler.class); private final DisplayInsetsController mDisplayInsets = mock(DisplayInsetsController.class); @@ -160,7 +161,7 @@ public class ShellTransitionTests extends ShellTestCase { ShellInit shellInit = mock(ShellInit.class); final Transitions t = new Transitions(mContext, shellInit, mock(ShellController.class), mOrganizer, mTransactionPool, createTestDisplayController(), mDisplayInsets, - mMainExecutor, mMainHandler, mAnimExecutor, + mMainExecutor, mMainHandler, mAnimExecutor, mAnimHandler, mock(HomeTransitionObserver.class), mock(FocusTransitionObserver.class)); // One from Transitions, one from RootTaskDisplayAreaOrganizer verify(shellInit).addInitCallback(any(), eq(t)); @@ -173,7 +174,7 @@ public class ShellTransitionTests extends ShellTestCase { ShellController shellController = mock(ShellController.class); final Transitions t = new Transitions(mContext, shellInit, shellController, mOrganizer, mTransactionPool, createTestDisplayController(), mDisplayInsets, - mMainExecutor, mMainHandler, mAnimExecutor, + mMainExecutor, mMainHandler, mAnimExecutor, mAnimHandler, mock(HomeTransitionObserver.class), mock(FocusTransitionObserver.class)); shellInit.init(); verify(shellController, times(1)).addExternalInterface( @@ -1318,7 +1319,7 @@ public class ShellTransitionTests extends ShellTestCase { final Transitions transitions = new Transitions(mContext, shellInit, mock(ShellController.class), mOrganizer, mTransactionPool, createTestDisplayController(), mDisplayInsets, - mMainExecutor, mMainHandler, mAnimExecutor, + mMainExecutor, mMainHandler, mAnimExecutor, mAnimHandler, mock(HomeTransitionObserver.class), mock(FocusTransitionObserver.class)); final RecentTasksController mockRecentsTaskController = mock(RecentTasksController.class); @@ -1914,7 +1915,8 @@ public class ShellTransitionTests extends ShellTestCase { ShellInit shellInit = new ShellInit(mMainExecutor); final Transitions t = new Transitions(mContext, shellInit, mock(ShellController.class), mOrganizer, mTransactionPool, createTestDisplayController(), mDisplayInsets, - mMainExecutor, mMainHandler, mAnimExecutor, mock(HomeTransitionObserver.class), + mMainExecutor, mMainHandler, mAnimExecutor, mAnimHandler, + mock(HomeTransitionObserver.class), mock(FocusTransitionObserver.class)); shellInit.init(); return t; |