Merge "Add exit log for debugging auto dismissing bug" into sc-v2-dev
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__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__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__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__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_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_TOP_OR_LEFT;
|
||||||
import static com.android.wm.shell.common.split.SplitLayout.SPLIT_POSITION_UNDEFINED;
|
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) {
|
void exitSplitScreen(int toTopTaskId, int exitReason) {
|
||||||
|
if (!mMainStage.isActive()) return;
|
||||||
|
|
||||||
StageTaskListener childrenToTop = null;
|
StageTaskListener childrenToTop = null;
|
||||||
if (mMainStage.containsTask(toTopTaskId)) {
|
if (mMainStage.containsTask(toTopTaskId)) {
|
||||||
childrenToTop = mMainStage;
|
childrenToTop = mMainStage;
|
||||||
@@ -543,6 +548,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void exitSplitScreen(StageTaskListener childrenToTop, int exitReason) {
|
private void exitSplitScreen(StageTaskListener childrenToTop, int exitReason) {
|
||||||
|
if (!mMainStage.isActive()) return;
|
||||||
|
|
||||||
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
final WindowContainerTransaction wct = new WindowContainerTransaction();
|
||||||
applyExitSplitScreen(childrenToTop, wct, exitReason);
|
applyExitSplitScreen(childrenToTop, wct, exitReason);
|
||||||
}
|
}
|
||||||
@@ -559,6 +566,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
setDividerVisibility(false);
|
setDividerVisibility(false);
|
||||||
mSplitLayout.resetDividerPosition();
|
mSplitLayout.resetDividerPosition();
|
||||||
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
|
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
|
||||||
|
Slog.i(TAG, "applyExitSplitScreen, reason = " + exitReasonToString(exitReason));
|
||||||
if (childrenToTop != null) {
|
if (childrenToTop != null) {
|
||||||
logExitToStage(exitReason, childrenToTop == mMainStage);
|
logExitToStage(exitReason, childrenToTop == mMainStage);
|
||||||
} else {
|
} else {
|
||||||
@@ -1274,6 +1282,31 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
mSplitLayout.isLandscape());
|
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 {
|
class StageListenerImpl implements StageTaskListener.StageListenerCallbacks {
|
||||||
boolean mHasRootTask = false;
|
boolean mHasRootTask = false;
|
||||||
boolean mVisible = false;
|
boolean mVisible = false;
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExitSplitScreen() {
|
public void testExitSplitScreen() {
|
||||||
|
when(mMainStage.isActive()).thenReturn(true);
|
||||||
mStageCoordinator.exitSplitScreen(INVALID_TASK_ID,
|
mStageCoordinator.exitSplitScreen(INVALID_TASK_ID,
|
||||||
SPLITSCREEN_UICHANGED__EXIT_REASON__RETURN_HOME);
|
SPLITSCREEN_UICHANGED__EXIT_REASON__RETURN_HOME);
|
||||||
verify(mSideStage).removeAllTasks(any(WindowContainerTransaction.class), eq(false));
|
verify(mSideStage).removeAllTasks(any(WindowContainerTransaction.class), eq(false));
|
||||||
@@ -169,6 +170,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExitSplitScreenToMainStage() {
|
public void testExitSplitScreenToMainStage() {
|
||||||
|
when(mMainStage.isActive()).thenReturn(true);
|
||||||
final int testTaskId = 12345;
|
final int testTaskId = 12345;
|
||||||
when(mMainStage.containsTask(eq(testTaskId))).thenReturn(true);
|
when(mMainStage.containsTask(eq(testTaskId))).thenReturn(true);
|
||||||
when(mSideStage.containsTask(eq(testTaskId))).thenReturn(false);
|
when(mSideStage.containsTask(eq(testTaskId))).thenReturn(false);
|
||||||
@@ -182,6 +184,7 @@ public class StageCoordinatorTests extends ShellTestCase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExitSplitScreenToSideStage() {
|
public void testExitSplitScreenToSideStage() {
|
||||||
|
when(mMainStage.isActive()).thenReturn(true);
|
||||||
final int testTaskId = 12345;
|
final int testTaskId = 12345;
|
||||||
when(mMainStage.containsTask(eq(testTaskId))).thenReturn(false);
|
when(mMainStage.containsTask(eq(testTaskId))).thenReturn(false);
|
||||||
when(mSideStage.containsTask(eq(testTaskId))).thenReturn(true);
|
when(mSideStage.containsTask(eq(testTaskId))).thenReturn(true);
|
||||||
|
|||||||
Reference in New Issue
Block a user