Loading core/java/android/view/IRecentsAnimationRunner.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.graphics.Rect; import android.view.RemoteAnimationTarget; import android.view.IRecentsAnimationController; import android.window.TaskSnapshot; import android.os.Bundle; /** * Interface that is used to callback from window manager to the process that runs a recents Loading Loading @@ -57,7 +58,7 @@ oneway interface IRecentsAnimationRunner { @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) void onAnimationStart(in IRecentsAnimationController controller, in RemoteAnimationTarget[] apps, in RemoteAnimationTarget[] wallpapers, in Rect homeContentInsets, in Rect minimizedHomeBounds) = 2; in Rect homeContentInsets, in Rect minimizedHomeBounds, in Bundle extras) = 2; /** * Called when the task of an activity that has been started while the recents animation Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +11 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,17 @@ public class RecentTasksController implements TaskStackListenerCallback, } } @Nullable public SplitBounds getSplitBoundsForTaskId(int taskId) { if (taskId == INVALID_TASK_ID) { return null; } // We could do extra verification of requiring both taskIds of a pair and verifying that // the same split bounds object is returned... but meh. Seems unnecessary. return mTaskSplitBoundsMap.get(taskId); } @Override public Context getContext() { return mContext; Loading libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +12 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.recents; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; import static android.view.WindowManager.TRANSIT_CHANGE; Loading @@ -23,6 +24,8 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED; import static android.view.WindowManager.TRANSIT_SLEEP; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static com.android.wm.shell.util.SplitBounds.KEY_EXTRA_SPLIT_BOUNDS; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.app.ActivityManager; Loading Loading @@ -69,6 +72,8 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { private final Transitions mTransitions; private final ShellExecutor mExecutor; @Nullable private final RecentTasksController mRecentTasksController; private IApplicationThread mAnimApp = null; private final ArrayList<RecentsController> mControllers = new ArrayList<>(); Loading @@ -82,6 +87,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { @Nullable RecentTasksController recentTasksController) { mTransitions = transitions; mExecutor = transitions.getMainExecutor(); mRecentTasksController = recentTasksController; if (!Transitions.ENABLE_SHELL_TRANSITIONS) return; if (recentTasksController == null) return; shellInit.addInitCallback(() -> { Loading Loading @@ -417,6 +423,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { mLeashMap = new ArrayMap<>(); mKeyguardLocked = (info.getFlags() & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0; int closingSplitTaskId = INVALID_TASK_ID; final ArrayList<RemoteAnimationTarget> apps = new ArrayList<>(); final ArrayList<RemoteAnimationTarget> wallpapers = new ArrayList<>(); TransitionUtil.LeafTaskFilter leafTaskFilter = new TransitionUtil.LeafTaskFilter(); Loading @@ -443,6 +450,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { apps.add(target); if (TransitionUtil.isClosingType(change.getMode())) { mPausingTasks.add(new TaskState(change, target.leash)); closingSplitTaskId = change.getTaskInfo().taskId; if (taskInfo.topActivityType == ACTIVITY_TYPE_HOME) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, " adding pausing leaf home taskId=%d", taskInfo.taskId); Loading Loading @@ -500,13 +508,16 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { } } t.apply(); Bundle b = new Bundle(1 /*capacity*/); b.putParcelable(KEY_EXTRA_SPLIT_BOUNDS, mRecentTasksController.getSplitBoundsForTaskId(closingSplitTaskId)); try { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "[%d] RecentsController.start: calling onAnimationStart", mInstanceId); mListener.onAnimationStart(this, apps.toArray(new RemoteAnimationTarget[apps.size()]), wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]), new Rect(0, 0, 0, 0), new Rect()); new Rect(0, 0, 0, 0), new Rect(), b); } catch (RemoteException e) { Slog.e(TAG, "Error starting recents animation", e); cancel("onAnimationStart() failed"); Loading libs/WindowManager/Shell/src/com/android/wm/shell/util/SplitBounds.java +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import java.util.Objects; * tasks/leashes/etc in Launcher */ public class SplitBounds implements Parcelable { public static final String KEY_EXTRA_SPLIT_BOUNDS = "key_SplitBounds"; public final Rect leftTopBounds; public final Rect rightBottomBounds; /** This rect represents the actual gap between the two apps */ Loading libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentTasksControllerTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.wm.shell.recents; import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; Loading Loading @@ -367,6 +368,37 @@ public class RecentTasksControllerTest extends ShellTestCase { verify(mRecentTasksController).notifyRecentTasksChanged(); } @Test public void getNullSplitBoundsNonSplitTask() { SplitBounds sb = mRecentTasksController.getSplitBoundsForTaskId(3); assertNull("splitBounds should be null for non-split task", sb); } @Test public void getNullSplitBoundsInvalidTask() { SplitBounds sb = mRecentTasksController.getSplitBoundsForTaskId(INVALID_TASK_ID); assertNull("splitBounds should be null for invalid taskID", sb); } @Test public void getSplitBoundsForSplitTask() { SplitBounds pair1Bounds = mock(SplitBounds.class); SplitBounds pair2Bounds = mock(SplitBounds.class); mRecentTasksController.addSplitPair(1, 2, pair1Bounds); mRecentTasksController.addSplitPair(4, 3, pair2Bounds); SplitBounds splitBounds2 = mRecentTasksController.getSplitBoundsForTaskId(2); SplitBounds splitBounds1 = mRecentTasksController.getSplitBoundsForTaskId(1); assertEquals("Different splitBounds for same pair", splitBounds1, splitBounds2); assertEquals(splitBounds1, pair1Bounds); SplitBounds splitBounds3 = mRecentTasksController.getSplitBoundsForTaskId(3); SplitBounds splitBounds4 = mRecentTasksController.getSplitBoundsForTaskId(4); assertEquals("Different splitBounds for same pair", splitBounds3, splitBounds4); assertEquals(splitBounds4, pair2Bounds); } /** * Helper to create a task with a given task id. */ Loading Loading
core/java/android/view/IRecentsAnimationRunner.aidl +2 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.graphics.Rect; import android.view.RemoteAnimationTarget; import android.view.IRecentsAnimationController; import android.window.TaskSnapshot; import android.os.Bundle; /** * Interface that is used to callback from window manager to the process that runs a recents Loading Loading @@ -57,7 +58,7 @@ oneway interface IRecentsAnimationRunner { @UnsupportedAppUsage(maxTargetSdk = 30, trackingBug = 170729553) void onAnimationStart(in IRecentsAnimationController controller, in RemoteAnimationTarget[] apps, in RemoteAnimationTarget[] wallpapers, in Rect homeContentInsets, in Rect minimizedHomeBounds) = 2; in Rect homeContentInsets, in Rect minimizedHomeBounds, in Bundle extras) = 2; /** * Called when the task of an activity that has been started while the recents animation Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +11 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,17 @@ public class RecentTasksController implements TaskStackListenerCallback, } } @Nullable public SplitBounds getSplitBoundsForTaskId(int taskId) { if (taskId == INVALID_TASK_ID) { return null; } // We could do extra verification of requiring both taskIds of a pair and verifying that // the same split bounds object is returned... but meh. Seems unnecessary. return mTaskSplitBoundsMap.get(taskId); } @Override public Context getContext() { return mContext; Loading
libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentsTransitionHandler.java +12 −1 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ package com.android.wm.shell.recents; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME; import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS; import static android.view.WindowManager.TRANSIT_CHANGE; Loading @@ -23,6 +24,8 @@ import static android.view.WindowManager.TRANSIT_FLAG_KEYGUARD_LOCKED; import static android.view.WindowManager.TRANSIT_SLEEP; import static android.view.WindowManager.TRANSIT_TO_FRONT; import static com.android.wm.shell.util.SplitBounds.KEY_EXTRA_SPLIT_BOUNDS; import android.annotation.Nullable; import android.annotation.SuppressLint; import android.app.ActivityManager; Loading Loading @@ -69,6 +72,8 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { private final Transitions mTransitions; private final ShellExecutor mExecutor; @Nullable private final RecentTasksController mRecentTasksController; private IApplicationThread mAnimApp = null; private final ArrayList<RecentsController> mControllers = new ArrayList<>(); Loading @@ -82,6 +87,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { @Nullable RecentTasksController recentTasksController) { mTransitions = transitions; mExecutor = transitions.getMainExecutor(); mRecentTasksController = recentTasksController; if (!Transitions.ENABLE_SHELL_TRANSITIONS) return; if (recentTasksController == null) return; shellInit.addInitCallback(() -> { Loading Loading @@ -417,6 +423,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { mLeashMap = new ArrayMap<>(); mKeyguardLocked = (info.getFlags() & TRANSIT_FLAG_KEYGUARD_LOCKED) != 0; int closingSplitTaskId = INVALID_TASK_ID; final ArrayList<RemoteAnimationTarget> apps = new ArrayList<>(); final ArrayList<RemoteAnimationTarget> wallpapers = new ArrayList<>(); TransitionUtil.LeafTaskFilter leafTaskFilter = new TransitionUtil.LeafTaskFilter(); Loading @@ -443,6 +450,7 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { apps.add(target); if (TransitionUtil.isClosingType(change.getMode())) { mPausingTasks.add(new TaskState(change, target.leash)); closingSplitTaskId = change.getTaskInfo().taskId; if (taskInfo.topActivityType == ACTIVITY_TYPE_HOME) { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, " adding pausing leaf home taskId=%d", taskInfo.taskId); Loading Loading @@ -500,13 +508,16 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler { } } t.apply(); Bundle b = new Bundle(1 /*capacity*/); b.putParcelable(KEY_EXTRA_SPLIT_BOUNDS, mRecentTasksController.getSplitBoundsForTaskId(closingSplitTaskId)); try { ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENTS_TRANSITION, "[%d] RecentsController.start: calling onAnimationStart", mInstanceId); mListener.onAnimationStart(this, apps.toArray(new RemoteAnimationTarget[apps.size()]), wallpapers.toArray(new RemoteAnimationTarget[wallpapers.size()]), new Rect(0, 0, 0, 0), new Rect()); new Rect(0, 0, 0, 0), new Rect(), b); } catch (RemoteException e) { Slog.e(TAG, "Error starting recents animation", e); cancel("onAnimationStart() failed"); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/util/SplitBounds.java +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,8 @@ import java.util.Objects; * tasks/leashes/etc in Launcher */ public class SplitBounds implements Parcelable { public static final String KEY_EXTRA_SPLIT_BOUNDS = "key_SplitBounds"; public final Rect leftTopBounds; public final Rect rightBottomBounds; /** This rect represents the actual gap between the two apps */ Loading
libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/recents/RecentTasksControllerTest.java +32 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.wm.shell.recents; import static android.app.ActivityManager.RECENT_IGNORE_UNAVAILABLE; import static android.app.ActivityTaskManager.INVALID_TASK_ID; import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN; import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; Loading Loading @@ -367,6 +368,37 @@ public class RecentTasksControllerTest extends ShellTestCase { verify(mRecentTasksController).notifyRecentTasksChanged(); } @Test public void getNullSplitBoundsNonSplitTask() { SplitBounds sb = mRecentTasksController.getSplitBoundsForTaskId(3); assertNull("splitBounds should be null for non-split task", sb); } @Test public void getNullSplitBoundsInvalidTask() { SplitBounds sb = mRecentTasksController.getSplitBoundsForTaskId(INVALID_TASK_ID); assertNull("splitBounds should be null for invalid taskID", sb); } @Test public void getSplitBoundsForSplitTask() { SplitBounds pair1Bounds = mock(SplitBounds.class); SplitBounds pair2Bounds = mock(SplitBounds.class); mRecentTasksController.addSplitPair(1, 2, pair1Bounds); mRecentTasksController.addSplitPair(4, 3, pair2Bounds); SplitBounds splitBounds2 = mRecentTasksController.getSplitBoundsForTaskId(2); SplitBounds splitBounds1 = mRecentTasksController.getSplitBoundsForTaskId(1); assertEquals("Different splitBounds for same pair", splitBounds1, splitBounds2); assertEquals(splitBounds1, pair1Bounds); SplitBounds splitBounds3 = mRecentTasksController.getSplitBoundsForTaskId(3); SplitBounds splitBounds4 = mRecentTasksController.getSplitBoundsForTaskId(4); assertEquals("Different splitBounds for same pair", splitBounds3, splitBounds4); assertEquals(splitBounds4, pair2Bounds); } /** * Helper to create a task with a given task id. */ Loading