Merge "Fix extra offset of the split layout" into tm-dev
This commit is contained in:
@@ -144,21 +144,42 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
|||||||
return Math.max(dividerInset, radius);
|
return Math.max(dividerInset, radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets bounds of the primary split. */
|
/** Gets bounds of the primary split with screen based coordinate. */
|
||||||
public Rect getBounds1() {
|
public Rect getBounds1() {
|
||||||
return new Rect(mBounds1);
|
return new Rect(mBounds1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets bounds of the secondary split. */
|
/** Gets bounds of the primary split with parent based coordinate. */
|
||||||
|
public Rect getRefBounds1() {
|
||||||
|
Rect outBounds = getBounds1();
|
||||||
|
outBounds.offset(-mRootBounds.left, -mRootBounds.top);
|
||||||
|
return outBounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets bounds of the secondary split with screen based coordinate. */
|
||||||
public Rect getBounds2() {
|
public Rect getBounds2() {
|
||||||
return new Rect(mBounds2);
|
return new Rect(mBounds2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gets bounds of divider window. */
|
/** Gets bounds of the secondary split with parent based coordinate. */
|
||||||
|
public Rect getRefBounds2() {
|
||||||
|
final Rect outBounds = getBounds2();
|
||||||
|
outBounds.offset(-mRootBounds.left, -mRootBounds.top);
|
||||||
|
return outBounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Gets bounds of divider window with screen based coordinate. */
|
||||||
public Rect getDividerBounds() {
|
public Rect getDividerBounds() {
|
||||||
return new Rect(mDividerBounds);
|
return new Rect(mDividerBounds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Gets bounds of divider window with parent based coordinate. */
|
||||||
|
public Rect getRefDividerBounds() {
|
||||||
|
final Rect outBounds = getDividerBounds();
|
||||||
|
outBounds.offset(-mRootBounds.left, -mRootBounds.top);
|
||||||
|
return outBounds;
|
||||||
|
}
|
||||||
|
|
||||||
/** Returns leash of the current divider bar. */
|
/** Returns leash of the current divider bar. */
|
||||||
@Nullable
|
@Nullable
|
||||||
public SurfaceControl getDividerLeash() {
|
public SurfaceControl getDividerLeash() {
|
||||||
@@ -452,14 +473,17 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
|
|||||||
SurfaceControl leash2, SurfaceControl dimLayer1, SurfaceControl dimLayer2) {
|
SurfaceControl leash2, SurfaceControl dimLayer1, SurfaceControl dimLayer2) {
|
||||||
final SurfaceControl dividerLeash = getDividerLeash();
|
final SurfaceControl dividerLeash = getDividerLeash();
|
||||||
if (dividerLeash != null) {
|
if (dividerLeash != null) {
|
||||||
t.setPosition(dividerLeash, mDividerBounds.left, mDividerBounds.top);
|
mTempRect.set(getRefDividerBounds());
|
||||||
|
t.setPosition(dividerLeash, mTempRect.left, mTempRect.top);
|
||||||
// Resets layer of divider bar to make sure it is always on top.
|
// Resets layer of divider bar to make sure it is always on top.
|
||||||
t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER);
|
t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER);
|
||||||
}
|
}
|
||||||
t.setPosition(leash1, mBounds1.left, mBounds1.top)
|
mTempRect.set(getRefBounds1());
|
||||||
.setWindowCrop(leash1, mBounds1.width(), mBounds1.height());
|
t.setPosition(leash1, mTempRect.left, mTempRect.top)
|
||||||
t.setPosition(leash2, mBounds2.left, mBounds2.top)
|
.setWindowCrop(leash1, mTempRect.width(), mTempRect.height());
|
||||||
.setWindowCrop(leash2, mBounds2.width(), mBounds2.height());
|
mTempRect.set(getRefBounds2());
|
||||||
|
t.setPosition(leash2, mTempRect.left, mTempRect.top)
|
||||||
|
.setWindowCrop(leash2, mTempRect.width(), mTempRect.height());
|
||||||
|
|
||||||
if (mImePositionProcessor.adjustSurfaceLayoutForIme(
|
if (mImePositionProcessor.adjustSurfaceLayoutForIme(
|
||||||
t, dividerLeash, leash1, leash2, dimLayer1, dimLayer2)) {
|
t, dividerLeash, leash1, leash2, dimLayer1, dimLayer2)) {
|
||||||
|
|||||||
@@ -979,7 +979,8 @@ class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
|||||||
t.setAlpha(dividerLeash, 1);
|
t.setAlpha(dividerLeash, 1);
|
||||||
t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER);
|
t.setLayer(dividerLeash, SPLIT_DIVIDER_LAYER);
|
||||||
t.setPosition(dividerLeash,
|
t.setPosition(dividerLeash,
|
||||||
mSplitLayout.getDividerBounds().left, mSplitLayout.getDividerBounds().top);
|
mSplitLayout.getRefDividerBounds().left,
|
||||||
|
mSplitLayout.getRefDividerBounds().top);
|
||||||
} else {
|
} else {
|
||||||
t.hide(dividerLeash);
|
t.hide(dividerLeash);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package com.android.wm.shell.splitscreen;
|
|||||||
|
|
||||||
import static android.view.Display.DEFAULT_DISPLAY;
|
import static android.view.Display.DEFAULT_DISPLAY;
|
||||||
import static android.window.DisplayAreaOrganizer.FEATURE_DEFAULT_TASK_CONTAINER;
|
import static android.window.DisplayAreaOrganizer.FEATURE_DEFAULT_TASK_CONTAINER;
|
||||||
|
|
||||||
import static org.mockito.Mockito.doReturn;
|
import static org.mockito.Mockito.doReturn;
|
||||||
import static org.mockito.Mockito.mock;
|
import static org.mockito.Mockito.mock;
|
||||||
|
|
||||||
@@ -51,6 +52,7 @@ public class SplitTestUtils {
|
|||||||
final SurfaceControl leash = createMockSurface();
|
final SurfaceControl leash = createMockSurface();
|
||||||
SplitLayout out = mock(SplitLayout.class);
|
SplitLayout out = mock(SplitLayout.class);
|
||||||
doReturn(dividerBounds).when(out).getDividerBounds();
|
doReturn(dividerBounds).when(out).getDividerBounds();
|
||||||
|
doReturn(dividerBounds).when(out).getRefDividerBounds();
|
||||||
doReturn(leash).when(out).getDividerLeash();
|
doReturn(leash).when(out).getDividerLeash();
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user