Loading libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskStackListenerTest.kt +8 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.wm.shell.bubbles import android.app.ActivityManager import android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN import android.os.Binder import android.os.IBinder import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule Loading @@ -30,11 +31,12 @@ import com.android.internal.protolog.ProtoLog import com.android.window.flags.Flags.FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP import com.android.window.flags.Flags.FLAG_EXCLUDE_TASK_FROM_RECENTS import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_ANYTHING import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_APP_COMPAT_FIXES import com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE import com.android.wm.shell.ShellTaskOrganizer import com.android.wm.shell.bubbles.util.verifyExitBubbleTransaction import com.android.wm.shell.taskview.TaskView import com.android.wm.shell.taskview.TaskViewTaskController import com.android.wm.shell.bubbles.util.verifyExitBubbleTransaction import org.junit.Before import org.junit.Rule import org.junit.Test Loading @@ -44,6 +46,7 @@ import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.stub import org.mockito.kotlin.verify import org.mockito.kotlin.whenever /** * Unit tests for [BubbleTaskStackListener]. Loading Loading @@ -111,8 +114,11 @@ class BubbleTaskStackListenerTest { FLAG_ENABLE_BUBBLE_ANYTHING, FLAG_EXCLUDE_TASK_FROM_RECENTS, FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP, FLAG_ENABLE_BUBBLE_APP_COMPAT_FIXES, ) fun onActivityRestartAttempt_inStackAppBubbleToFullscreen_notifiesTaskRemoval() { val captionInsetsOwner = Binder() whenever(bubble.taskView.captionInsetsOwner).thenReturn(captionInsetsOwner) task.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FULLSCREEN bubbleData.stub { on { getBubbleInStackWithTaskId(bubbleTaskId) } doReturn bubble Loading @@ -131,7 +137,7 @@ class BubbleTaskStackListenerTest { verify(taskOrganizer).applyTransaction(wctCaptor.capture()) wctCaptor.lastValue } verifyExitBubbleTransaction(wct, bubbleTaskToken.asBinder()) verifyExitBubbleTransaction(wct, bubbleTaskToken.asBinder(), captionInsetsOwner) verify(taskOrganizer).setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) verify(taskViewTaskController).notifyTaskRemovalStarted(task) } Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskStackListener.kt +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ class BubbleTaskStackListener( val taskViewTaskController: TaskViewTaskController = bubble.taskView.controller val taskOrganizer: ShellTaskOrganizer = taskViewTaskController.taskOrganizer val wct = getExitBubbleTransaction(task.token) val wct = getExitBubbleTransaction(task.token, bubble.taskView.captionInsetsOwner) taskOrganizer.applyTransaction(wct) taskOrganizer.setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +6 −2 Original line number Diff line number Diff line Loading @@ -1320,7 +1320,9 @@ public class BubbleTransitions { mBubble.setPreparingTransition(this); final WindowContainerToken token = mTaskInfo.getToken(); final WindowContainerTransaction wct = getExitBubbleTransaction(token); final Binder captionInsetsOwner = mBubble.getTaskView().getCaptionInsetsOwner(); final WindowContainerTransaction wct = getExitBubbleTransaction(token, captionInsetsOwner); mTaskOrganizer.setInterceptBackPressedOnTaskRoot(token, false /* intercept */); mTaskViewTransitions.enqueueExternal( mBubble.getTaskView().getController(), Loading Loading @@ -1479,7 +1481,9 @@ public class BubbleTransitions { mTransactionProvider = transactionProvider; bubble.setPreparingTransition(this); final WindowContainerToken token = bubble.getTaskView().getTaskInfo().getToken(); final WindowContainerTransaction wct = getExitBubbleTransaction(token); final Binder captionInsetsOwner = bubble.getTaskView().getCaptionInsetsOwner(); final WindowContainerTransaction wct = getExitBubbleTransaction(token, captionInsetsOwner); wct.reorder(token, /* onTop= */ true); if (!BubbleAnythingFlagHelper.enableCreateAnyBubbleWithForceExcludedFromRecents()) { wct.setHidden(token, false); Loading libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/util/BubbleUtils.kt +13 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.wm.shell.bubbles.util import android.app.WindowConfiguration import android.os.Binder import android.view.WindowInsets import android.window.WindowContainerToken import android.window.WindowContainerTransaction import com.android.window.flags.Flags Loading @@ -31,6 +33,7 @@ private fun getBubbleTransaction( toBubble: Boolean, isAppBubble: Boolean, reparentToTda: Boolean, captionInsetsOwner: Binder?, ): WindowContainerTransaction { val wct = WindowContainerTransaction() if (reparentToTda) { Loading Loading @@ -63,6 +66,13 @@ private fun getBubbleTransaction( if (BubbleAnythingFlagHelper.enableCreateAnyBubble()) { wct.setDisableLaunchAdjacent(token, toBubble /* disableLaunchAdjacent */) } if (BubbleAnythingFlagHelper.enableCreateAnyBubbleWithAppCompatFixes()) { if (!toBubble && captionInsetsOwner != null) { wct.removeInsetsSource( token, captionInsetsOwner, 0 /* index */, WindowInsets.Type.captionBar() ) } } return wct } Loading @@ -84,6 +94,7 @@ fun getEnterBubbleTransaction( toBubble = true, isAppBubble, reparentToTda, captionInsetsOwner = null, ) } Loading @@ -92,6 +103,7 @@ fun getEnterBubbleTransaction( */ fun getExitBubbleTransaction( token: WindowContainerToken, captionInsetsOwner: Binder?, ): WindowContainerTransaction { return getBubbleTransaction( token, Loading @@ -99,6 +111,7 @@ fun getExitBubbleTransaction( // Everything will be reset, so doesn't matter for exit. isAppBubble = true, reparentToTda = false, captionInsetsOwner, ) } libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskView.java +8 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.pm.ShortcutInfo; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.Region; import android.os.Binder; import android.os.Handler; import android.view.SurfaceControl; import android.view.SurfaceHolder; Loading Loading @@ -245,6 +246,13 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, } } /** * Call to get the owner of the caption insets source. */ @Nullable public Binder getCaptionInsetsOwner() { return mTaskViewTaskController.getCaptionInsetsOwner(); } /** * Call when view position or size has changed. Do not call when animating. */ Loading Loading
libs/WindowManager/Shell/multivalentTests/src/com/android/wm/shell/bubbles/BubbleTaskStackListenerTest.kt +8 −2 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.wm.shell.bubbles import android.app.ActivityManager import android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN import android.os.Binder import android.os.IBinder import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule Loading @@ -30,11 +31,12 @@ import com.android.internal.protolog.ProtoLog import com.android.window.flags.Flags.FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP import com.android.window.flags.Flags.FLAG_EXCLUDE_TASK_FROM_RECENTS import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_ANYTHING import com.android.wm.shell.Flags.FLAG_ENABLE_BUBBLE_APP_COMPAT_FIXES import com.android.wm.shell.Flags.FLAG_ENABLE_CREATE_ANY_BUBBLE import com.android.wm.shell.ShellTaskOrganizer import com.android.wm.shell.bubbles.util.verifyExitBubbleTransaction import com.android.wm.shell.taskview.TaskView import com.android.wm.shell.taskview.TaskViewTaskController import com.android.wm.shell.bubbles.util.verifyExitBubbleTransaction import org.junit.Before import org.junit.Rule import org.junit.Test Loading @@ -44,6 +46,7 @@ import org.mockito.kotlin.doReturn import org.mockito.kotlin.mock import org.mockito.kotlin.stub import org.mockito.kotlin.verify import org.mockito.kotlin.whenever /** * Unit tests for [BubbleTaskStackListener]. Loading Loading @@ -111,8 +114,11 @@ class BubbleTaskStackListenerTest { FLAG_ENABLE_BUBBLE_ANYTHING, FLAG_EXCLUDE_TASK_FROM_RECENTS, FLAG_DISALLOW_BUBBLE_TO_ENTER_PIP, FLAG_ENABLE_BUBBLE_APP_COMPAT_FIXES, ) fun onActivityRestartAttempt_inStackAppBubbleToFullscreen_notifiesTaskRemoval() { val captionInsetsOwner = Binder() whenever(bubble.taskView.captionInsetsOwner).thenReturn(captionInsetsOwner) task.configuration.windowConfiguration.windowingMode = WINDOWING_MODE_FULLSCREEN bubbleData.stub { on { getBubbleInStackWithTaskId(bubbleTaskId) } doReturn bubble Loading @@ -131,7 +137,7 @@ class BubbleTaskStackListenerTest { verify(taskOrganizer).applyTransaction(wctCaptor.capture()) wctCaptor.lastValue } verifyExitBubbleTransaction(wct, bubbleTaskToken.asBinder()) verifyExitBubbleTransaction(wct, bubbleTaskToken.asBinder(), captionInsetsOwner) verify(taskOrganizer).setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) verify(taskViewTaskController).notifyTaskRemovalStarted(task) } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTaskStackListener.kt +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ class BubbleTaskStackListener( val taskViewTaskController: TaskViewTaskController = bubble.taskView.controller val taskOrganizer: ShellTaskOrganizer = taskViewTaskController.taskOrganizer val wct = getExitBubbleTransaction(task.token) val wct = getExitBubbleTransaction(task.token, bubble.taskView.captionInsetsOwner) taskOrganizer.applyTransaction(wct) taskOrganizer.setInterceptBackPressedOnTaskRoot(task.token, false /* intercept */) Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/BubbleTransitions.java +6 −2 Original line number Diff line number Diff line Loading @@ -1320,7 +1320,9 @@ public class BubbleTransitions { mBubble.setPreparingTransition(this); final WindowContainerToken token = mTaskInfo.getToken(); final WindowContainerTransaction wct = getExitBubbleTransaction(token); final Binder captionInsetsOwner = mBubble.getTaskView().getCaptionInsetsOwner(); final WindowContainerTransaction wct = getExitBubbleTransaction(token, captionInsetsOwner); mTaskOrganizer.setInterceptBackPressedOnTaskRoot(token, false /* intercept */); mTaskViewTransitions.enqueueExternal( mBubble.getTaskView().getController(), Loading Loading @@ -1479,7 +1481,9 @@ public class BubbleTransitions { mTransactionProvider = transactionProvider; bubble.setPreparingTransition(this); final WindowContainerToken token = bubble.getTaskView().getTaskInfo().getToken(); final WindowContainerTransaction wct = getExitBubbleTransaction(token); final Binder captionInsetsOwner = bubble.getTaskView().getCaptionInsetsOwner(); final WindowContainerTransaction wct = getExitBubbleTransaction(token, captionInsetsOwner); wct.reorder(token, /* onTop= */ true); if (!BubbleAnythingFlagHelper.enableCreateAnyBubbleWithForceExcludedFromRecents()) { wct.setHidden(token, false); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/bubbles/util/BubbleUtils.kt +13 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,8 @@ package com.android.wm.shell.bubbles.util import android.app.WindowConfiguration import android.os.Binder import android.view.WindowInsets import android.window.WindowContainerToken import android.window.WindowContainerTransaction import com.android.window.flags.Flags Loading @@ -31,6 +33,7 @@ private fun getBubbleTransaction( toBubble: Boolean, isAppBubble: Boolean, reparentToTda: Boolean, captionInsetsOwner: Binder?, ): WindowContainerTransaction { val wct = WindowContainerTransaction() if (reparentToTda) { Loading Loading @@ -63,6 +66,13 @@ private fun getBubbleTransaction( if (BubbleAnythingFlagHelper.enableCreateAnyBubble()) { wct.setDisableLaunchAdjacent(token, toBubble /* disableLaunchAdjacent */) } if (BubbleAnythingFlagHelper.enableCreateAnyBubbleWithAppCompatFixes()) { if (!toBubble && captionInsetsOwner != null) { wct.removeInsetsSource( token, captionInsetsOwner, 0 /* index */, WindowInsets.Type.captionBar() ) } } return wct } Loading @@ -84,6 +94,7 @@ fun getEnterBubbleTransaction( toBubble = true, isAppBubble, reparentToTda, captionInsetsOwner = null, ) } Loading @@ -92,6 +103,7 @@ fun getEnterBubbleTransaction( */ fun getExitBubbleTransaction( token: WindowContainerToken, captionInsetsOwner: Binder?, ): WindowContainerTransaction { return getBubbleTransaction( token, Loading @@ -99,6 +111,7 @@ fun getExitBubbleTransaction( // Everything will be reset, so doesn't matter for exit. isAppBubble = true, reparentToTda = false, captionInsetsOwner, ) }
libs/WindowManager/Shell/src/com/android/wm/shell/taskview/TaskView.java +8 −0 Original line number Diff line number Diff line Loading @@ -29,6 +29,7 @@ import android.content.pm.ShortcutInfo; import android.graphics.Insets; import android.graphics.Rect; import android.graphics.Region; import android.os.Binder; import android.os.Handler; import android.view.SurfaceControl; import android.view.SurfaceHolder; Loading Loading @@ -245,6 +246,13 @@ public class TaskView extends SurfaceView implements SurfaceHolder.Callback, } } /** * Call to get the owner of the caption insets source. */ @Nullable public Binder getCaptionInsetsOwner() { return mTaskViewTaskController.getCaptionInsetsOwner(); } /** * Call when view position or size has changed. Do not call when animating. */ Loading