Do not dismiss split if stages are not visible due to screen is sleeping
Pass isSleeping information in TaskInfo to determine whether the task is sleeping due to display state. Prevent to dismiss staged split when both stages is not visible due to the display is sleeping, like keyguard showing or screen off. Bug: 188010345 Test: atest WMShellUnitTests Test: verified staged split won't be dismissed while keyguard showing and screen off. Change-Id: I0ee8943b035a9e9f937c22d2a228913e597ac79f
This commit is contained in:
@@ -239,6 +239,12 @@ public class TaskInfo {
|
||||
*/
|
||||
public boolean isVisible;
|
||||
|
||||
/**
|
||||
* Whether this task is sleeping due to sleeping display.
|
||||
* @hide
|
||||
*/
|
||||
public boolean isSleeping;
|
||||
|
||||
TaskInfo() {
|
||||
// Do nothing
|
||||
}
|
||||
@@ -342,7 +348,8 @@ public class TaskInfo {
|
||||
&& getWindowingMode() == that.getWindowingMode()
|
||||
&& Objects.equals(taskDescription, that.taskDescription)
|
||||
&& isFocused == that.isFocused
|
||||
&& isVisible == that.isVisible;
|
||||
&& isVisible == that.isVisible
|
||||
&& isSleeping == that.isSleeping;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -396,6 +403,7 @@ public class TaskInfo {
|
||||
parentTaskId = source.readInt();
|
||||
isFocused = source.readBoolean();
|
||||
isVisible = source.readBoolean();
|
||||
isSleeping = source.readBoolean();
|
||||
topActivityToken = source.readStrongBinder();
|
||||
topActivityInSizeCompat = source.readBoolean();
|
||||
mTopActivityLocusId = source.readTypedObject(LocusId.CREATOR);
|
||||
@@ -434,6 +442,7 @@ public class TaskInfo {
|
||||
dest.writeInt(parentTaskId);
|
||||
dest.writeBoolean(isFocused);
|
||||
dest.writeBoolean(isVisible);
|
||||
dest.writeBoolean(isSleeping);
|
||||
dest.writeStrongBinder(topActivityToken);
|
||||
dest.writeBoolean(topActivityInSizeCompat);
|
||||
dest.writeTypedObject(mTopActivityLocusId, flags);
|
||||
@@ -462,6 +471,7 @@ public class TaskInfo {
|
||||
+ " parentTaskId=" + parentTaskId
|
||||
+ " isFocused=" + isFocused
|
||||
+ " isVisible=" + isVisible
|
||||
+ " isSleeping=" + isSleeping
|
||||
+ " topActivityToken=" + topActivityToken
|
||||
+ " topActivityInSizeCompat=" + topActivityInSizeCompat
|
||||
+ " locusId= " + mTopActivityLocusId
|
||||
|
||||
@@ -116,7 +116,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
private final List<SplitScreen.SplitScreenListener> mListeners = new ArrayList<>();
|
||||
private final DisplayImeController mDisplayImeController;
|
||||
private final SplitScreenTransitions mSplitTransitions;
|
||||
private boolean mExitSplitScreenOnHide = true;
|
||||
private boolean mExitSplitScreenOnHide;
|
||||
private boolean mKeyguardOccluded;
|
||||
|
||||
// TODO(b/187041611): remove this flag after totally deprecated legacy split
|
||||
@@ -415,10 +415,13 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
// Divider is only visible if both the main stage and side stages are visible
|
||||
setDividerVisibility(isSplitScreenVisible());
|
||||
|
||||
if (mExitSplitScreenOnHide && !mainStageVisible && !sideStageVisible) {
|
||||
// Exit split-screen if both stage are not visible.
|
||||
// TODO: This is only a temporary request from UX and is likely to be removed soon...
|
||||
exitSplitScreen();
|
||||
if (!mainStageVisible && !sideStageVisible) {
|
||||
if (mExitSplitScreenOnHide
|
||||
// Don't dismiss staged split when both stages are not visible due to sleeping display,
|
||||
// like the cases keyguard showing or screen off.
|
||||
|| (!mMainStage.mRootTaskInfo.isSleeping && !mSideStage.mRootTaskInfo.isSleeping)) {
|
||||
exitSplitScreen();
|
||||
}
|
||||
} else if (mKeyguardOccluded) {
|
||||
// At least one of the stages is visible while keyguard occluded. Dismiss split because
|
||||
// there's show-when-locked activity showing on top of keyguard. Also make sure the
|
||||
|
||||
@@ -4136,6 +4136,7 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
: INVALID_TASK_ID;
|
||||
info.isFocused = isFocused();
|
||||
info.isVisible = hasVisibleChildren();
|
||||
info.isSleeping = shouldSleepActivities();
|
||||
ActivityRecord topRecord = getTopNonFinishingActivity();
|
||||
info.mTopActivityLocusId = topRecord != null ? topRecord.getLocusId() : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user