Loading libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleBarLocation.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -70,7 +70,8 @@ enum class BubbleBarLocation : Parcelable { UpdateSource.A11Y_ACTION_BAR, UpdateSource.A11Y_ACTION_BAR, UpdateSource.A11Y_ACTION_BUBBLE, UpdateSource.A11Y_ACTION_BUBBLE, UpdateSource.A11Y_ACTION_EXP_VIEW, UpdateSource.A11Y_ACTION_EXP_VIEW, UpdateSource.APP_ICON_DRAG UpdateSource.APP_ICON_DRAG, UpdateSource.DRAG_TASK, ) ) @Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE) annotation class UpdateSource { annotation class UpdateSource { Loading @@ -95,6 +96,9 @@ enum class BubbleBarLocation : Parcelable { /** Location changed from dragging the application icon to the bubble bar */ /** Location changed from dragging the application icon to the bubble bar */ const val APP_ICON_DRAG = 7 const val APP_ICON_DRAG = 7 /** Location changed from dragging a running task to the bubble bar */ const val DRAG_TASK = 8 } } } } } } libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -845,6 +845,10 @@ public class BubbleController implements ConfigurationChangeListener, mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_APP_ICON_DROP mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_APP_ICON_DROP : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_APP_ICON_DROP); : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_APP_ICON_DROP); break; break; case BubbleBarLocation.UpdateSource.DRAG_TASK: mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_DRAG_TASK : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_DRAG_TASK); break; } } } } Loading Loading @@ -1598,13 +1602,21 @@ public class BubbleController implements ConfigurationChangeListener, if (!BubbleAnythingFlagHelper.enableBubbleToFullscreen()) return; if (!BubbleAnythingFlagHelper.enableBubbleToFullscreen()) return; Bubble b = mBubbleData.getOrCreateBubble(taskInfo); // Removes from overflow Bubble b = mBubbleData.getOrCreateBubble(taskInfo); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", taskInfo.taskId); ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", taskInfo.taskId); BubbleBarLocation location = null; if (dragData != null) { location = dragData.isReleasedOnLeft() ? BubbleBarLocation.LEFT : BubbleBarLocation.RIGHT; } if (b.isInflated()) { if (b.isInflated()) { mBubbleData.setSelectedBubbleAndExpandStack(b); mBubbleData.setSelectedBubbleAndExpandStack(b, location); if (dragData != null && dragData.getPendingWct() != null) { if (dragData != null && dragData.getPendingWct() != null) { mTransitions.startTransition(TRANSIT_CHANGE, mTransitions.startTransition(TRANSIT_CHANGE, dragData.getPendingWct(), /* handler= */ null); dragData.getPendingWct(), /* handler= */ null); } } } else { } else { if (location != null) { setBubbleBarLocation(location, BubbleBarLocation.UpdateSource.DRAG_TASK); } b.enable(Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE); b.enable(Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE); // Lazy init stack view when a bubble is created // Lazy init stack view when a bubble is created ensureBubbleViewsAndWindowCreated(); ensureBubbleViewsAndWindowCreated(); Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -156,6 +156,12 @@ public class BubbleLogger { @UiEvent(doc = "while bubble bar is expanded, switch to another/existing bubble") @UiEvent(doc = "while bubble bar is expanded, switch to another/existing bubble") BUBBLE_BAR_BUBBLE_SWITCHED(1977), BUBBLE_BAR_BUBBLE_SWITCHED(1977), @UiEvent(doc = "bubble bar moved to the left edge of the screen by dragging a task") BUBBLE_BAR_MOVED_LEFT_DRAG_TASK(2146), @UiEvent(doc = "bubble bar moved to the right edge of the screen by dragging a task") BUBBLE_BAR_MOVED_RIGHT_DRAG_TASK(2147), // endregion // endregion ; ; Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +12 −1 Original line number Original line Diff line number Diff line Loading @@ -156,14 +156,18 @@ public class BubbleTransitions { public static class DragData { public static class DragData { private final Rect mBounds; private final Rect mBounds; private final WindowContainerTransaction mPendingWct; private final WindowContainerTransaction mPendingWct; private final boolean mReleasedOnLeft; /** /** * @param bounds bounds of the dragged task when the drag was released * @param bounds bounds of the dragged task when the drag was released * @param wct pending operations to be applied when finishing the drag * @param wct pending operations to be applied when finishing the drag * @param releasedOnLeft true if the bubble was released in the left drop target */ */ public DragData(@Nullable Rect bounds, @Nullable WindowContainerTransaction wct) { public DragData(@Nullable Rect bounds, @Nullable WindowContainerTransaction wct, boolean releasedOnLeft) { mBounds = bounds; mBounds = bounds; mPendingWct = wct; mPendingWct = wct; mReleasedOnLeft = releasedOnLeft; } } /** /** Loading @@ -181,6 +185,13 @@ public class BubbleTransitions { public WindowContainerTransaction getPendingWct() { public WindowContainerTransaction getPendingWct() { return mPendingWct; return mPendingWct; } } /** * @return true if the bubble was released in the left drop target */ public boolean isReleasedOnLeft() { return mReleasedOnLeft; } } } /** /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DragToDesktopTransitionHandler.kt +11 −7 Original line number Original line Diff line number Diff line Loading @@ -257,8 +257,8 @@ sealed class DragToDesktopTransitionHandler( // Animation is handled by BubbleController // Animation is handled by BubbleController val wct = WindowContainerTransaction() val wct = WindowContainerTransaction() restoreWindowOrder(wct, state) restoreWindowOrder(wct, state) // TODO(b/388851898): pass along information about left or right side val onLeft = cancelState == CancelState.CANCEL_BUBBLE_LEFT requestBubbleFromScaledTask(wct) requestBubbleFromScaledTask(wct, onLeft) } } } else { } else { // There's no dragged task, this can happen when the "cancel" happened too quickly // There's no dragged task, this can happen when the "cancel" happened too quickly Loading Loading @@ -318,23 +318,27 @@ sealed class DragToDesktopTransitionHandler( splitScreenController.requestEnterSplitSelect(taskInfo, wct, splitPosition, taskBounds) splitScreenController.requestEnterSplitSelect(taskInfo, wct, splitPosition, taskBounds) } } private fun requestBubbleFromScaledTask(wct: WindowContainerTransaction) { private fun requestBubbleFromScaledTask(wct: WindowContainerTransaction, onLeft: Boolean) { // TODO(b/391928049): update density once we can drag from desktop to bubble // TODO(b/391928049): update density once we can drag from desktop to bubble val state = requireTransitionState() val state = requireTransitionState() val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") val taskBounds = getAnimatedTaskBounds() val taskBounds = getAnimatedTaskBounds() state.dragAnimator.cancelAnimator() state.dragAnimator.cancelAnimator() requestBubble(wct, taskInfo, taskBounds) requestBubble(wct, taskInfo, onLeft, taskBounds) } } private fun requestBubble( private fun requestBubble( wct: WindowContainerTransaction, wct: WindowContainerTransaction, taskInfo: RunningTaskInfo, taskInfo: RunningTaskInfo, onLeft: Boolean, taskBounds: Rect = Rect(taskInfo.configuration.windowConfiguration.bounds), taskBounds: Rect = Rect(taskInfo.configuration.windowConfiguration.bounds), ) { ) { val controller = val controller = bubbleController.orElseThrow { IllegalStateException("BubbleController not set") } bubbleController.orElseThrow { IllegalStateException("BubbleController not set") } controller.expandStackAndSelectBubble(taskInfo, BubbleTransitions.DragData(taskBounds, wct)) controller.expandStackAndSelectBubble( taskInfo, BubbleTransitions.DragData(taskBounds, wct, onLeft), ) } } override fun startAnimation( override fun startAnimation( Loading Loading @@ -497,8 +501,8 @@ sealed class DragToDesktopTransitionHandler( state.draggedTaskChange?.taskInfo ?: error("Expected non-null task info.") state.draggedTaskChange?.taskInfo ?: error("Expected non-null task info.") val wct = WindowContainerTransaction() val wct = WindowContainerTransaction() restoreWindowOrder(wct) restoreWindowOrder(wct) // TODO(b/388851898): pass along information about left or right side val onLeft = state.cancelState == CancelState.CANCEL_BUBBLE_LEFT requestBubble(wct, taskInfo) requestBubble(wct, taskInfo, onLeft) } } return true return true } } Loading Loading
libs/WindowManager/Shell/shared/src/com/android/wm/shell/shared/bubbles/BubbleBarLocation.kt +5 −1 Original line number Original line Diff line number Diff line Loading @@ -70,7 +70,8 @@ enum class BubbleBarLocation : Parcelable { UpdateSource.A11Y_ACTION_BAR, UpdateSource.A11Y_ACTION_BAR, UpdateSource.A11Y_ACTION_BUBBLE, UpdateSource.A11Y_ACTION_BUBBLE, UpdateSource.A11Y_ACTION_EXP_VIEW, UpdateSource.A11Y_ACTION_EXP_VIEW, UpdateSource.APP_ICON_DRAG UpdateSource.APP_ICON_DRAG, UpdateSource.DRAG_TASK, ) ) @Retention(AnnotationRetention.SOURCE) @Retention(AnnotationRetention.SOURCE) annotation class UpdateSource { annotation class UpdateSource { Loading @@ -95,6 +96,9 @@ enum class BubbleBarLocation : Parcelable { /** Location changed from dragging the application icon to the bubble bar */ /** Location changed from dragging the application icon to the bubble bar */ const val APP_ICON_DRAG = 7 const val APP_ICON_DRAG = 7 /** Location changed from dragging a running task to the bubble bar */ const val DRAG_TASK = 8 } } } } } }
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleController.java +13 −1 Original line number Original line Diff line number Diff line Loading @@ -845,6 +845,10 @@ public class BubbleController implements ConfigurationChangeListener, mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_APP_ICON_DROP mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_APP_ICON_DROP : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_APP_ICON_DROP); : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_APP_ICON_DROP); break; break; case BubbleBarLocation.UpdateSource.DRAG_TASK: mLogger.log(onLeft ? BubbleLogger.Event.BUBBLE_BAR_MOVED_LEFT_DRAG_TASK : BubbleLogger.Event.BUBBLE_BAR_MOVED_RIGHT_DRAG_TASK); break; } } } } Loading Loading @@ -1598,13 +1602,21 @@ public class BubbleController implements ConfigurationChangeListener, if (!BubbleAnythingFlagHelper.enableBubbleToFullscreen()) return; if (!BubbleAnythingFlagHelper.enableBubbleToFullscreen()) return; Bubble b = mBubbleData.getOrCreateBubble(taskInfo); // Removes from overflow Bubble b = mBubbleData.getOrCreateBubble(taskInfo); // Removes from overflow ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", taskInfo.taskId); ProtoLog.v(WM_SHELL_BUBBLES, "expandStackAndSelectBubble - intent=%s", taskInfo.taskId); BubbleBarLocation location = null; if (dragData != null) { location = dragData.isReleasedOnLeft() ? BubbleBarLocation.LEFT : BubbleBarLocation.RIGHT; } if (b.isInflated()) { if (b.isInflated()) { mBubbleData.setSelectedBubbleAndExpandStack(b); mBubbleData.setSelectedBubbleAndExpandStack(b, location); if (dragData != null && dragData.getPendingWct() != null) { if (dragData != null && dragData.getPendingWct() != null) { mTransitions.startTransition(TRANSIT_CHANGE, mTransitions.startTransition(TRANSIT_CHANGE, dragData.getPendingWct(), /* handler= */ null); dragData.getPendingWct(), /* handler= */ null); } } } else { } else { if (location != null) { setBubbleBarLocation(location, BubbleBarLocation.UpdateSource.DRAG_TASK); } b.enable(Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE); b.enable(Notification.BubbleMetadata.FLAG_AUTO_EXPAND_BUBBLE); // Lazy init stack view when a bubble is created // Lazy init stack view when a bubble is created ensureBubbleViewsAndWindowCreated(); ensureBubbleViewsAndWindowCreated(); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleLogger.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -156,6 +156,12 @@ public class BubbleLogger { @UiEvent(doc = "while bubble bar is expanded, switch to another/existing bubble") @UiEvent(doc = "while bubble bar is expanded, switch to another/existing bubble") BUBBLE_BAR_BUBBLE_SWITCHED(1977), BUBBLE_BAR_BUBBLE_SWITCHED(1977), @UiEvent(doc = "bubble bar moved to the left edge of the screen by dragging a task") BUBBLE_BAR_MOVED_LEFT_DRAG_TASK(2146), @UiEvent(doc = "bubble bar moved to the right edge of the screen by dragging a task") BUBBLE_BAR_MOVED_RIGHT_DRAG_TASK(2147), // endregion // endregion ; ; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +12 −1 Original line number Original line Diff line number Diff line Loading @@ -156,14 +156,18 @@ public class BubbleTransitions { public static class DragData { public static class DragData { private final Rect mBounds; private final Rect mBounds; private final WindowContainerTransaction mPendingWct; private final WindowContainerTransaction mPendingWct; private final boolean mReleasedOnLeft; /** /** * @param bounds bounds of the dragged task when the drag was released * @param bounds bounds of the dragged task when the drag was released * @param wct pending operations to be applied when finishing the drag * @param wct pending operations to be applied when finishing the drag * @param releasedOnLeft true if the bubble was released in the left drop target */ */ public DragData(@Nullable Rect bounds, @Nullable WindowContainerTransaction wct) { public DragData(@Nullable Rect bounds, @Nullable WindowContainerTransaction wct, boolean releasedOnLeft) { mBounds = bounds; mBounds = bounds; mPendingWct = wct; mPendingWct = wct; mReleasedOnLeft = releasedOnLeft; } } /** /** Loading @@ -181,6 +185,13 @@ public class BubbleTransitions { public WindowContainerTransaction getPendingWct() { public WindowContainerTransaction getPendingWct() { return mPendingWct; return mPendingWct; } } /** * @return true if the bubble was released in the left drop target */ public boolean isReleasedOnLeft() { return mReleasedOnLeft; } } } /** /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/desktopmode/DragToDesktopTransitionHandler.kt +11 −7 Original line number Original line Diff line number Diff line Loading @@ -257,8 +257,8 @@ sealed class DragToDesktopTransitionHandler( // Animation is handled by BubbleController // Animation is handled by BubbleController val wct = WindowContainerTransaction() val wct = WindowContainerTransaction() restoreWindowOrder(wct, state) restoreWindowOrder(wct, state) // TODO(b/388851898): pass along information about left or right side val onLeft = cancelState == CancelState.CANCEL_BUBBLE_LEFT requestBubbleFromScaledTask(wct) requestBubbleFromScaledTask(wct, onLeft) } } } else { } else { // There's no dragged task, this can happen when the "cancel" happened too quickly // There's no dragged task, this can happen when the "cancel" happened too quickly Loading Loading @@ -318,23 +318,27 @@ sealed class DragToDesktopTransitionHandler( splitScreenController.requestEnterSplitSelect(taskInfo, wct, splitPosition, taskBounds) splitScreenController.requestEnterSplitSelect(taskInfo, wct, splitPosition, taskBounds) } } private fun requestBubbleFromScaledTask(wct: WindowContainerTransaction) { private fun requestBubbleFromScaledTask(wct: WindowContainerTransaction, onLeft: Boolean) { // TODO(b/391928049): update density once we can drag from desktop to bubble // TODO(b/391928049): update density once we can drag from desktop to bubble val state = requireTransitionState() val state = requireTransitionState() val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") val taskInfo = state.draggedTaskChange?.taskInfo ?: error("Expected non-null taskInfo") val taskBounds = getAnimatedTaskBounds() val taskBounds = getAnimatedTaskBounds() state.dragAnimator.cancelAnimator() state.dragAnimator.cancelAnimator() requestBubble(wct, taskInfo, taskBounds) requestBubble(wct, taskInfo, onLeft, taskBounds) } } private fun requestBubble( private fun requestBubble( wct: WindowContainerTransaction, wct: WindowContainerTransaction, taskInfo: RunningTaskInfo, taskInfo: RunningTaskInfo, onLeft: Boolean, taskBounds: Rect = Rect(taskInfo.configuration.windowConfiguration.bounds), taskBounds: Rect = Rect(taskInfo.configuration.windowConfiguration.bounds), ) { ) { val controller = val controller = bubbleController.orElseThrow { IllegalStateException("BubbleController not set") } bubbleController.orElseThrow { IllegalStateException("BubbleController not set") } controller.expandStackAndSelectBubble(taskInfo, BubbleTransitions.DragData(taskBounds, wct)) controller.expandStackAndSelectBubble( taskInfo, BubbleTransitions.DragData(taskBounds, wct, onLeft), ) } } override fun startAnimation( override fun startAnimation( Loading Loading @@ -497,8 +501,8 @@ sealed class DragToDesktopTransitionHandler( state.draggedTaskChange?.taskInfo ?: error("Expected non-null task info.") state.draggedTaskChange?.taskInfo ?: error("Expected non-null task info.") val wct = WindowContainerTransaction() val wct = WindowContainerTransaction() restoreWindowOrder(wct) restoreWindowOrder(wct) // TODO(b/388851898): pass along information about left or right side val onLeft = state.cancelState == CancelState.CANCEL_BUBBLE_LEFT requestBubble(wct, taskInfo) requestBubble(wct, taskInfo, onLeft) } } return true return true } } Loading