diff options
| author | 2024-02-27 20:04:41 +0000 | |
|---|---|---|
| committer | 2024-02-28 18:19:50 +0000 | |
| commit | 77bc00c36ee8c5c03bdc5d85f69dc757bbe3e10f (patch) | |
| tree | a51cc77c0c65ff0eca15e6a8570ffcbed47d02d0 | |
| parent | 9b2ce0e931c896649fab3cef5dbf6d2a08ce0bfb (diff) | |
Add supplemental split protologs
- This gives slightly more detailed info about what's happening
w/ split
Bug: 280494204
Test: Presubmit
Change-Id: I5bf1f478946522e4844010715287e71cb2cbec2d
Signed-off-by: Winson Chung <winsonc@google.com>
8 files changed, 205 insertions, 30 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java index f801b0d01084..a87116ea4670 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/DividerView.java @@ -75,7 +75,6 @@ public class DividerView extends FrameLayout implements View.OnTouchListener { private SurfaceControlViewHost mViewHost; private DividerHandleView mHandle; private DividerRoundedCorner mCorners; - private View mBackground; private int mTouchElevation; private VelocityTracker mVelocityTracker; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java index 2b1037711249..194eb47c9360 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/split/SplitDecorManager.java @@ -277,7 +277,7 @@ public class SplitDecorManager extends WindowlessWindowManager { } @Override - public void onAnimationEnd(@androidx.annotation.NonNull Animator animation) { + public void onAnimationEnd(@NonNull Animator animation) { mRunningAnimationCount--; animT.remove(mScreenshot); animT.apply(); diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java index e4213569b526..1c54754e9953 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/recents/RecentTasksController.java @@ -163,14 +163,14 @@ public class RecentTasksController implements TaskStackListenerCallback, /** * Adds a split pair. This call does not validate the taskIds, only that they are not the same. */ - public void addSplitPair(int taskId1, int taskId2, SplitBounds splitBounds) { + public boolean addSplitPair(int taskId1, int taskId2, SplitBounds splitBounds) { if (taskId1 == taskId2) { - return; + return false; } if (mSplitTasks.get(taskId1, INVALID_TASK_ID) == taskId2 && mTaskSplitBoundsMap.get(taskId1).equals(splitBounds)) { // If the two tasks are already paired and the bounds are the same, then skip updating - return; + return false; } // Remove any previous pairs removeSplitPair(taskId1); @@ -185,6 +185,7 @@ public class RecentTasksController implements TaskStackListenerCallback, notifyRecentTasksChanged(); ProtoLog.v(ShellProtoLogGroup.WM_SHELL_RECENT_TASKS, "Add split pair: %d, %d, %s", taskId1, taskId2, splitBounds); + return true; } /** diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java index e52235fda80f..64e26dbd70be 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/MainStage.java @@ -16,11 +16,14 @@ package com.android.wm.shell.splitscreen; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN; + import android.content.Context; import android.view.SurfaceSession; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; +import com.android.internal.protolog.common.ProtoLog; import com.android.launcher3.icons.IconProvider; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.SyncTransactionQueue; @@ -50,6 +53,8 @@ class MainStage extends StageTaskListener { void activate(WindowContainerTransaction wct, boolean includingTopTask) { if (mIsActive) return; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "activate: main stage includingTopTask=%b", + includingTopTask); if (includingTopTask) { reparentTopTask(wct); @@ -64,6 +69,8 @@ class MainStage extends StageTaskListener { void deactivate(WindowContainerTransaction wct, boolean toTop) { if (!mIsActive) return; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "deactivate: main stage toTop=%b rootTaskInfo=%s", + toTop, mRootTaskInfo); mIsActive = false; if (mRootTaskInfo == null) return; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java index 9903113c5453..f5fbae55960a 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SideStage.java @@ -16,12 +16,15 @@ package com.android.wm.shell.splitscreen; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN; + import android.app.ActivityManager; import android.content.Context; import android.view.SurfaceSession; import android.window.WindowContainerToken; import android.window.WindowContainerTransaction; +import com.android.internal.protolog.common.ProtoLog; import com.android.launcher3.icons.IconProvider; import com.android.wm.shell.ShellTaskOrganizer; import com.android.wm.shell.common.SyncTransactionQueue; @@ -47,6 +50,8 @@ class SideStage extends StageTaskListener { } boolean removeAllTasks(WindowContainerTransaction wct, boolean toTop) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "remove all side stage tasks: childCount=%d toTop=%b", + mChildrenTaskInfo.size(), toTop); if (mChildrenTaskInfo.size() == 0) return false; wct.reparentTasks( mRootTaskInfo.token, @@ -59,6 +64,8 @@ class SideStage extends StageTaskListener { boolean removeTask(int taskId, WindowContainerToken newParent, WindowContainerTransaction wct) { final ActivityManager.RunningTaskInfo task = mChildrenTaskInfo.get(taskId); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "remove side stage task: task=%d exists=%b", taskId, + task != null); if (task == null) return false; wct.reparent(task.token, newParent, false /* onTop */); return true; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java index b60e361caad8..1d9fdeb92715 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/SplitScreenTransitions.java @@ -25,6 +25,8 @@ import static com.android.wm.shell.animation.Interpolators.ALPHA_IN; import static com.android.wm.shell.animation.Interpolators.ALPHA_OUT; import static com.android.wm.shell.common.split.SplitScreenConstants.FADE_DURATION; import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_TRANSITIONS; import static com.android.wm.shell.splitscreen.SplitScreen.stageTypeToString; import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_DRAG_DIVIDER; import static com.android.wm.shell.splitscreen.SplitScreenController.exitReasonToString; @@ -101,6 +103,7 @@ class SplitScreenTransitions { @NonNull Transitions.TransitionFinishCallback finishCallback, @NonNull WindowContainerToken mainRoot, @NonNull WindowContainerToken sideRoot, @NonNull WindowContainerToken topRoot) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "playAnimation: transition=%d", info.getDebugId()); initTransition(transition, finishTransaction, finishCallback); final TransitSession pendingTransition = getPendingTransition(transition); @@ -123,10 +126,12 @@ class SplitScreenTransitions { playInternalAnimation(transition, info, startTransaction, mainRoot, sideRoot, topRoot); } - /** Internal funcation of playAnimation. */ + /** Internal function of playAnimation. */ private void playInternalAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull WindowContainerToken mainRoot, @NonNull WindowContainerToken sideRoot, @NonNull WindowContainerToken topRoot) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "playInternalAnimation: transition=%d", + info.getDebugId()); // Play some place-holder fade animations final boolean isEnter = isPendingEnter(transition); for (int i = info.getChanges().size() - 1; i >= 0; --i) { @@ -220,6 +225,8 @@ class SplitScreenTransitions { @NonNull Transitions.TransitionFinishCallback finishCallback, @NonNull WindowContainerToken toTopRoot, @NonNull SplitDecorManager toTopDecor, @NonNull WindowContainerToken topRoot) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "playDragDismissAnimation: transition=%d", + info.getDebugId()); initTransition(transition, finishTransaction, finishCallback); for (int i = info.getChanges().size() - 1; i >= 0; --i) { @@ -259,6 +266,7 @@ class SplitScreenTransitions { @NonNull Transitions.TransitionFinishCallback finishCallback, @NonNull WindowContainerToken mainRoot, @NonNull WindowContainerToken sideRoot, @NonNull SplitDecorManager mainDecor, @NonNull SplitDecorManager sideDecor) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "playResizeAnimation: transition=%d", info.getDebugId()); initTransition(transition, finishTransaction, finishCallback); for (int i = info.getChanges().size() - 1; i >= 0; --i) { @@ -312,13 +320,15 @@ class SplitScreenTransitions { @Nullable private TransitSession getPendingTransition(IBinder transition) { if (isPendingEnter(transition)) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "\tresolved enter transition"); return mPendingEnter; } else if (isPendingDismiss(transition)) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "\tresolved dismiss transition"); return mPendingDismiss; } else if (isPendingResize(transition)) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "\tresolved resize transition"); return mPendingResize; } - return null; } @@ -339,7 +349,7 @@ class SplitScreenTransitions { Transitions.TransitionHandler handler, int extraTransitType, boolean resizeAnim) { if (mPendingEnter != null) { - ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + ProtoLog.v(WM_SHELL_TRANSITIONS, " splitTransition " + " skip to start enter split transition since it already exist. "); return null; } @@ -355,8 +365,10 @@ class SplitScreenTransitions { mPendingEnter = new EnterSession( transition, remoteTransition, extraTransitType, resizeAnim); - ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + ProtoLog.v(WM_SHELL_TRANSITIONS, " splitTransition " + " deduced Enter split screen"); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "setEnterTransition: transitType=%d resize=%b", + extraTransitType, resizeAnim); } /** Starts a transition to dismiss split. */ @@ -364,7 +376,7 @@ class SplitScreenTransitions { Transitions.TransitionHandler handler, @SplitScreen.StageType int dismissTop, @SplitScreenController.ExitReason int reason) { if (mPendingDismiss != null) { - ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + ProtoLog.v(WM_SHELL_TRANSITIONS, " splitTransition " + " skip to start dismiss split transition since it already exist. reason to " + " dismiss = %s", exitReasonToString(reason)); return null; @@ -381,9 +393,11 @@ class SplitScreenTransitions { @SplitScreenController.ExitReason int reason) { mPendingDismiss = new DismissSession(transition, reason, dismissTop); - ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + ProtoLog.v(WM_SHELL_TRANSITIONS, " splitTransition " + " deduced Dismiss due to %s. toTop=%s", exitReasonToString(reason), stageTypeToString(dismissTop)); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "setDismissTransition: reason=%s dismissTop=%s", + exitReasonToString(reason), stageTypeToString(dismissTop)); } IBinder startResizeTransition(WindowContainerTransaction wct, @@ -405,8 +419,9 @@ class SplitScreenTransitions { @Nullable TransitionConsumedCallback consumedCallback, @Nullable TransitionFinishedCallback finishCallback) { mPendingResize = new TransitSession(transition, consumedCallback, finishCallback); - ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " splitTransition " + ProtoLog.v(WM_SHELL_TRANSITIONS, " splitTransition " + " deduced Resize split screen"); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "setResizeTransition"); } void mergeAnimation(IBinder transition, TransitionInfo info, SurfaceControl.Transaction t, @@ -444,12 +459,15 @@ class SplitScreenTransitions { mPendingEnter.onConsumed(aborted); mPendingEnter = null; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTransitionConsumed for enter transition"); } else if (isPendingDismiss(transition)) { mPendingDismiss.onConsumed(aborted); mPendingDismiss = null; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTransitionConsumed for dismiss transition"); } else if (isPendingResize(transition)) { mPendingResize.onConsumed(aborted); mPendingResize = null; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTransitionConsumed for resize transition"); } // TODO: handle transition consumed for active remote handler @@ -462,12 +480,15 @@ class SplitScreenTransitions { if (isPendingEnter(mAnimatingTransition)) { mPendingEnter.onFinished(wct, mFinishTransaction); mPendingEnter = null; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onFinish for enter transition"); } else if (isPendingDismiss(mAnimatingTransition)) { mPendingDismiss.onFinished(wct, mFinishTransaction); mPendingDismiss = null; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onFinish for dismiss transition"); } else if (isPendingResize(mAnimatingTransition)) { mPendingResize.onFinished(wct, mFinishTransaction); mPendingResize = null; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onFinish for resize transition"); } mActiveRemoteHandler = null; diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java index fa14b4c64fe0..c01181b284dc 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java @@ -44,6 +44,7 @@ import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSIT import static com.android.wm.shell.common.split.SplitScreenConstants.splitPositionToString; import static com.android.wm.shell.common.split.SplitScreenUtils.reverseSplitPosition; import static com.android.wm.shell.common.split.SplitScreenUtils.splitFailureMessage; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN; import static com.android.wm.shell.shared.TransitionUtil.isClosingType; import static com.android.wm.shell.shared.TransitionUtil.isOpeningType; import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_MAIN; @@ -138,6 +139,7 @@ import com.android.wm.shell.recents.RecentTasksController; import com.android.wm.shell.shared.TransitionUtil; import com.android.wm.shell.splitscreen.SplitScreen.StageType; import com.android.wm.shell.splitscreen.SplitScreenController.ExitReason; +import com.android.wm.shell.splitscreen.SplitScreenController.SplitEnterReason; import com.android.wm.shell.transition.DefaultMixedHandler; import com.android.wm.shell.transition.LegacyTransitions; import com.android.wm.shell.transition.Transitions; @@ -313,6 +315,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, taskOrganizer.createRootTask(displayId, WINDOWING_MODE_FULLSCREEN, this /* listener */); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "Creating main/side root task"); mMainStage = new MainStage( mContext, mTaskOrganizer, @@ -454,6 +457,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, boolean moveToStage(ActivityManager.RunningTaskInfo task, @SplitPosition int stagePosition, WindowContainerTransaction wct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "moveToStage: task=%d position=%d", task.taskId, + stagePosition); prepareEnterSplitScreen(wct, task, stagePosition, false /* resizeAnim */); if (ENABLE_SHELL_TRANSITIONS) { mSplitTransitions.startEnterTransition(TRANSIT_TO_FRONT, wct, @@ -474,6 +479,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } boolean removeFromSideStage(int taskId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "removeFromSideStage: task=%d", taskId); final WindowContainerTransaction wct = new WindowContainerTransaction(); /** @@ -498,11 +504,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, enteredSplitSelect |= listener.onRequestEnterSplitSelect(taskInfo, splitPosition, taskBounds); } - if (enteredSplitSelect) mTaskOrganizer.applyTransaction(wct); + if (enteredSplitSelect) { + mTaskOrganizer.applyTransaction(wct); + } } void startShortcut(String packageName, String shortcutId, @SplitPosition int position, Bundle options, UserHandle user) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "startShortcut: pkg=%s id=%s position=%d user=%d", + packageName, shortcutId, position, user.getIdentifier()); final boolean isEnteringSplit = !isSplitActive(); IRemoteAnimationRunner wrapper = new IRemoteAnimationRunner.Stub() { @@ -564,6 +574,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Use this method to launch an existing Task via a taskId */ void startTask(int taskId, @SplitPosition int position, @Nullable Bundle options) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "startTask: task=%d position=%d", taskId, position); mSplitRequest = new SplitRequest(taskId, position); final WindowContainerTransaction wct = new WindowContainerTransaction(); options = resolveStartStage(STAGE_TYPE_UNDEFINED, position, options, null /* wct */); @@ -595,6 +606,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Launches an activity into split. */ void startIntent(PendingIntent intent, Intent fillInIntent, @SplitPosition int position, @Nullable Bundle options) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "startIntent: intent=%s position=%d", intent.getIntent(), + position); mSplitRequest = new SplitRequest(intent.getIntent(), position); if (!ENABLE_SHELL_TRANSITIONS) { startIntentLegacy(intent, fillInIntent, position, options); @@ -690,6 +703,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, void startTasks(int taskId1, @Nullable Bundle options1, int taskId2, @Nullable Bundle options2, @SplitPosition int splitPosition, @PersistentSnapPosition int snapPosition, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "startTasks: task1=%d task2=%d position=%d snapPosition=%d", + taskId1, taskId2, splitPosition, snapPosition); final WindowContainerTransaction wct = new WindowContainerTransaction(); if (taskId2 == INVALID_TASK_ID) { if (mMainStage.containsTask(taskId1) || mSideStage.containsTask(taskId1)) { @@ -718,6 +734,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Nullable Bundle options1, int taskId, @Nullable Bundle options2, @SplitPosition int splitPosition, @PersistentSnapPosition int snapPosition, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "startIntentAndTask: intent=%s task1=%d position=%d snapPosition=%d", + pendingIntent.getIntent(), taskId, splitPosition, snapPosition); final WindowContainerTransaction wct = new WindowContainerTransaction(); if (taskId == INVALID_TASK_ID) { options1 = options1 != null ? options1 : new Bundle(); @@ -740,6 +759,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, int taskId, @Nullable Bundle options2, @SplitPosition int splitPosition, @PersistentSnapPosition int snapPosition, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "startShortcutAndTask: shortcut=%s task1=%d position=%d snapPosition=%d", + shortcutInfo, taskId, splitPosition, snapPosition); final WindowContainerTransaction wct = new WindowContainerTransaction(); if (taskId == INVALID_TASK_ID) { options1 = options1 != null ? options1 : new Bundle(); @@ -801,6 +823,10 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Nullable ShortcutInfo shortcutInfo2, @Nullable Bundle options2, @SplitPosition int splitPosition, @PersistentSnapPosition int snapPosition, @Nullable RemoteTransition remoteTransition, InstanceId instanceId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "startIntents: intent1=%s intent2=%s position=%d snapPosition=%d", + pendingIntent1.getIntent(), pendingIntent2.getIntent(), splitPosition, + snapPosition); final WindowContainerTransaction wct = new WindowContainerTransaction(); if (pendingIntent2 == null) { options1 = options1 != null ? options1 : new Bundle(); @@ -1302,6 +1328,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } void switchSplitPosition(String reason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "switchSplitPosition"); final SurfaceControl.Transaction t = mTransactionPool.acquire(); mTempRect1.setEmpty(); final StageTaskListener topLeftStage = @@ -1343,7 +1370,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, }); }); - ProtoLog.v(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, "Switch split position: %s", reason); + ProtoLog.v(WM_SHELL_SPLIT_SCREEN, "Switch split position: %s", reason); mLogger.logSwap(getMainStagePosition(), mMainStage.getTopChildTaskUid(), getSideStagePosition(), mSideStage.getTopChildTaskUid(), mSplitLayout.isLeftRightSplit()); @@ -1376,11 +1403,12 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, if (!mMainStage.isActive()) { return; } - + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onKeyguardVisibilityChanged: showing=%b", showing); setDividerVisibility(!mKeyguardShowing, null); } void onFinishedWakingUp() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onFinishedWakingUp"); if (!mMainStage.isActive()) { return; } @@ -1421,6 +1449,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } void exitSplitScreen(int toTopTaskId, @ExitReason int exitReason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "exitSplitScreen: topTaskId=%d reason=%s active=%b", + toTopTaskId, exitReasonToString(exitReason), mMainStage.isActive()); if (!mMainStage.isActive()) return; StageTaskListener childrenToTop = null; @@ -1439,6 +1469,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void exitSplitScreen(@Nullable StageTaskListener childrenToTop, @ExitReason int exitReason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "exitSplitScreen: mainStageToTop=%b reason=%s active=%b", + childrenToTop == mMainStage, exitReasonToString(exitReason), mMainStage.isActive()); if (!mMainStage.isActive()) return; final WindowContainerTransaction wct = new WindowContainerTransaction(); @@ -1447,6 +1479,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void applyExitSplitScreen(@Nullable StageTaskListener childrenToTop, WindowContainerTransaction wct, @ExitReason int exitReason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "applyExitSplitScreen: reason=%s", + exitReasonToString(exitReason)); if (!mMainStage.isActive() || mIsExiting) return; onSplitScreenExit(); @@ -1502,7 +1536,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } }); - Slog.i(TAG, "applyExitSplitScreen, reason = " + exitReasonToString(exitReason)); // Log the exit if (childrenToTop != null) { logExitToStage(exitReason, childrenToTop == mMainStage); @@ -1527,6 +1560,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, * Exits the split screen by finishing one of the tasks. */ protected void exitStage(@SplitPosition int stageToClose) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "exitStage: stageToClose=%d", stageToClose); mSplitLayout.flingDividerToDismiss(stageToClose == SPLIT_POSITION_BOTTOM_OR_RIGHT, EXIT_REASON_APP_FINISHED); } @@ -1540,12 +1574,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, try { activityTaskManagerService.setFocusedTask(getTaskId(stageToFocus)); } catch (RemoteException | NullPointerException e) { - ProtoLog.e(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, + ProtoLog.e(WM_SHELL_SPLIT_SCREEN, "Unable to update focus on the chosen stage: %s", e.getMessage()); } } private void clearRequestIfPresented() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "clearRequestIfPresented"); if (mSideStageListener.mVisible && mSideStageListener.mHasChildren && mMainStageListener.mVisible && mSideStageListener.mHasChildren) { mSplitRequest = null; @@ -1581,6 +1616,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, void clearSplitPairedInRecents(@ExitReason int exitReason) { if (!shouldBreakPairedTaskInRecents(exitReason) || !mShouldUpdateRecents) return; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "clearSplitPairedInRecents: reason=%s", + exitReasonToString(exitReason)); mRecentTasks.ifPresent(recentTasks -> { // Notify recents if we are exiting in a way that breaks the pair, and disable further // updates to splits in the recents until we enter split again @@ -1597,11 +1634,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, void prepareExitSplitScreen(@StageType int stageToTop, @NonNull WindowContainerTransaction wct) { if (!mMainStage.isActive()) return; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "prepareExitSplitScreen: stageToTop=%d", stageToTop); mSideStage.removeAllTasks(wct, stageToTop == STAGE_TYPE_SIDE); mMainStage.deactivate(wct, stageToTop == STAGE_TYPE_MAIN); } private void prepareEnterSplitScreen(WindowContainerTransaction wct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "prepareEnterSplitScreen"); prepareEnterSplitScreen(wct, null /* taskInfo */, SPLIT_POSITION_UNDEFINED, !mIsDropEntering); } @@ -1613,6 +1652,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, void prepareEnterSplitScreen(WindowContainerTransaction wct, @Nullable ActivityManager.RunningTaskInfo taskInfo, @SplitPosition int startPosition, boolean resizeAnim) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "prepareEnterSplitScreen: position=%d resize=%b", + startPosition, resizeAnim); onSplitScreenEnter(); // Preemptively reset the reparenting behavior if we know that we are entering, as starting // split tasks with activity trampolines can inadvertently trigger the task to be @@ -1629,6 +1670,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void prepareBringSplit(WindowContainerTransaction wct, @Nullable ActivityManager.RunningTaskInfo taskInfo, @SplitPosition int startPosition, boolean resizeAnim) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "prepareBringSplit: task=%d isSplitVisible=%b", + taskInfo != null ? taskInfo.taskId : -1, isSplitScreenVisible()); if (taskInfo != null) { wct.startTask(taskInfo.taskId, resolveStartStage(STAGE_TYPE_UNDEFINED, startPosition, null, wct)); @@ -1649,6 +1692,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void prepareActiveSplit(WindowContainerTransaction wct, @Nullable ActivityManager.RunningTaskInfo taskInfo, @SplitPosition int startPosition, boolean resizeAnim) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "prepareActiveSplit: task=%d isSplitVisible=%b", + taskInfo != null ? taskInfo.taskId : -1, isSplitScreenVisible()); if (!ENABLE_SHELL_TRANSITIONS) { // Legacy transition we need to create divider here, shell transition case we will // create it on #finishEnterSplitScreen @@ -1667,6 +1712,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } private void prepareSplitLayout(WindowContainerTransaction wct, boolean resizeAnim) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "prepareSplitLayout: resize=%b", resizeAnim); if (resizeAnim) { mSplitLayout.setDividerAtBorder(mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT); } else { @@ -1686,6 +1732,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } void finishEnterSplitScreen(SurfaceControl.Transaction finishT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "finishEnterSplitScreen"); mSplitLayout.update(finishT, true /* resetImePosition */); mMainStage.getSplitDecorManager().inflate(mContext, mMainStage.mRootLeash, getMainStageBounds()); @@ -1835,12 +1882,20 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, leftTopTaskId, rightBottomTaskId, mSplitLayout.calculateCurrentSnapPosition()); if (mainStageTopTaskId != INVALID_TASK_ID && sideStageTopTaskId != INVALID_TASK_ID) { // Update the pair for the top tasks - recentTasks.addSplitPair(mainStageTopTaskId, sideStageTopTaskId, splitBounds); + boolean added = recentTasks.addSplitPair(mainStageTopTaskId, sideStageTopTaskId, + splitBounds); + if (added) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "updateRecentTasksSplitPair: adding split pair ltTask=%d rbTask=%d", + leftTopTaskId, rightBottomTaskId); + } } }); } private void sendSplitVisibilityChanged() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "sendSplitVisibilityChanged: dividerVisible=%b", + mDividerVisible); for (int i = mListeners.size() - 1; i >= 0; --i) { final SplitScreen.SplitScreenListener l = mListeners.get(i); l.onSplitVisibilityChanged(mDividerVisible); @@ -1855,6 +1910,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, throw new IllegalArgumentException(this + "\n Unknown task appeared: " + taskInfo); } + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskAppeared: task=%s", taskInfo); mRootTaskInfo = taskInfo; mRootTaskLeash = leash; @@ -1880,6 +1936,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, if (mSplitLayout != null && mSplitLayout.updateConfiguration(mRootTaskInfo.configuration) && mMainStage.isActive()) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskInfoChanged: task=%d updating", + taskInfo.taskId); // Clear the divider remote animating flag as the divider will be re-rendered to apply // the new rotation config. Don't reset the IME state since those updates are not in // sync with task info changes. @@ -1892,6 +1950,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override @CallSuper public void onTaskVanished(ActivityManager.RunningTaskInfo taskInfo) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskVanished: task=%s", taskInfo); if (mRootTaskInfo == null) { throw new IllegalArgumentException(this + "\n Unknown task vanished: " + taskInfo); } @@ -1911,6 +1970,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @VisibleForTesting void onRootTaskAppeared() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onRootTaskAppeared: rootTask=%s mainRoot=%b sideRoot=%b", + mRootTaskInfo, mMainStageListener.mHasRootTask, mSideStageListener.mHasRootTask); // Wait unit all root tasks appeared. if (mRootTaskInfo == null || !mMainStageListener.mHasRootTask @@ -1937,6 +1998,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, * #onStageHasChildrenChanged because this would be called every time child task appeared. * NOTICE: This only be called on legacy transition. */ private void onChildTaskAppeared(StageListenerImpl stageListener, int taskId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onChildTaskAppeared: isMainStage=%b task=%d", + stageListener == mMainStageListener, taskId); // Handle entering split screen while there is a split pair running in the background. if (stageListener == mSideStageListener && !isSplitScreenVisible() && isSplitActive() && mSplitRequest == null) { @@ -1960,6 +2023,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } private void onRootTaskVanished() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onRootTaskVanished"); final WindowContainerTransaction wct = new WindowContainerTransaction(); mLaunchAdjacentController.clearLaunchAdjacentRoot(); applyExitSplitScreen(null /* childrenToTop */, wct, EXIT_REASON_ROOT_TASK_VANISHED); @@ -1990,6 +2054,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, return; } + // TODO Protolog + // Check if it needs to dismiss split screen when both stage invisible. if (!mainStageVisible && mExitSplitScreenOnHide) { exitSplitScreen(null /* childrenToTop */, EXIT_REASON_RETURN_HOME); @@ -2020,14 +2086,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, return; } - ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, - "Request to %s divider bar from %s.", - (visible ? "show" : "hide"), Debug.getCaller()); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "setDividerVisibility: visible=%b keyguardShowing=%b dividerAnimating=%b caller=%s", + visible, mKeyguardShowing, mIsDividerRemoteAnimating, Debug.getCaller()); // Defer showing divider bar after keyguard dismissed, so it won't interfere with keyguard // dismissing animation. if (visible && mKeyguardShowing) { - ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, " Defer showing divider bar due to keyguard showing."); return; } @@ -2036,7 +2102,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, sendSplitVisibilityChanged(); if (mIsDividerRemoteAnimating) { - ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, " Skip animating divider bar due to it's remote animating."); return; } @@ -2050,12 +2116,12 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void applyDividerVisibility(@Nullable SurfaceControl.Transaction t) { final SurfaceControl dividerLeash = mSplitLayout.getDividerLeash(); if (dividerLeash == null) { - ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, " Skip animating divider bar due to divider leash not ready."); return; } if (mIsDividerRemoteAnimating) { - ProtoLog.d(ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN, + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, " Skip animating divider bar due to it's remote animating."); return; } @@ -2119,6 +2185,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Callback when split roots have child or haven't under it. * NOTICE: This only be called on legacy transition. */ private void onStageHasChildrenChanged(StageListenerImpl stageListener) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onStageHasChildrenChanged: isMainStage=%b", + stageListener == mMainStageListener); final boolean hasChildren = stageListener.mHasChildren; final boolean isSideStage = stageListener == mSideStageListener; if (!hasChildren && !mIsExiting && mMainStage.isActive()) { @@ -2170,13 +2238,15 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } @Override - public void onSnappedToDismiss(boolean bottomOrRight, int reason) { + public void onSnappedToDismiss(boolean bottomOrRight, @ExitReason int exitReason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onSnappedToDismiss: bottomOrRight=%b reason=%s", + bottomOrRight, exitReasonToString(exitReason)); final boolean mainStageToTop = bottomOrRight ? mSideStagePosition == SPLIT_POSITION_BOTTOM_OR_RIGHT : mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT; final StageTaskListener toTopStage = mainStageToTop ? mMainStage : mSideStage; if (!ENABLE_SHELL_TRANSITIONS) { - exitSplitScreen(toTopStage, reason); + exitSplitScreen(toTopStage, exitReason); return; } @@ -2219,6 +2289,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override public void onLayoutSizeChanged(SplitLayout layout) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onLayoutSizeChanged"); // Reset this flag every time onLayoutSizeChanged. mShowDecorImmediately = false; @@ -2278,8 +2349,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT ? mSideStage : mMainStage; final StageTaskListener bottomRightStage = mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT ? mMainStage : mSideStage; - return layout.applyTaskChanges(wct, topLeftStage.mRootTaskInfo, + boolean updated = layout.applyTaskChanges(wct, topLeftStage.mRootTaskInfo, bottomRightStage.mRootTaskInfo); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "updateWindowBounds: topLeftStage=%s bottomRightStage=%s", + layout.getBounds1(), layout.getBounds2()); + return updated; } void updateSurfaceBounds(@Nullable SplitLayout layout, @NonNull SurfaceControl.Transaction t, @@ -2291,6 +2365,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, (layout != null ? layout : mSplitLayout).applySurfaceChanges(t, topLeftStage.mRootLeash, bottomRightStage.mRootLeash, topLeftStage.mDimLayer, bottomRightStage.mDimLayer, applyResizingOffset); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "updateSurfaceBounds: topLeftStage=%s bottomRightStage=%s", + layout.getBounds1(), layout.getBounds2()); } @Override @@ -2329,6 +2406,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override public void setLayoutOffsetTarget(int offsetX, int offsetY, SplitLayout layout) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "setLayoutOffsetTarget: x=%d y=%d", + offsetX, offsetY); final StageTaskListener topLeftStage = mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT ? mSideStage : mMainStage; final StageTaskListener bottomRightStage = @@ -2343,6 +2422,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, if (displayId != DEFAULT_DISPLAY) { return; } + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onDisplayAdded: display=%d", displayId); mDisplayController.addDisplayChangingController(this::onDisplayChange); } @@ -2357,8 +2437,14 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, private void onDisplayChange(int displayId, int fromRotation, int toRotation, @Nullable DisplayAreaInfo newDisplayAreaInfo, WindowContainerTransaction wct) { - if (displayId != DEFAULT_DISPLAY || !mMainStage.isActive()) return; + if (displayId != DEFAULT_DISPLAY || !mMainStage.isActive()) { + return; + } + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "onDisplayChange: display=%d fromRot=%d toRot=%d config=%s", + displayId, fromRotation, toRotation, + newDisplayAreaInfo != null ? newDisplayAreaInfo.configuration : null); mSplitLayout.rotateTo(toRotation); if (newDisplayAreaInfo != null) { mSplitLayout.updateConfiguration(newDisplayAreaInfo.configuration); @@ -2369,6 +2455,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @VisibleForTesting void onFoldedStateChanged(boolean folded) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onFoldedStateChanged: folded=%b", folded); mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED; if (!folded) return; @@ -2439,6 +2526,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, final ActivityManager.RunningTaskInfo triggerTask = request.getTriggerTask(); if (triggerTask == null) { if (isSplitActive()) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d display rotation", + request.getDebugId()); // Check if the display is rotating. final TransitionRequestInfo.DisplayChange displayChange = request.getDisplayChange(); @@ -2467,6 +2556,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } if (isSplitActive()) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d split active", + request.getDebugId()); // Try to handle everything while in split-screen, so return a WCT even if it's empty. ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " split is active so using split" + "Transition to handle request. triggerTask=%d type=%s mainChildren=%d" @@ -2541,6 +2632,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, return null; } else { if (isOpening && getStageOfTask(triggerTask) != null) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "handleRequest: transition=%d enter split", + request.getDebugId()); // One task is appearing into split, prepare to enter split screen. out = new WindowContainerTransaction(); prepareEnterSplitScreen(out); @@ -2557,6 +2650,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, */ public void addEnterOrExitIfNeeded(@Nullable TransitionRequestInfo request, @NonNull WindowContainerTransaction outWCT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "addEnterOrExitIfNeeded: transition=%d", + request.getDebugId()); final ActivityManager.RunningTaskInfo triggerTask = request.getTriggerTask(); if (triggerTask != null && triggerTask.displayId != mDisplayId) { // Skip handling task on the other display. @@ -2591,6 +2686,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, public void mergeAnimation(IBinder transition, TransitionInfo info, SurfaceControl.Transaction t, IBinder mergeTarget, Transitions.TransitionFinishCallback finishCallback) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "mergeAnimation: transition=%d", info.getDebugId()); mSplitTransitions.mergeAnimation(transition, info, t, mergeTarget, finishCallback); } @@ -2602,6 +2698,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override public void onTransitionConsumed(@NonNull IBinder transition, boolean aborted, @Nullable SurfaceControl.Transaction finishT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTransitionConsumed"); mSplitTransitions.onTransitionConsumed(transition, aborted, finishT); } @@ -2617,6 +2714,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, // If we're not in split-mode, just abort so something else can handle it. if (!mMainStage.isActive()) return false; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "startAnimation: transition=%d", info.getDebugId()); mSplitLayout.setFreezeDividerWindow(false); final StageChangeRecord record = new StageChangeRecord(); final int transitType = info.getType(); @@ -2727,6 +2825,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, if (mMixedHandler.animatePendingSplitWithDisplayChange(transition, info, startTransaction, finishTransaction, finishCallback)) { if (mSplitTransitions.isPendingResize(transition)) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "startAnimation: transition=%d display change", info.getDebugId()); // Only need to update in resize because divider exist before transition. mSplitLayout.update(startTransaction, true /* resetImePosition */); startTransaction.apply(); @@ -2797,6 +2897,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction, @NonNull Transitions.TransitionFinishCallback finishCallback) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "startPendingAnimation: transition=%d", + info.getDebugId()); boolean shouldAnimate = true; if (mSplitTransitions.isPendingEnter(transition)) { shouldAnimate = startPendingEnterAnimation(transition, @@ -2830,6 +2932,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Called to clean-up state and do house-keeping after the animation is done. */ public void onTransitionAnimationComplete() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTransitionAnimationComplete"); // If still playing, let it finish. if (!mMainStage.isActive() && !mIsExiting) { // Update divider state after animation so that it is still around and positioned @@ -2842,6 +2945,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @NonNull SplitScreenTransitions.EnterSession enterTransition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "startPendingEnterAnimation: enterTransition=%s", + enterTransition); // First, verify that we actually have opened apps in both splits. TransitionInfo.Change mainChild = null; TransitionInfo.Change sideChild = null; @@ -2959,6 +3064,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, } public void goToFullscreenFromSplit() { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "goToFullscreenFromSplit"); // If main stage is focused, toEnd = true if // mSideStagePosition = SPLIT_POSITION_BOTTOM_OR_RIGHT. Otherwise toEnd = false // If side stage is focused, toEnd = true if @@ -2974,6 +3080,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Move the specified task to fullscreen, regardless of focus state. */ public void moveTaskToFullscreen(int taskId, int exitReason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "moveTaskToFullscreen"); boolean leftOrTop; if (mMainStage.containsTask(taskId)) { leftOrTop = (mSideStagePosition == SPLIT_POSITION_TOP_OR_LEFT); @@ -2994,6 +3101,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, */ public void onPipExpandToSplit(WindowContainerTransaction wct, ActivityManager.RunningTaskInfo taskInfo) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onPipExpandToSplit: task=%s", taskInfo); prepareEnterSplitScreen(wct, taskInfo, getActivateSplitPosition(taskInfo), false /*resizeAnim*/); @@ -3040,6 +3148,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, public void prepareDismissAnimation(@StageType int toStage, @ExitReason int dismissReason, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "prepareDismissAnimation: transition=%d toStage=%d reason=%s", + info.getDebugId(), toStage, exitReasonToString(dismissReason)); // Make some noise if things aren't totally expected. These states shouldn't effect // transitions locally, but remotes (like Launcher) may get confused if they were // depending on listener callbacks. This can happen because task-organizer callbacks @@ -3126,6 +3237,9 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @NonNull SplitScreenTransitions.DismissSession dismissTransition, @NonNull TransitionInfo info, @NonNull SurfaceControl.Transaction t, @NonNull SurfaceControl.Transaction finishT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "startPendingDismissAnimation: transition=%d dismissTransition=%s", + info.getDebugId(), dismissTransition); prepareDismissAnimation(dismissTransition.mDismissTop, dismissTransition.mReason, info, t, finishT); if (dismissTransition.mDismissTop == STAGE_TYPE_UNDEFINED) { @@ -3146,6 +3260,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Call this when starting the open-recents animation while split-screen is active. */ public void onRecentsInSplitAnimationStart(TransitionInfo info) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onRecentsInSplitAnimationStart: transition=%d", + info.getDebugId()); if (isSplitScreenVisible()) { // Cache tasks on live tile. for (int i = 0; i < info.getChanges().size(); ++i) { @@ -3178,6 +3294,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Call this when the recents animation during split-screen finishes. */ public void onRecentsInSplitAnimationFinish(WindowContainerTransaction finishWct, SurfaceControl.Transaction finishT) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onRecentsInSplitAnimationFinish"); mPausingTasks.clear(); // Check if the recent transition is finished by returning to the current // split, so we can restore the divider bar. @@ -3203,6 +3320,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** Call this when the recents animation finishes by doing pair-to-pair switch. */ public void onRecentsPairToPairAnimationFinish(WindowContainerTransaction finishWct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onRecentsPairToPairAnimationFinish"); // Pair-to-pair switch happened so here should evict the live tile from its stage. // Otherwise, the task will remain in stage, and occluding the new task when next time // user entering recents. @@ -3284,6 +3402,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, * handled. */ private void setSplitsVisible(boolean visible) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "setSplitsVisible: visible=%b", visible); mMainStageListener.mVisible = mSideStageListener.mVisible = visible; mMainStageListener.mHasChildren = mSideStageListener.mHasChildren = visible; } @@ -3292,6 +3411,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, * Sets drag info to be logged when splitscreen is next entered. */ public void onDroppedToSplit(@SplitPosition int position, InstanceId dragSessionId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onDroppedToSplit: position=%d", position); if (!isSplitScreenVisible()) { mIsDropEntering = true; mSkipEvictingMainStageChildren = true; @@ -3308,7 +3428,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, /** * Sets info to be logged when splitscreen is next entered. */ - public void onRequestToSplit(InstanceId sessionId, int enterReason) { + public void onRequestToSplit(InstanceId sessionId, @SplitEnterReason int enterReason) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onRequestToSplit: reason=%d", enterReason); if (!isSplitScreenVisible() && !ENABLE_SHELL_TRANSITIONS) { // If split running background, exit split first. // Skip this on shell transition due to we could evict existing tasks on transition @@ -3384,6 +3505,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler, @Override public void onNoLongerSupportMultiWindow(ActivityManager.RunningTaskInfo taskInfo) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onNoLongerSupportMultiWindow: task=%s", taskInfo); if (mMainStage.isActive()) { final boolean isMainStage = mMainStageListener == this; if (!ENABLE_SHELL_TRANSITIONS) { diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java index af7bf360f036..f33ab33dafcc 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageTaskListener.java @@ -25,6 +25,7 @@ import static android.view.RemoteAnimationTarget.MODE_OPENING; import static com.android.wm.shell.common.split.SplitScreenConstants.CONTROLLED_ACTIVITY_TYPES; import static com.android.wm.shell.common.split.SplitScreenConstants.CONTROLLED_WINDOWING_MODES; import static com.android.wm.shell.common.split.SplitScreenConstants.CONTROLLED_WINDOWING_MODES_WHEN_ACTIVE; +import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_SPLIT_SCREEN; import static com.android.wm.shell.transition.Transitions.ENABLE_SHELL_TRANSITIONS; import android.annotation.CallSuper; @@ -44,6 +45,7 @@ import android.window.WindowContainerTransaction; import androidx.annotation.NonNull; +import com.android.internal.protolog.common.ProtoLog; import com.android.internal.util.ArrayUtils; import com.android.launcher3.icons.IconProvider; import com.android.wm.shell.ShellTaskOrganizer; @@ -175,6 +177,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { @Override @CallSuper public void onTaskAppeared(ActivityManager.RunningTaskInfo taskInfo, SurfaceControl leash) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskAppeared: task=%d taskParent=%d rootTask=%d", + taskInfo.taskId, taskInfo.parentTaskId, + mRootTaskInfo != null ? mRootTaskInfo.taskId : -1); if (mRootTaskInfo == null) { mRootLeash = leash; mRootTaskInfo = taskInfo; @@ -225,6 +230,9 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { || !ArrayUtils.contains(CONTROLLED_ACTIVITY_TYPES, taskInfo.getActivityType()) || !ArrayUtils.contains(CONTROLLED_WINDOWING_MODES_WHEN_ACTIVE, taskInfo.getWindowingMode())) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, + "onTaskInfoChanged: task=%d no longer supports multiwindow", + taskInfo.taskId); // Leave split screen if the task no longer supports multi window or have // uncontrolled task. mCallbacks.onNoLongerSupportMultiWindow(taskInfo); @@ -251,6 +259,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { @Override @CallSuper public void onTaskVanished(ActivityManager.RunningTaskInfo taskInfo) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "onTaskVanished: task=%d", taskInfo.taskId); final int taskId = taskInfo.taskId; if (mRootTaskInfo.taskId == taskId) { mCallbacks.onRootTaskVanished(); @@ -333,6 +342,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { } void addTask(ActivityManager.RunningTaskInfo task, WindowContainerTransaction wct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "addTask: task=%d", task.taskId); // Clear overridden bounds and windowing mode to make sure the child task can inherit // windowing mode and bounds from split root. wct.setWindowingMode(task.token, WINDOWING_MODE_UNDEFINED) @@ -342,6 +352,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { } void reorderChild(int taskId, boolean onTop, WindowContainerTransaction wct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "reorderChild: task=%d onTop=%b", taskId, onTop); if (!containsTask(taskId)) { return; } @@ -357,6 +368,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { /** Collects all the current child tasks and prepares transaction to evict them to display. */ void evictAllChildren(WindowContainerTransaction wct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "Evicting all children"); for (int i = mChildrenTaskInfo.size() - 1; i >= 0; i--) { final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.valueAt(i); wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); @@ -367,11 +379,13 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { for (int i = mChildrenTaskInfo.size() - 1; i >= 0; i--) { final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.valueAt(i); if (taskId == taskInfo.taskId) continue; + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "Evict other child: task=%d", taskId); wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); } } void evictNonOpeningChildren(RemoteAnimationTarget[] apps, WindowContainerTransaction wct) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "evictNonOpeningChildren"); final SparseArray<ActivityManager.RunningTaskInfo> toBeEvict = mChildrenTaskInfo.clone(); for (int i = 0; i < apps.length; i++) { if (apps[i].mode == MODE_OPENING) { @@ -380,6 +394,7 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { } for (int i = toBeEvict.size() - 1; i >= 0; i--) { final ActivityManager.RunningTaskInfo taskInfo = toBeEvict.valueAt(i); + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "Evict non-opening child: task=%d", taskInfo.taskId); wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); } } @@ -388,12 +403,15 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener { for (int i = mChildrenTaskInfo.size() - 1; i >= 0; i--) { final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.valueAt(i); if (!taskInfo.isVisible) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "Evict invisible child: task=%d", + taskInfo.taskId); wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); } } } void evictChildren(WindowContainerTransaction wct, int taskId) { + ProtoLog.d(WM_SHELL_SPLIT_SCREEN, "Evict child: task=%d", taskId); final ActivityManager.RunningTaskInfo taskInfo = mChildrenTaskInfo.get(taskId); if (taskInfo != null) { wct.reparent(taskInfo.token, null /* parent */, false /* onTop */); |