Merge "Fix support for split-screen w/ non-resizable home" into rvc-dev am: a9233b0aab
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11897517 Change-Id: I39f0cc51ab8dbe59187d82be954e6032454cf193
This commit is contained in:
@@ -104,17 +104,18 @@ public class DividerSnapAlgorithm {
|
|||||||
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
|
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
|
||||||
boolean isHorizontalDivision, Rect insets) {
|
boolean isHorizontalDivision, Rect insets) {
|
||||||
this(res, displayWidth, displayHeight, dividerSize, isHorizontalDivision, insets,
|
this(res, displayWidth, displayHeight, dividerSize, isHorizontalDivision, insets,
|
||||||
DOCKED_INVALID, false);
|
DOCKED_INVALID, false /* minimized */, true /* resizable */);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
|
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
|
||||||
boolean isHorizontalDivision, Rect insets, int dockSide) {
|
boolean isHorizontalDivision, Rect insets, int dockSide) {
|
||||||
this(res, displayWidth, displayHeight, dividerSize, isHorizontalDivision, insets,
|
this(res, displayWidth, displayHeight, dividerSize, isHorizontalDivision, insets,
|
||||||
dockSide, false);
|
dockSide, false /* minimized */, true /* resizable */);
|
||||||
}
|
}
|
||||||
|
|
||||||
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
|
public DividerSnapAlgorithm(Resources res, int displayWidth, int displayHeight, int dividerSize,
|
||||||
boolean isHorizontalDivision, Rect insets, int dockSide, boolean isMinimizedMode) {
|
boolean isHorizontalDivision, Rect insets, int dockSide, boolean isMinimizedMode,
|
||||||
|
boolean isHomeResizable) {
|
||||||
mMinFlingVelocityPxPerSecond =
|
mMinFlingVelocityPxPerSecond =
|
||||||
MIN_FLING_VELOCITY_DP_PER_SECOND * res.getDisplayMetrics().density;
|
MIN_FLING_VELOCITY_DP_PER_SECOND * res.getDisplayMetrics().density;
|
||||||
mMinDismissVelocityPxPerSecond =
|
mMinDismissVelocityPxPerSecond =
|
||||||
@@ -132,8 +133,8 @@ public class DividerSnapAlgorithm {
|
|||||||
com.android.internal.R.fraction.docked_stack_divider_fixed_ratio, 1, 1);
|
com.android.internal.R.fraction.docked_stack_divider_fixed_ratio, 1, 1);
|
||||||
mMinimalSizeResizableTask = res.getDimensionPixelSize(
|
mMinimalSizeResizableTask = res.getDimensionPixelSize(
|
||||||
com.android.internal.R.dimen.default_minimal_size_resizable_task);
|
com.android.internal.R.dimen.default_minimal_size_resizable_task);
|
||||||
mTaskHeightInMinimizedMode = res.getDimensionPixelSize(
|
mTaskHeightInMinimizedMode = isHomeResizable ? res.getDimensionPixelSize(
|
||||||
com.android.internal.R.dimen.task_height_of_minimized_mode);
|
com.android.internal.R.dimen.task_height_of_minimized_mode) : 0;
|
||||||
calculateTargets(isHorizontalDivision, dockSide);
|
calculateTargets(isHorizontalDivision, dockSide);
|
||||||
mFirstSplitTarget = mTargets.get(1);
|
mFirstSplitTarget = mTargets.get(1);
|
||||||
mLastSplitTarget = mTargets.get(mTargets.size() - 2);
|
mLastSplitTarget = mTargets.get(mTargets.size() - 2);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
|
|||||||
snap.calculateNonDismissingSnapTarget(position);
|
snap.calculateNonDismissingSnapTarget(position);
|
||||||
sdl.resizeSplits(target.position, t);
|
sdl.resizeSplits(target.position, t);
|
||||||
|
|
||||||
if (isSplitActive()) {
|
if (isSplitActive() && mHomeStackResizable) {
|
||||||
WindowManagerProxy.applyHomeTasksMinimized(sdl, mSplits.mSecondary.token, t);
|
WindowManagerProxy.applyHomeTasksMinimized(sdl, mSplits.mSecondary.token, t);
|
||||||
}
|
}
|
||||||
if (mWindowManagerProxy.queueSyncTransactionIfWaiting(t)) {
|
if (mWindowManagerProxy.queueSyncTransactionIfWaiting(t)) {
|
||||||
@@ -428,7 +428,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void updateTouchable() {
|
private void updateTouchable() {
|
||||||
mWindowManager.setTouchable((mHomeStackResizable || !mMinimized) && !mAdjustedForIme);
|
mWindowManager.setTouchable(!mAdjustedForIme);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -523,7 +523,7 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ensureMinimizedSplit() {
|
void ensureMinimizedSplit() {
|
||||||
setHomeMinimized(true /* minimized */, mSplits.mSecondary.isResizeable);
|
setHomeMinimized(true /* minimized */, mHomeStackResizable);
|
||||||
if (!isDividerVisible()) {
|
if (!isDividerVisible()) {
|
||||||
// Wasn't in split-mode yet, so enter now.
|
// Wasn't in split-mode yet, so enter now.
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
|||||||
@@ -320,8 +320,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
super.onAttachedToWindow();
|
super.onAttachedToWindow();
|
||||||
|
|
||||||
// Save the current target if not minimized once attached to window
|
// Save the current target if not minimized once attached to window
|
||||||
if (mHomeStackResizable && mDockSide != WindowManager.DOCKED_INVALID
|
if (mDockSide != WindowManager.DOCKED_INVALID && !mIsInMinimizeInteraction) {
|
||||||
&& !mIsInMinimizeInteraction) {
|
|
||||||
saveSnapTargetBeforeMinimized(mSnapTargetBeforeMinimized);
|
saveSnapTargetBeforeMinimized(mSnapTargetBeforeMinimized);
|
||||||
}
|
}
|
||||||
mFirstLayout = true;
|
mFirstLayout = true;
|
||||||
@@ -470,8 +469,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DividerSnapAlgorithm getSnapAlgorithm() {
|
public DividerSnapAlgorithm getSnapAlgorithm() {
|
||||||
return mDockedStackMinimized
|
return mDockedStackMinimized ? mSplitLayout.getMinimizedSnapAlgorithm(mHomeStackResizable)
|
||||||
&& mHomeStackResizable ? mSplitLayout.getMinimizedSnapAlgorithm()
|
|
||||||
: mSplitLayout.getSnapAlgorithm();
|
: mSplitLayout.getSnapAlgorithm();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,7 +627,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Record last snap target the divider moved to
|
// Record last snap target the divider moved to
|
||||||
if (mHomeStackResizable && !mIsInMinimizeInteraction) {
|
if (!mIsInMinimizeInteraction) {
|
||||||
// The last snapTarget position can be negative when the last divider position was
|
// The last snapTarget position can be negative when the last divider position was
|
||||||
// offscreen. In that case, save the middle (default) SnapTarget so calculating next
|
// offscreen. In that case, save the middle (default) SnapTarget so calculating next
|
||||||
// position isn't negative.
|
// position isn't negative.
|
||||||
@@ -774,7 +772,8 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
mSplitLayout.resizeSplits(midPos);
|
mSplitLayout.resizeSplits(midPos);
|
||||||
Transaction t = mTiles.getTransaction();
|
Transaction t = mTiles.getTransaction();
|
||||||
if (mDockedStackMinimized) {
|
if (mDockedStackMinimized) {
|
||||||
int position = mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget().position;
|
int position = mSplitLayout.getMinimizedSnapAlgorithm(mHomeStackResizable)
|
||||||
|
.getMiddleTarget().position;
|
||||||
calculateBoundsForPosition(position, mDockSide, mDockedRect);
|
calculateBoundsForPosition(position, mDockSide, mDockedRect);
|
||||||
calculateBoundsForPosition(position, DockedDividerUtils.invertDockSide(mDockSide),
|
calculateBoundsForPosition(position, DockedDividerUtils.invertDockSide(mDockSide),
|
||||||
mOtherRect);
|
mOtherRect);
|
||||||
@@ -811,23 +810,9 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
updateDockSide();
|
updateDockSide();
|
||||||
if (!minimized) {
|
if (!minimized) {
|
||||||
resetBackground();
|
resetBackground();
|
||||||
} else if (!isHomeStackResizable) {
|
|
||||||
if (mDockSide == WindowManager.DOCKED_TOP) {
|
|
||||||
mBackground.setPivotY(0);
|
|
||||||
mBackground.setScaleY(MINIMIZE_DOCK_SCALE);
|
|
||||||
} else if (mDockSide == WindowManager.DOCKED_LEFT
|
|
||||||
|| mDockSide == WindowManager.DOCKED_RIGHT) {
|
|
||||||
mBackground.setPivotX(mDockSide == WindowManager.DOCKED_LEFT
|
|
||||||
? 0
|
|
||||||
: mBackground.getWidth());
|
|
||||||
mBackground.setScaleX(MINIMIZE_DOCK_SCALE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mMinimizedShadow.setAlpha(minimized ? 1f : 0f);
|
mMinimizedShadow.setAlpha(minimized ? 1f : 0f);
|
||||||
if (!isHomeStackResizable) {
|
if (mDockedStackMinimized != minimized) {
|
||||||
mHandle.setAlpha(minimized ? 0f : 1f);
|
|
||||||
mDockedStackMinimized = minimized;
|
|
||||||
} else if (mDockedStackMinimized != minimized) {
|
|
||||||
mDockedStackMinimized = minimized;
|
mDockedStackMinimized = minimized;
|
||||||
if (mSplitLayout.mDisplayLayout.rotation() != mDefaultDisplay.getRotation()) {
|
if (mSplitLayout.mDisplayLayout.rotation() != mDefaultDisplay.getRotation()) {
|
||||||
// Splitscreen to minimize is about to starts after rotating landscape to seascape,
|
// Splitscreen to minimize is about to starts after rotating landscape to seascape,
|
||||||
@@ -840,8 +825,8 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
// Relayout to recalculate the divider shadow when minimizing
|
// Relayout to recalculate the divider shadow when minimizing
|
||||||
requestLayout();
|
requestLayout();
|
||||||
mIsInMinimizeInteraction = true;
|
mIsInMinimizeInteraction = true;
|
||||||
resizeStackSurfaces(
|
resizeStackSurfaces(mSplitLayout.getMinimizedSnapAlgorithm(mHomeStackResizable)
|
||||||
mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget(), t);
|
.getMiddleTarget(), t);
|
||||||
} else {
|
} else {
|
||||||
resizeStackSurfaces(mSnapTargetBeforeMinimized, t);
|
resizeStackSurfaces(mSnapTargetBeforeMinimized, t);
|
||||||
mIsInMinimizeInteraction = false;
|
mIsInMinimizeInteraction = false;
|
||||||
@@ -860,11 +845,11 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
t.show(sc).apply();
|
t.show(sc).apply();
|
||||||
mTiles.releaseTransaction(t);
|
mTiles.releaseTransaction(t);
|
||||||
});
|
});
|
||||||
if (isHomeStackResizable) {
|
|
||||||
SnapTarget miniMid = mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget();
|
SnapTarget miniMid =
|
||||||
if (mDockedStackMinimized) {
|
mSplitLayout.getMinimizedSnapAlgorithm(isHomeStackResizable).getMiddleTarget();
|
||||||
mDividerPositionY = mDividerPositionX = miniMid.position;
|
if (mDockedStackMinimized) {
|
||||||
}
|
mDividerPositionY = mDividerPositionX = miniMid.position;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -903,38 +888,15 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
if (DEBUG) Slog.d(TAG, "setMinDock: " + mDockedStackMinimized + "->" + minimized);
|
if (DEBUG) Slog.d(TAG, "setMinDock: " + mDockedStackMinimized + "->" + minimized);
|
||||||
mHomeStackResizable = isHomeStackResizable;
|
mHomeStackResizable = isHomeStackResizable;
|
||||||
updateDockSide();
|
updateDockSide();
|
||||||
if (!isHomeStackResizable) {
|
if (mDockedStackMinimized != minimized) {
|
||||||
mMinimizedShadow.animate()
|
|
||||||
.alpha(minimized ? 1f : 0f)
|
|
||||||
.setInterpolator(Interpolators.ALPHA_IN)
|
|
||||||
.setDuration(animDuration)
|
|
||||||
.start();
|
|
||||||
mHandle.animate()
|
|
||||||
.setInterpolator(Interpolators.FAST_OUT_SLOW_IN)
|
|
||||||
.setDuration(animDuration)
|
|
||||||
.alpha(minimized ? 0f : 1f)
|
|
||||||
.start();
|
|
||||||
if (mDockSide == WindowManager.DOCKED_TOP) {
|
|
||||||
mBackground.setPivotY(0);
|
|
||||||
mBackground.animate()
|
|
||||||
.scaleY(minimized ? MINIMIZE_DOCK_SCALE : 1f);
|
|
||||||
} else if (mDockSide == WindowManager.DOCKED_LEFT
|
|
||||||
|| mDockSide == WindowManager.DOCKED_RIGHT) {
|
|
||||||
mBackground.setPivotX(mDockSide == WindowManager.DOCKED_LEFT
|
|
||||||
? 0
|
|
||||||
: mBackground.getWidth());
|
|
||||||
mBackground.animate()
|
|
||||||
.scaleX(minimized ? MINIMIZE_DOCK_SCALE : 1f);
|
|
||||||
}
|
|
||||||
mDockedStackMinimized = minimized;
|
|
||||||
} else if (mDockedStackMinimized != minimized) {
|
|
||||||
mIsInMinimizeInteraction = true;
|
mIsInMinimizeInteraction = true;
|
||||||
mDockedStackMinimized = minimized;
|
mDockedStackMinimized = minimized;
|
||||||
stopDragging(minimized
|
stopDragging(minimized
|
||||||
? mSnapTargetBeforeMinimized.position
|
? mSnapTargetBeforeMinimized.position
|
||||||
: getCurrentPosition(),
|
: getCurrentPosition(),
|
||||||
minimized
|
minimized
|
||||||
? mSplitLayout.getMinimizedSnapAlgorithm().getMiddleTarget()
|
? mSplitLayout.getMinimizedSnapAlgorithm(mHomeStackResizable)
|
||||||
|
.getMiddleTarget()
|
||||||
: mSnapTargetBeforeMinimized,
|
: mSnapTargetBeforeMinimized,
|
||||||
animDuration, Interpolators.FAST_OUT_SLOW_IN, 0);
|
animDuration, Interpolators.FAST_OUT_SLOW_IN, 0);
|
||||||
setAdjustedForIme(false, animDuration);
|
setAdjustedForIme(false, animDuration);
|
||||||
@@ -1127,7 +1089,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
final boolean ownTransaction = transaction == null;
|
final boolean ownTransaction = transaction == null;
|
||||||
final Transaction t = ownTransaction ? mTiles.getTransaction() : transaction;
|
final Transaction t = ownTransaction ? mTiles.getTransaction() : transaction;
|
||||||
mLastResizeRect.set(mDockedRect);
|
mLastResizeRect.set(mDockedRect);
|
||||||
if (mHomeStackResizable && mIsInMinimizeInteraction) {
|
if (mIsInMinimizeInteraction) {
|
||||||
calculateBoundsForPosition(mSnapTargetBeforeMinimized.position, mDockSide,
|
calculateBoundsForPosition(mSnapTargetBeforeMinimized.position, mDockSide,
|
||||||
mDockedTaskRect);
|
mDockedTaskRect);
|
||||||
calculateBoundsForPosition(mSnapTargetBeforeMinimized.position,
|
calculateBoundsForPosition(mSnapTargetBeforeMinimized.position,
|
||||||
@@ -1138,8 +1100,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
mDockedTaskRect.offset(Math.max(position, -mDividerSize)
|
mDockedTaskRect.offset(Math.max(position, -mDividerSize)
|
||||||
- mDockedTaskRect.left + mDividerSize, 0);
|
- mDockedTaskRect.left + mDividerSize, 0);
|
||||||
}
|
}
|
||||||
resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect,
|
resizeSplitSurfaces(t, mDockedRect, mDockedTaskRect, mOtherRect, mOtherTaskRect);
|
||||||
mOtherTaskRect);
|
|
||||||
if (ownTransaction) {
|
if (ownTransaction) {
|
||||||
t.apply();
|
t.apply();
|
||||||
mTiles.releaseTransaction(t);
|
mTiles.releaseTransaction(t);
|
||||||
@@ -1420,7 +1381,7 @@ public class DividerView extends FrameLayout implements OnTouchListener,
|
|||||||
|
|
||||||
void onUndockingTask() {
|
void onUndockingTask() {
|
||||||
int dockSide = mSplitLayout.getPrimarySplitSide();
|
int dockSide = mSplitLayout.getPrimarySplitSide();
|
||||||
if (inSplitMode() && (mHomeStackResizable || !mDockedStackMinimized)) {
|
if (inSplitMode()) {
|
||||||
startDragging(false /* animate */, false /* touching */);
|
startDragging(false /* animate */, false /* touching */);
|
||||||
SnapTarget target = dockSideTopLeft(dockSide)
|
SnapTarget target = dockSideTopLeft(dockSide)
|
||||||
? mSplitLayout.getSnapAlgorithm().getDismissEndTarget()
|
? mSplitLayout.getSnapAlgorithm().getDismissEndTarget()
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
package com.android.systemui.stackdivider;
|
package com.android.systemui.stackdivider;
|
||||||
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
|
||||||
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||||
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
|
||||||
import static android.view.WindowManager.DOCKED_BOTTOM;
|
import static android.view.WindowManager.DOCKED_BOTTOM;
|
||||||
@@ -113,11 +111,6 @@ public class SplitDisplayLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isMinimized() {
|
|
||||||
return mTiles.mSecondary.topActivityType == ACTIVITY_TYPE_HOME
|
|
||||||
|| mTiles.mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
|
|
||||||
}
|
|
||||||
|
|
||||||
DividerSnapAlgorithm getSnapAlgorithm() {
|
DividerSnapAlgorithm getSnapAlgorithm() {
|
||||||
if (mSnapAlgorithm == null) {
|
if (mSnapAlgorithm == null) {
|
||||||
updateResources();
|
updateResources();
|
||||||
@@ -129,14 +122,14 @@ public class SplitDisplayLayout {
|
|||||||
return mSnapAlgorithm;
|
return mSnapAlgorithm;
|
||||||
}
|
}
|
||||||
|
|
||||||
DividerSnapAlgorithm getMinimizedSnapAlgorithm() {
|
DividerSnapAlgorithm getMinimizedSnapAlgorithm(boolean homeStackResizable) {
|
||||||
if (mMinimizedSnapAlgorithm == null) {
|
if (mMinimizedSnapAlgorithm == null) {
|
||||||
updateResources();
|
updateResources();
|
||||||
boolean isHorizontalDivision = !mDisplayLayout.isLandscape();
|
boolean isHorizontalDivision = !mDisplayLayout.isLandscape();
|
||||||
mMinimizedSnapAlgorithm = new DividerSnapAlgorithm(mContext.getResources(),
|
mMinimizedSnapAlgorithm = new DividerSnapAlgorithm(mContext.getResources(),
|
||||||
mDisplayLayout.width(), mDisplayLayout.height(), mDividerSize,
|
mDisplayLayout.width(), mDisplayLayout.height(), mDividerSize,
|
||||||
isHorizontalDivision, mDisplayLayout.stableInsets(), getPrimarySplitSide(),
|
isHorizontalDivision, mDisplayLayout.stableInsets(), getPrimarySplitSide(),
|
||||||
true /* isMinimized */);
|
true /* isMinimized */, homeStackResizable);
|
||||||
}
|
}
|
||||||
return mMinimizedSnapAlgorithm;
|
return mMinimizedSnapAlgorithm;
|
||||||
}
|
}
|
||||||
@@ -168,8 +161,9 @@ public class SplitDisplayLayout {
|
|||||||
mDisplayLayout.height(), mDividerSize);
|
mDisplayLayout.height(), mDividerSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect calcMinimizedHomeStackBounds() {
|
Rect calcResizableMinimizedHomeStackBounds() {
|
||||||
DividerSnapAlgorithm.SnapTarget miniMid = getMinimizedSnapAlgorithm().getMiddleTarget();
|
DividerSnapAlgorithm.SnapTarget miniMid =
|
||||||
|
getMinimizedSnapAlgorithm(true /* resizable */).getMiddleTarget();
|
||||||
Rect homeBounds = new Rect();
|
Rect homeBounds = new Rect();
|
||||||
DockedDividerUtils.calculateBoundsForPosition(miniMid.position,
|
DockedDividerUtils.calculateBoundsForPosition(miniMid.position,
|
||||||
DockedDividerUtils.invertDockSide(getPrimarySplitSide()), homeBounds,
|
DockedDividerUtils.invertDockSide(getPrimarySplitSide()), homeBounds,
|
||||||
|
|||||||
@@ -165,8 +165,9 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
|
|||||||
Log.e(TAG, "Got handleTaskInfoChanged when not initialized: " + info);
|
Log.e(TAG, "Got handleTaskInfoChanged when not initialized: " + info);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final boolean secondaryWasHomeOrRecents = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
|
final boolean secondaryImpliedMinimize = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
|
||||||
|| mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
|
|| (mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS
|
||||||
|
&& mDivider.isHomeStackResizable());
|
||||||
final boolean primaryWasEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
final boolean primaryWasEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
||||||
final boolean secondaryWasEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
final boolean secondaryWasEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
||||||
if (info.token.asBinder() == mPrimary.token.asBinder()) {
|
if (info.token.asBinder() == mPrimary.token.asBinder()) {
|
||||||
@@ -176,13 +177,14 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
|
|||||||
}
|
}
|
||||||
final boolean primaryIsEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
final boolean primaryIsEmpty = mPrimary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
||||||
final boolean secondaryIsEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
final boolean secondaryIsEmpty = mSecondary.topActivityType == ACTIVITY_TYPE_UNDEFINED;
|
||||||
final boolean secondaryIsHomeOrRecents = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
|
final boolean secondaryImpliesMinimize = mSecondary.topActivityType == ACTIVITY_TYPE_HOME
|
||||||
|| mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS;
|
|| (mSecondary.topActivityType == ACTIVITY_TYPE_RECENTS
|
||||||
|
&& mDivider.isHomeStackResizable());
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Log.d(TAG, "onTaskInfoChanged " + mPrimary + " " + mSecondary);
|
Log.d(TAG, "onTaskInfoChanged " + mPrimary + " " + mSecondary);
|
||||||
}
|
}
|
||||||
if (primaryIsEmpty == primaryWasEmpty && secondaryWasEmpty == secondaryIsEmpty
|
if (primaryIsEmpty == primaryWasEmpty && secondaryWasEmpty == secondaryIsEmpty
|
||||||
&& secondaryWasHomeOrRecents == secondaryIsHomeOrRecents) {
|
&& secondaryImpliedMinimize == secondaryImpliesMinimize) {
|
||||||
// No relevant changes
|
// No relevant changes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -211,7 +213,7 @@ class SplitScreenTaskOrganizer extends TaskOrganizer {
|
|||||||
}
|
}
|
||||||
mDivider.startEnterSplit();
|
mDivider.startEnterSplit();
|
||||||
}
|
}
|
||||||
} else if (secondaryIsHomeOrRecents) {
|
} else if (secondaryImpliesMinimize) {
|
||||||
// Both splits are populated but the secondary split has a home/recents stack on top,
|
// Both splits are populated but the secondary split has a home/recents stack on top,
|
||||||
// so enter minimized mode.
|
// so enter minimized mode.
|
||||||
mDivider.ensureMinimizedSplit();
|
mDivider.ensureMinimizedSplit();
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ package com.android.systemui.stackdivider;
|
|||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
|
||||||
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
|
||||||
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
|
||||||
|
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
|
||||||
|
import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
|
||||||
|
import static android.content.res.Configuration.ORIENTATION_UNDEFINED;
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
|
|
||||||
import android.annotation.NonNull;
|
import android.annotation.NonNull;
|
||||||
@@ -115,7 +118,7 @@ public class WindowManagerProxy {
|
|||||||
WindowOrganizer.applyTransaction(t);
|
WindowOrganizer.applyTransaction(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean getHomeAndRecentsTasks(List<WindowContainerToken> out,
|
private static boolean getHomeAndRecentsTasks(List<ActivityManager.RunningTaskInfo> out,
|
||||||
WindowContainerToken parent) {
|
WindowContainerToken parent) {
|
||||||
boolean resizable = false;
|
boolean resizable = false;
|
||||||
List<ActivityManager.RunningTaskInfo> rootTasks = parent == null
|
List<ActivityManager.RunningTaskInfo> rootTasks = parent == null
|
||||||
@@ -123,7 +126,7 @@ public class WindowManagerProxy {
|
|||||||
: TaskOrganizer.getChildTasks(parent, HOME_AND_RECENTS);
|
: TaskOrganizer.getChildTasks(parent, HOME_AND_RECENTS);
|
||||||
for (int i = 0, n = rootTasks.size(); i < n; ++i) {
|
for (int i = 0, n = rootTasks.size(); i < n; ++i) {
|
||||||
final ActivityManager.RunningTaskInfo ti = rootTasks.get(i);
|
final ActivityManager.RunningTaskInfo ti = rootTasks.get(i);
|
||||||
out.add(ti.token);
|
out.add(ti);
|
||||||
if (ti.topActivityType == ACTIVITY_TYPE_HOME) {
|
if (ti.topActivityType == ACTIVITY_TYPE_HOME) {
|
||||||
resizable = ti.isResizeable;
|
resizable = ti.isResizeable;
|
||||||
}
|
}
|
||||||
@@ -140,16 +143,37 @@ public class WindowManagerProxy {
|
|||||||
@NonNull WindowContainerTransaction wct) {
|
@NonNull WindowContainerTransaction wct) {
|
||||||
// Resize the home/recents stacks to the larger minimized-state size
|
// Resize the home/recents stacks to the larger minimized-state size
|
||||||
final Rect homeBounds;
|
final Rect homeBounds;
|
||||||
final ArrayList<WindowContainerToken> homeStacks = new ArrayList<>();
|
final ArrayList<ActivityManager.RunningTaskInfo> homeStacks = new ArrayList<>();
|
||||||
boolean isHomeResizable = getHomeAndRecentsTasks(homeStacks, parent);
|
boolean isHomeResizable = getHomeAndRecentsTasks(homeStacks, parent);
|
||||||
if (isHomeResizable) {
|
if (isHomeResizable) {
|
||||||
homeBounds = layout.calcMinimizedHomeStackBounds();
|
homeBounds = layout.calcResizableMinimizedHomeStackBounds();
|
||||||
} else {
|
} else {
|
||||||
homeBounds = new Rect(0, 0, layout.mDisplayLayout.width(),
|
// home is not resizable, so lock it to its inherent orientation size.
|
||||||
layout.mDisplayLayout.height());
|
homeBounds = new Rect(0, 0, 0, 0);
|
||||||
|
for (int i = homeStacks.size() - 1; i >= 0; --i) {
|
||||||
|
if (homeStacks.get(i).topActivityType == ACTIVITY_TYPE_HOME) {
|
||||||
|
final int orient = homeStacks.get(i).configuration.orientation;
|
||||||
|
final boolean displayLandscape = layout.mDisplayLayout.isLandscape();
|
||||||
|
final boolean isLandscape = orient == ORIENTATION_LANDSCAPE
|
||||||
|
|| (orient == ORIENTATION_UNDEFINED && displayLandscape);
|
||||||
|
homeBounds.right = isLandscape == displayLandscape
|
||||||
|
? layout.mDisplayLayout.width() : layout.mDisplayLayout.height();
|
||||||
|
homeBounds.bottom = isLandscape == displayLandscape
|
||||||
|
? layout.mDisplayLayout.height() : layout.mDisplayLayout.width();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (int i = homeStacks.size() - 1; i >= 0; --i) {
|
for (int i = homeStacks.size() - 1; i >= 0; --i) {
|
||||||
wct.setBounds(homeStacks.get(i), homeBounds);
|
// For non-resizable homes, the minimized size is actually the fullscreen-size. As a
|
||||||
|
// result, we don't minimize for recents since it only shows half-size screenshots.
|
||||||
|
if (!isHomeResizable) {
|
||||||
|
if (homeStacks.get(i).topActivityType == ACTIVITY_TYPE_RECENTS) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
wct.setWindowingMode(homeStacks.get(i).token, WINDOWING_MODE_FULLSCREEN);
|
||||||
|
}
|
||||||
|
wct.setBounds(homeStacks.get(i).token, homeBounds);
|
||||||
}
|
}
|
||||||
layout.mTiles.mHomeBounds.set(homeBounds);
|
layout.mTiles.mHomeBounds.set(homeBounds);
|
||||||
return isHomeResizable;
|
return isHomeResizable;
|
||||||
@@ -175,11 +199,13 @@ public class WindowManagerProxy {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ActivityManager.RunningTaskInfo topHomeTask = null;
|
ActivityManager.RunningTaskInfo topHomeTask = null;
|
||||||
boolean homeIsTop = false;
|
|
||||||
for (int i = rootTasks.size() - 1; i >= 0; --i) {
|
for (int i = rootTasks.size() - 1; i >= 0; --i) {
|
||||||
final ActivityManager.RunningTaskInfo rootTask = rootTasks.get(i);
|
final ActivityManager.RunningTaskInfo rootTask = rootTasks.get(i);
|
||||||
// Only move resizeable task to split secondary. WM will just ignore this anyways...
|
// Only move resizeable task to split secondary. However, we have an exception
|
||||||
if (!rootTask.isResizeable) continue;
|
// for non-resizable home because we will minimize to show it.
|
||||||
|
if (!rootTask.isResizeable && rootTask.topActivityType != ACTIVITY_TYPE_HOME) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
// Only move fullscreen tasks to split secondary.
|
// Only move fullscreen tasks to split secondary.
|
||||||
if (rootTask.configuration.windowConfiguration.getWindowingMode()
|
if (rootTask.configuration.windowConfiguration.getWindowingMode()
|
||||||
!= WINDOWING_MODE_FULLSCREEN) {
|
!= WINDOWING_MODE_FULLSCREEN) {
|
||||||
@@ -193,7 +219,7 @@ public class WindowManagerProxy {
|
|||||||
// Move the secondary split-forward.
|
// Move the secondary split-forward.
|
||||||
wct.reorder(tiles.mSecondary.token, true /* onTop */);
|
wct.reorder(tiles.mSecondary.token, true /* onTop */);
|
||||||
boolean isHomeResizable = applyHomeTasksMinimized(layout, null /* parent */, wct);
|
boolean isHomeResizable = applyHomeTasksMinimized(layout, null /* parent */, wct);
|
||||||
if (isHomeResizable && topHomeTask != null) {
|
if (topHomeTask != null) {
|
||||||
// Translate/update-crop of secondary out-of-band with sync transaction -- Until BALST
|
// Translate/update-crop of secondary out-of-band with sync transaction -- Until BALST
|
||||||
// is enabled, this temporarily syncs the home surface position with offset until
|
// is enabled, this temporarily syncs the home surface position with offset until
|
||||||
// sync transaction finishes.
|
// sync transaction finishes.
|
||||||
@@ -253,6 +279,7 @@ public class WindowManagerProxy {
|
|||||||
wct.reparent(ti.token, null /* parent */, true /* onTop */);
|
wct.reparent(ti.token, null /* parent */, true /* onTop */);
|
||||||
if (isHomeOrRecentTask(ti)) {
|
if (isHomeOrRecentTask(ti)) {
|
||||||
wct.setBounds(ti.token, null);
|
wct.setBounds(ti.token, null);
|
||||||
|
wct.setWindowingMode(ti.token, WINDOWING_MODE_UNDEFINED);
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
homeOnTop = true;
|
homeOnTop = true;
|
||||||
}
|
}
|
||||||
@@ -293,8 +320,9 @@ public class WindowManagerProxy {
|
|||||||
final ActivityManager.RunningTaskInfo ti = secondaryChildren.get(i);
|
final ActivityManager.RunningTaskInfo ti = secondaryChildren.get(i);
|
||||||
if (isHomeOrRecentTask(ti)) {
|
if (isHomeOrRecentTask(ti)) {
|
||||||
wct.reparent(ti.token, null /* parent */, true /* onTop */);
|
wct.reparent(ti.token, null /* parent */, true /* onTop */);
|
||||||
// reset bounds too
|
// reset bounds and mode too
|
||||||
wct.setBounds(ti.token, null);
|
wct.setBounds(ti.token, null);
|
||||||
|
wct.setWindowingMode(ti.token, WINDOWING_MODE_UNDEFINED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = primaryChildren.size() - 1; i >= 0; --i) {
|
for (int i = primaryChildren.size() - 1; i >= 0; --i) {
|
||||||
@@ -304,6 +332,7 @@ public class WindowManagerProxy {
|
|||||||
}
|
}
|
||||||
for (int i = freeHomeAndRecents.size() - 1; i >= 0; --i) {
|
for (int i = freeHomeAndRecents.size() - 1; i >= 0; --i) {
|
||||||
wct.setBounds(freeHomeAndRecents.get(i).token, null);
|
wct.setBounds(freeHomeAndRecents.get(i).token, null);
|
||||||
|
wct.setWindowingMode(freeHomeAndRecents.get(i).token, WINDOWING_MODE_UNDEFINED);
|
||||||
}
|
}
|
||||||
// Reset focusable to true
|
// Reset focusable to true
|
||||||
wct.setFocusable(tiles.mPrimary.token, true /* focusable */);
|
wct.setFocusable(tiles.mPrimary.token, true /* focusable */);
|
||||||
|
|||||||
@@ -3686,20 +3686,6 @@ class Task extends WindowContainer<WindowContainer> {
|
|||||||
final int otherWindowingMode = other.getWindowingMode();
|
final int otherWindowingMode = other.getWindowingMode();
|
||||||
|
|
||||||
if (otherWindowingMode == WINDOWING_MODE_FULLSCREEN) {
|
if (otherWindowingMode == WINDOWING_MODE_FULLSCREEN) {
|
||||||
// In this case the home stack isn't resizeable even though we are in split-screen
|
|
||||||
// mode. We still want the primary splitscreen stack to be visible as there will be
|
|
||||||
// a slight hint of it in the status bar area above the non-resizeable home
|
|
||||||
// activity. In addition, if the fullscreen assistant is over primary splitscreen
|
|
||||||
// stack, the stack should still be visible in the background as long as the recents
|
|
||||||
// animation is running.
|
|
||||||
final int activityType = other.getActivityType();
|
|
||||||
if (windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY) {
|
|
||||||
if (activityType == ACTIVITY_TYPE_HOME
|
|
||||||
|| (activityType == ACTIVITY_TYPE_ASSISTANT
|
|
||||||
&& mWmService.getRecentsAnimationController() != null)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (other.isTranslucent(starting)) {
|
if (other.isTranslucent(starting)) {
|
||||||
// Can be visible behind a translucent fullscreen stack.
|
// Can be visible behind a translucent fullscreen stack.
|
||||||
gotTranslucentFullscreen = true;
|
gotTranslucentFullscreen = true;
|
||||||
|
|||||||
@@ -571,14 +571,16 @@ final class TaskDisplayArea extends DisplayArea<ActivityStack> {
|
|||||||
// Apps and their containers are not allowed to specify an orientation while using
|
// Apps and their containers are not allowed to specify an orientation while using
|
||||||
// root tasks...except for the home stack if it is not resizable and currently
|
// root tasks...except for the home stack if it is not resizable and currently
|
||||||
// visible (top of) its root task.
|
// visible (top of) its root task.
|
||||||
if (mRootHomeTask != null && mRootHomeTask.isVisible()) {
|
if (mRootHomeTask != null && mRootHomeTask.isVisible()
|
||||||
final Task topMost = mRootHomeTask.getTopMostTask();
|
&& !mRootHomeTask.isResizeable()) {
|
||||||
final boolean resizable = topMost != null && topMost.isResizeable();
|
// Manually nest one-level because because getOrientation() checks fillsParent()
|
||||||
if (!(resizable && mRootHomeTask.matchParentBounds())) {
|
// which checks that requestedOverrideBounds() is empty. However, in this case,
|
||||||
final int orientation = mRootHomeTask.getOrientation();
|
// it is not empty because it's been overridden to maintain the fullscreen size
|
||||||
if (orientation != SCREEN_ORIENTATION_UNSET) {
|
// within a smaller split-root.
|
||||||
return orientation;
|
final Task topHomeTask = mRootHomeTask.getTopMostTask();
|
||||||
}
|
final int orientation = topHomeTask.getOrientation();
|
||||||
|
if (orientation != SCREEN_ORIENTATION_UNSET) {
|
||||||
|
return orientation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SCREEN_ORIENTATION_UNSPECIFIED;
|
return SCREEN_ORIENTATION_UNSPECIFIED;
|
||||||
|
|||||||
Reference in New Issue
Block a user