Merge "Do not dismiss split if stages are not visible due to screen is sleeping" into sc-v2-dev am: c200310e02

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14613435

Change-Id: Ib587f4c4a9d01fdc25d8cf2e152a6c57e7b3b243
This commit is contained in:
Jerry Chang
2021-05-25 12:23:11 +00:00
committed by Automerger Merge Worker
3 changed files with 20 additions and 6 deletions

View File

@@ -239,6 +239,12 @@ public class TaskInfo {
*/ */
public boolean isVisible; public boolean isVisible;
/**
* Whether this task is sleeping due to sleeping display.
* @hide
*/
public boolean isSleeping;
TaskInfo() { TaskInfo() {
// Do nothing // Do nothing
} }
@@ -342,7 +348,8 @@ public class TaskInfo {
&& getWindowingMode() == that.getWindowingMode() && getWindowingMode() == that.getWindowingMode()
&& Objects.equals(taskDescription, that.taskDescription) && Objects.equals(taskDescription, that.taskDescription)
&& isFocused == that.isFocused && isFocused == that.isFocused
&& isVisible == that.isVisible; && isVisible == that.isVisible
&& isSleeping == that.isSleeping;
} }
/** /**
@@ -396,6 +403,7 @@ public class TaskInfo {
parentTaskId = source.readInt(); parentTaskId = source.readInt();
isFocused = source.readBoolean(); isFocused = source.readBoolean();
isVisible = source.readBoolean(); isVisible = source.readBoolean();
isSleeping = source.readBoolean();
topActivityToken = source.readStrongBinder(); topActivityToken = source.readStrongBinder();
topActivityInSizeCompat = source.readBoolean(); topActivityInSizeCompat = source.readBoolean();
mTopActivityLocusId = source.readTypedObject(LocusId.CREATOR); mTopActivityLocusId = source.readTypedObject(LocusId.CREATOR);
@@ -434,6 +442,7 @@ public class TaskInfo {
dest.writeInt(parentTaskId); dest.writeInt(parentTaskId);
dest.writeBoolean(isFocused); dest.writeBoolean(isFocused);
dest.writeBoolean(isVisible); dest.writeBoolean(isVisible);
dest.writeBoolean(isSleeping);
dest.writeStrongBinder(topActivityToken); dest.writeStrongBinder(topActivityToken);
dest.writeBoolean(topActivityInSizeCompat); dest.writeBoolean(topActivityInSizeCompat);
dest.writeTypedObject(mTopActivityLocusId, flags); dest.writeTypedObject(mTopActivityLocusId, flags);
@@ -462,6 +471,7 @@ public class TaskInfo {
+ " parentTaskId=" + parentTaskId + " parentTaskId=" + parentTaskId
+ " isFocused=" + isFocused + " isFocused=" + isFocused
+ " isVisible=" + isVisible + " isVisible=" + isVisible
+ " isSleeping=" + isSleeping
+ " topActivityToken=" + topActivityToken + " topActivityToken=" + topActivityToken
+ " topActivityInSizeCompat=" + topActivityInSizeCompat + " topActivityInSizeCompat=" + topActivityInSizeCompat
+ " locusId= " + mTopActivityLocusId + " locusId= " + mTopActivityLocusId

View File

@@ -116,7 +116,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private final List<SplitScreen.SplitScreenListener> mListeners = new ArrayList<>(); private final List<SplitScreen.SplitScreenListener> mListeners = new ArrayList<>();
private final DisplayImeController mDisplayImeController; private final DisplayImeController mDisplayImeController;
private final SplitScreenTransitions mSplitTransitions; private final SplitScreenTransitions mSplitTransitions;
private boolean mExitSplitScreenOnHide = true; private boolean mExitSplitScreenOnHide;
private boolean mKeyguardOccluded; private boolean mKeyguardOccluded;
// TODO(b/187041611): remove this flag after totally deprecated legacy split // 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 // Divider is only visible if both the main stage and side stages are visible
setDividerVisibility(isSplitScreenVisible()); setDividerVisibility(isSplitScreenVisible());
if (mExitSplitScreenOnHide && !mainStageVisible && !sideStageVisible) { if (!mainStageVisible && !sideStageVisible) {
// Exit split-screen if both stage are not visible. if (mExitSplitScreenOnHide
// TODO: This is only a temporary request from UX and is likely to be removed soon... // 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(); exitSplitScreen();
}
} else if (mKeyguardOccluded) { } else if (mKeyguardOccluded) {
// At least one of the stages is visible while keyguard occluded. Dismiss split because // 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 // there's show-when-locked activity showing on top of keyguard. Also make sure the

View File

@@ -4136,6 +4136,7 @@ class Task extends WindowContainer<WindowContainer> {
: INVALID_TASK_ID; : INVALID_TASK_ID;
info.isFocused = isFocused(); info.isFocused = isFocused();
info.isVisible = hasVisibleChildren(); info.isVisible = hasVisibleChildren();
info.isSleeping = shouldSleepActivities();
ActivityRecord topRecord = getTopNonFinishingActivity(); ActivityRecord topRecord = getTopNonFinishingActivity();
info.mTopActivityLocusId = topRecord != null ? topRecord.getLocusId() : null; info.mTopActivityLocusId = topRecord != null ? topRecord.getLocusId() : null;
} }