Merge "Shift Primary stack as well as secondary during ime adjustment" into rvc-dev am: 650e162195 am: e7c8885f19
Change-Id: I428b33fc0cb5c8a962d7ced5154c7a9cd5526e93
This commit is contained in:
@@ -136,20 +136,25 @@ public class InsetsSource implements Parcelable {
|
||||
if (mTmpFrame.width() == relativeFrame.width()) {
|
||||
if (mTmpFrame.top == relativeFrame.top) {
|
||||
return Insets.of(0, mTmpFrame.height(), 0, 0);
|
||||
} else {
|
||||
} else if (mTmpFrame.bottom == relativeFrame.bottom) {
|
||||
return Insets.of(0, 0, 0, mTmpFrame.height());
|
||||
}
|
||||
// TODO: remove when insets are shell-customizable.
|
||||
// This is a hack that says "if this is a top-inset (eg statusbar), always apply it
|
||||
// to the top". It is used when adjusting primary split for IME.
|
||||
if (mTmpFrame.top == 0) {
|
||||
return Insets.of(0, mTmpFrame.height(), 0, 0);
|
||||
}
|
||||
}
|
||||
// Intersecting at left/right
|
||||
else if (mTmpFrame.height() == relativeFrame.height()) {
|
||||
if (mTmpFrame.left == relativeFrame.left) {
|
||||
return Insets.of(mTmpFrame.width(), 0, 0, 0);
|
||||
} else {
|
||||
} else if (mTmpFrame.right == relativeFrame.right) {
|
||||
return Insets.of(0, 0, mTmpFrame.width(), 0);
|
||||
}
|
||||
} else {
|
||||
return Insets.NONE;
|
||||
}
|
||||
return Insets.NONE;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -261,11 +261,25 @@ public class Divider extends SystemUI implements DividerView.DividerCallbacks,
|
||||
wct.setScreenSizeDp(mSplits.mSecondary.token,
|
||||
mSplits.mSecondary.configuration.screenWidthDp,
|
||||
mSplits.mSecondary.configuration.screenHeightDp);
|
||||
|
||||
wct.setBounds(mSplits.mPrimary.token, mSplitLayout.mAdjustedPrimary);
|
||||
adjustAppBounds = new Rect(mSplits.mPrimary.configuration
|
||||
.windowConfiguration.getAppBounds());
|
||||
adjustAppBounds.offset(0, mSplitLayout.mAdjustedPrimary.top
|
||||
- mSplitLayout.mPrimary.top);
|
||||
wct.setAppBounds(mSplits.mPrimary.token, adjustAppBounds);
|
||||
wct.setScreenSizeDp(mSplits.mPrimary.token,
|
||||
mSplits.mPrimary.configuration.screenWidthDp,
|
||||
mSplits.mPrimary.configuration.screenHeightDp);
|
||||
} else {
|
||||
wct.setBounds(mSplits.mSecondary.token, mSplitLayout.mSecondary);
|
||||
wct.setAppBounds(mSplits.mSecondary.token, null);
|
||||
wct.setScreenSizeDp(mSplits.mSecondary.token,
|
||||
SCREEN_WIDTH_DP_UNDEFINED, SCREEN_HEIGHT_DP_UNDEFINED);
|
||||
wct.setBounds(mSplits.mPrimary.token, mSplitLayout.mPrimary);
|
||||
wct.setAppBounds(mSplits.mPrimary.token, null);
|
||||
wct.setScreenSizeDp(mSplits.mPrimary.token,
|
||||
SCREEN_WIDTH_DP_UNDEFINED, SCREEN_HEIGHT_DP_UNDEFINED);
|
||||
}
|
||||
|
||||
WindowOrganizer.applyTransaction(wct);
|
||||
|
||||
@@ -2309,27 +2309,31 @@ class Task extends WindowContainer<WindowContainer> {
|
||||
insideParentBounds = parentBounds.contains(resolvedBounds);
|
||||
}
|
||||
|
||||
// Non-null compatibility insets means the activity prefers to keep its original size, so
|
||||
// out bounds doesn't need to be restricted by the parent or current display
|
||||
final boolean customContainerPolicy = compatInsets != null;
|
||||
|
||||
Rect outAppBounds = inOutConfig.windowConfiguration.getAppBounds();
|
||||
if (outAppBounds == null || outAppBounds.isEmpty()) {
|
||||
// App-bounds hasn't been overridden, so calculate a value for it.
|
||||
inOutConfig.windowConfiguration.setAppBounds(mTmpFullBounds);
|
||||
outAppBounds = inOutConfig.windowConfiguration.getAppBounds();
|
||||
}
|
||||
// Non-null compatibility insets means the activity prefers to keep its original size, so
|
||||
// the out bounds doesn't need to be restricted by the parent or current display.
|
||||
final boolean customContainerPolicy = compatInsets != null;
|
||||
if (!customContainerPolicy && windowingMode != WINDOWING_MODE_FREEFORM) {
|
||||
final Rect containingAppBounds;
|
||||
if (insideParentBounds) {
|
||||
containingAppBounds = parentConfig.windowConfiguration.getAppBounds();
|
||||
} else {
|
||||
// Restrict appBounds to display non-decor rather than parent because the override
|
||||
// bounds are beyond the parent. Otherwise, it won't match the overridden bounds.
|
||||
final TaskDisplayArea displayArea = getDisplayArea();
|
||||
containingAppBounds = displayArea != null
|
||||
? displayArea.getWindowConfiguration().getAppBounds() : null;
|
||||
}
|
||||
if (containingAppBounds != null && !containingAppBounds.isEmpty()) {
|
||||
outAppBounds.intersect(containingAppBounds);
|
||||
|
||||
if (!customContainerPolicy && windowingMode != WINDOWING_MODE_FREEFORM) {
|
||||
final Rect containingAppBounds;
|
||||
if (insideParentBounds) {
|
||||
containingAppBounds = parentConfig.windowConfiguration.getAppBounds();
|
||||
} else {
|
||||
// Restrict appBounds to display non-decor rather than parent because the
|
||||
// override bounds are beyond the parent. Otherwise, it won't match the
|
||||
// overridden bounds.
|
||||
final TaskDisplayArea displayArea = getDisplayArea();
|
||||
containingAppBounds = displayArea != null
|
||||
? displayArea.getWindowConfiguration().getAppBounds() : null;
|
||||
}
|
||||
if (containingAppBounds != null && !containingAppBounds.isEmpty()) {
|
||||
outAppBounds.intersect(containingAppBounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ import static com.android.server.wm.WindowStateAnimatorProto.SURFACE;
|
||||
import static com.android.server.wm.WindowStateAnimatorProto.SYSTEM_DECOR_RECT;
|
||||
import static com.android.server.wm.WindowSurfacePlacer.SET_ORIENTATION_CHANGE_COMPLETE;
|
||||
|
||||
import android.app.WindowConfiguration;
|
||||
import android.content.Context;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.PixelFormat;
|
||||
@@ -787,7 +788,8 @@ class WindowStateAnimator {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (w.getWindowConfiguration().tasksAreFloating()) {
|
||||
if (w.getWindowConfiguration().tasksAreFloating()
|
||||
|| WindowConfiguration.isSplitScreenWindowingMode(w.getWindowingMode())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,4 +189,25 @@ public class InsetsSourceProviderTest extends WindowTestsBase {
|
||||
mProvider.onInsetsModified(target, state.getSource(ITYPE_STATUS_BAR));
|
||||
assertTrue(mSource.isVisible());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInsetGeometries() {
|
||||
final WindowState statusBar = createWindow(null, TYPE_APPLICATION, "statusBar");
|
||||
statusBar.getFrameLw().set(0, 0, 500, 100);
|
||||
statusBar.mHasSurface = true;
|
||||
mProvider.setWindow(statusBar, null, null);
|
||||
mProvider.onPostLayout();
|
||||
assertEquals(new Rect(0, 0, 500, 100), mProvider.getSource().getFrame());
|
||||
// Still apply top insets if window overlaps even if it's top doesn't exactly match
|
||||
// the inset-window's top.
|
||||
assertEquals(Insets.of(0, 100, 0, 0),
|
||||
mProvider.getSource().calculateInsets(new Rect(0, -100, 500, 400),
|
||||
false /* ignoreVisibility */));
|
||||
|
||||
// Don't apply left insets if window is left-of inset-window but still overlaps
|
||||
statusBar.getFrameLw().set(100, 0, 0, 0);
|
||||
assertEquals(Insets.of(0, 0, 0, 0),
|
||||
mProvider.getSource().calculateInsets(new Rect(-100, 0, 400, 500),
|
||||
false /* ignoreVisibility */));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user