Merge "Dismiss stage split when unlock after folded" into sc-v2-dev am: 3c4e9ed3b8
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15371910 Change-Id: Ib8ad17a64341043c5f6618138a92a8dad53db46a
This commit is contained in:
@@ -81,6 +81,12 @@ public interface SplitScreen {
|
||||
*/
|
||||
void onKeyguardOccludedChanged(boolean occluded);
|
||||
|
||||
/**
|
||||
* Called when the visibility of the keyguard changes.
|
||||
* @param showing Indicates if the keyguard is now visible.
|
||||
*/
|
||||
void onKeyguardVisibilityChanged(boolean showing);
|
||||
|
||||
/** Get a string representation of a stage type */
|
||||
static String stageTypeToString(@StageType int stage) {
|
||||
switch (stage) {
|
||||
|
||||
@@ -172,6 +172,10 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
mStageCoordinator.onKeyguardOccludedChanged(occluded);
|
||||
}
|
||||
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
mStageCoordinator.onKeyguardVisibilityChanged(showing);
|
||||
}
|
||||
|
||||
public void exitSplitScreenOnHide(boolean exitSplitScreenOnHide) {
|
||||
mStageCoordinator.exitSplitScreenOnHide(exitSplitScreenOnHide);
|
||||
}
|
||||
@@ -371,6 +375,13 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
mMainExecutor.execute(() -> {
|
||||
SplitScreenController.this.onKeyguardVisibilityChanged(showing);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -136,7 +136,10 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
/** Whether the device is supporting legacy split or not. */
|
||||
private boolean mUseLegacySplit;
|
||||
|
||||
@SplitScreen.StageType int mDismissTop = NO_DISMISS;
|
||||
@SplitScreen.StageType private int mDismissTop = NO_DISMISS;
|
||||
|
||||
/** The target stage to dismiss to when unlock after folded. */
|
||||
@SplitScreen.StageType private int mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
|
||||
|
||||
private final Runnable mOnTransitionAnimationComplete = () -> {
|
||||
// If still playing, let it finish.
|
||||
@@ -443,6 +446,13 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
mKeyguardOccluded = occluded;
|
||||
}
|
||||
|
||||
void onKeyguardVisibilityChanged(boolean showing) {
|
||||
if (!showing && mMainStage.isActive()
|
||||
&& mTopStageAfterFoldDismiss != STAGE_TYPE_UNDEFINED) {
|
||||
exitSplitScreen(mTopStageAfterFoldDismiss == STAGE_TYPE_MAIN ? mMainStage : mSideStage);
|
||||
}
|
||||
}
|
||||
|
||||
void exitSplitScreen() {
|
||||
exitSplitScreen(null /* childrenToTop */);
|
||||
}
|
||||
@@ -458,6 +468,7 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
mTaskOrganizer.applyTransaction(wct);
|
||||
// Reset divider position.
|
||||
mSplitLayout.resetDividerPosition();
|
||||
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -808,8 +819,13 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
}
|
||||
|
||||
private void onFoldedStateChanged(boolean folded) {
|
||||
if (folded && mMainStage.isActive()) {
|
||||
exitSplitScreen(mMainStage);
|
||||
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
|
||||
if (!folded) return;
|
||||
|
||||
if (mMainStage.isFocused()) {
|
||||
mTopStageAfterFoldDismiss = STAGE_TYPE_MAIN;
|
||||
} else if (mSideStage.isFocused()) {
|
||||
mTopStageAfterFoldDismiss = STAGE_TYPE_SIDE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,6 +97,15 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
|
||||
return mChildrenTaskInfo.contains(taskId);
|
||||
}
|
||||
|
||||
/** @return {@code true} if this listener contains the currently focused task. */
|
||||
boolean isFocused() {
|
||||
if (mRootTaskInfo.isFocused) return true;
|
||||
for (int i = mChildrenTaskInfo.size() - 1; i >= 0; --i) {
|
||||
if (mChildrenTaskInfo.valueAt(i).isFocused) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@CallSuper
|
||||
public void onTaskAppeared(ActivityManager.RunningTaskInfo taskInfo, SurfaceControl leash) {
|
||||
|
||||
@@ -241,6 +241,11 @@ public final class WMShell extends SystemUI
|
||||
@VisibleForTesting
|
||||
void initSplitScreen(SplitScreen splitScreen) {
|
||||
mSplitScreenKeyguardCallback = new KeyguardUpdateMonitorCallback() {
|
||||
@Override
|
||||
public void onKeyguardVisibilityChanged(boolean showing) {
|
||||
splitScreen.onKeyguardVisibilityChanged(showing);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeyguardOccludedChanged(boolean occluded) {
|
||||
splitScreen.onKeyguardOccludedChanged(occluded);
|
||||
|
||||
Reference in New Issue
Block a user