Merge "Add exit log for debugging auto dismissing bug" into sc-v2-dev am: 5dbf72509d am: 7432714905
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/16180812 Change-Id: I3552610f3a66c82c234ed02bbdee7415976719a8
This commit is contained in:
@@ -30,7 +30,10 @@ import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED_
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__DEVICE_FOLDED;
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__DRAG_DIVIDER;
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__RETURN_HOME;
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__ROOT_TASK_VANISHED;
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__SCREEN_LOCKED;
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__SCREEN_LOCKED_SHOW_ON_TOP;
|
||||
import static com.android.internal.util.FrameworkStatsLog.SPLITSCREEN_UICHANGED__EXIT_REASON__UNKNOWN_EXIT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_BOTTOM_OR_RIGHT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_TOP_OR_LEFT;
|
||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_UNDEFINED;
|
||||
@@ -528,6 +531,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
}
|
||||
|
||||
void exitSplitScreen(int toTopTaskId, int exitReason) {
|
||||
if (!mMainStage.isActive()) return;
|
||||
|
||||
StageTaskListener childrenToTop = null;
|
||||
if (mMainStage.containsTask(toTopTaskId)) {
|
||||
childrenToTop = mMainStage;
|
||||
@@ -543,6 +548,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
}
|
||||
|
||||
private void exitSplitScreen(StageTaskListener childrenToTop, int exitReason) {
|
||||
if (!mMainStage.isActive()) return;
|
||||
|
||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||
applyExitSplitScreen(childrenToTop, wct, exitReason);
|
||||
}
|
||||
@@ -559,6 +566,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
setDividerVisibility(false);
|
||||
mSplitLayout.resetDividerPosition();
|
||||
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
|
||||
Slog.i(TAG, "applyExitSplitScreen, reason = " + exitReasonToString(exitReason));
|
||||
if (childrenToTop != null) {
|
||||
logExitToStage(exitReason, childrenToTop == mMainStage);
|
||||
} else {
|
||||
@@ -1274,6 +1282,31 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
mSplitLayout.isLandscape());
|
||||
}
|
||||
|
||||
private String exitReasonToString(int exitReason) {
|
||||
switch (exitReason) {
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__UNKNOWN_EXIT:
|
||||
return "UNKNOWN_EXIT";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__DRAG_DIVIDER:
|
||||
return "DRAG_DIVIDER";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__RETURN_HOME:
|
||||
return "RETURN_HOME";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__SCREEN_LOCKED:
|
||||
return "SCREEN_LOCKED";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__SCREEN_LOCKED_SHOW_ON_TOP:
|
||||
return "SCREEN_LOCKED_SHOW_ON_TOP";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__DEVICE_FOLDED:
|
||||
return "DEVICE_FOLDED";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__ROOT_TASK_VANISHED:
|
||||
return "ROOT_TASK_VANISHED";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__APP_FINISHED:
|
||||
return "APP_FINISHED";
|
||||
case SPLITSCREEN_UICHANGED__EXIT_REASON__APP_DOES_NOT_SUPPORT_MULTIWINDOW:
|
||||
return "APP_DOES_NOT_SUPPORT_MULTIWINDOW";
|
||||
default:
|
||||
return "unknown reason, reason int = " + exitReason;
|
||||
}
|
||||
}
|
||||
|
||||
class StageListenerImpl implements StageTaskListener.StageListenerCallbacks {
|
||||
boolean mHasRootTask = false;
|
||||
boolean mVisible = false;
|
||||
|
||||
@@ -161,6 +161,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
||||
|
||||
@Test
|
||||
public void testExitSplitScreen() {
|
||||
when(mMainStage.isActive()).thenReturn(true);
|
||||
mStageCoordinator.exitSplitScreen(INVALID_TASK_ID,
|
||||
SPLITSCREEN_UICHANGED__EXIT_REASON__RETURN_HOME);
|
||||
verify(mSideStage).removeAllTasks(any(WindowContainerTransaction.class), eq(false));
|
||||
@@ -169,6 +170,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
||||
|
||||
@Test
|
||||
public void testExitSplitScreenToMainStage() {
|
||||
when(mMainStage.isActive()).thenReturn(true);
|
||||
final int testTaskId = 12345;
|
||||
when(mMainStage.containsTask(eq(testTaskId))).thenReturn(true);
|
||||
when(mSideStage.containsTask(eq(testTaskId))).thenReturn(false);
|
||||
@@ -182,6 +184,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
||||
|
||||
@Test
|
||||
public void testExitSplitScreenToSideStage() {
|
||||
when(mMainStage.isActive()).thenReturn(true);
|
||||
final int testTaskId = 12345;
|
||||
when(mMainStage.containsTask(eq(testTaskId))).thenReturn(false);
|
||||
when(mSideStage.containsTask(eq(testTaskId))).thenReturn(true);
|
||||
|
||||
Reference in New Issue
Block a user