Merge "Fixed incorrect size and position of a snapshot starting window in waterfall device." into rvc-dev am: ae4f136023
Change-Id: Ib519cb853ce88ab0f1f912e86a593cc14547a266
This commit is contained in:
@@ -217,6 +217,7 @@ class TaskSnapshotSurface implements StartingSurface {
|
|||||||
= topFullscreenOpaqueWindow.mAttrs.insetsFlags.behavior;
|
= topFullscreenOpaqueWindow.mAttrs.insetsFlags.behavior;
|
||||||
layoutParams.insetsFlags.appearance
|
layoutParams.insetsFlags.appearance
|
||||||
= topFullscreenOpaqueWindow.mAttrs.insetsFlags.appearance;
|
= topFullscreenOpaqueWindow.mAttrs.insetsFlags.appearance;
|
||||||
|
layoutParams.layoutInDisplayCutoutMode = attrs.layoutInDisplayCutoutMode;
|
||||||
layoutParams.setFitInsetsTypes(attrs.getFitInsetsTypes());
|
layoutParams.setFitInsetsTypes(attrs.getFitInsetsTypes());
|
||||||
layoutParams.setFitInsetsSides(attrs.getFitInsetsSides());
|
layoutParams.setFitInsetsSides(attrs.getFitInsetsSides());
|
||||||
layoutParams.setFitInsetsIgnoringVisibility(attrs.isFitInsetsIgnoringVisibility());
|
layoutParams.setFitInsetsIgnoringVisibility(attrs.isFitInsetsIgnoringVisibility());
|
||||||
@@ -374,15 +375,15 @@ class TaskSnapshotSurface implements StartingSurface {
|
|||||||
frame = calculateSnapshotFrame(crop);
|
frame = calculateSnapshotFrame(crop);
|
||||||
mTransaction.setWindowCrop(mChildSurfaceControl, crop);
|
mTransaction.setWindowCrop(mChildSurfaceControl, crop);
|
||||||
mTransaction.setPosition(mChildSurfaceControl, frame.left, frame.top);
|
mTransaction.setPosition(mChildSurfaceControl, frame.left, frame.top);
|
||||||
|
mTmpSnapshotSize.set(crop);
|
||||||
mTmpDstFrame.set(frame);
|
mTmpDstFrame.set(frame);
|
||||||
} else {
|
} else {
|
||||||
frame = null;
|
frame = null;
|
||||||
|
mTmpSnapshotSize.set(0, 0, buffer.getWidth(), buffer.getHeight());
|
||||||
mTmpDstFrame.set(mFrame);
|
mTmpDstFrame.set(mFrame);
|
||||||
}
|
}
|
||||||
mTmpDstFrame.offsetTo(0, 0);
|
|
||||||
|
|
||||||
// Scale the mismatch dimensions to fill the task bounds
|
// Scale the mismatch dimensions to fill the task bounds
|
||||||
mTmpSnapshotSize.set(0, 0, buffer.getWidth(), buffer.getHeight());
|
|
||||||
mSnapshotMatrix.setRectToRect(mTmpSnapshotSize, mTmpDstFrame, Matrix.ScaleToFit.FILL);
|
mSnapshotMatrix.setRectToRect(mTmpSnapshotSize, mTmpDstFrame, Matrix.ScaleToFit.FILL);
|
||||||
mTransaction.setMatrix(mChildSurfaceControl, mSnapshotMatrix, mTmpFloat9);
|
mTransaction.setMatrix(mChildSurfaceControl, mSnapshotMatrix, mTmpFloat9);
|
||||||
|
|
||||||
@@ -435,16 +436,11 @@ class TaskSnapshotSurface implements StartingSurface {
|
|||||||
(float) mSnapshot.getSnapshot().getHeight() / mSnapshot.getTaskSize().y;
|
(float) mSnapshot.getSnapshot().getHeight() / mSnapshot.getTaskSize().y;
|
||||||
|
|
||||||
// Rescale the frame from snapshot to window coordinate space
|
// Rescale the frame from snapshot to window coordinate space
|
||||||
final Rect frame = new Rect(
|
final Rect frame = new Rect(0, 0,
|
||||||
(int) (crop.left / scaleX + 0.5f),
|
(int) (crop.width() / scaleX + 0.5f),
|
||||||
(int) (crop.top / scaleY + 0.5f),
|
(int) (crop.height() / scaleY + 0.5f)
|
||||||
(int) (crop.right / scaleX + 0.5f),
|
|
||||||
(int) (crop.bottom / scaleY + 0.5f)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// By default, offset it to to top/left corner
|
|
||||||
frame.offsetTo((int) (-crop.left / scaleX), (int) (-crop.top / scaleY));
|
|
||||||
|
|
||||||
// However, we also need to make space for the navigation bar on the left side.
|
// However, we also need to make space for the navigation bar on the left side.
|
||||||
final int colorViewLeftInset = getColorViewLeftInset(mStableInsets.left,
|
final int colorViewLeftInset = getColorViewLeftInset(mStableInsets.left,
|
||||||
mContentInsets.left);
|
mContentInsets.left);
|
||||||
|
|||||||
@@ -180,12 +180,18 @@ public class TaskSnapshotSurfaceTest extends WindowTestsBase {
|
|||||||
assertEquals(new Rect(0, 0, 90, 100), mSurface.calculateSnapshotCrop());
|
assertEquals(new Rect(0, 0, 90, 100), mSurface.calculateSnapshotCrop());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCalculateSnapshotCrop_waterfall() {
|
||||||
|
setupSurface(100, 100, new Rect(5, 10, 5, 10), 0, 0, new Rect(0, 0, 100, 100));
|
||||||
|
assertEquals(new Rect(5, 0, 95, 90), mSurface.calculateSnapshotCrop());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCalculateSnapshotFrame() {
|
public void testCalculateSnapshotFrame() {
|
||||||
setupSurface(100, 100);
|
setupSurface(100, 100);
|
||||||
final Rect insets = new Rect(0, 10, 0, 10);
|
final Rect insets = new Rect(0, 10, 0, 10);
|
||||||
mSurface.setFrames(new Rect(0, 0, 100, 100), insets, insets);
|
mSurface.setFrames(new Rect(0, 0, 100, 100), insets, insets);
|
||||||
assertEquals(new Rect(0, -10, 100, 70),
|
assertEquals(new Rect(0, 0, 100, 80),
|
||||||
mSurface.calculateSnapshotFrame(new Rect(0, 10, 100, 90)));
|
mSurface.calculateSnapshotFrame(new Rect(0, 10, 100, 90)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,10 +200,19 @@ public class TaskSnapshotSurfaceTest extends WindowTestsBase {
|
|||||||
setupSurface(100, 100);
|
setupSurface(100, 100);
|
||||||
final Rect insets = new Rect(10, 10, 0, 0);
|
final Rect insets = new Rect(10, 10, 0, 0);
|
||||||
mSurface.setFrames(new Rect(0, 0, 100, 100), insets, insets);
|
mSurface.setFrames(new Rect(0, 0, 100, 100), insets, insets);
|
||||||
assertEquals(new Rect(0, -10, 90, 80),
|
assertEquals(new Rect(10, 0, 100, 90),
|
||||||
mSurface.calculateSnapshotFrame(new Rect(10, 10, 100, 100)));
|
mSurface.calculateSnapshotFrame(new Rect(10, 10, 100, 100)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCalculateSnapshotFrame_waterfall() {
|
||||||
|
setupSurface(100, 100, new Rect(5, 10, 5, 10), 0, 0, new Rect(0, 0, 100, 100));
|
||||||
|
final Rect insets = new Rect(0, 10, 0, 10);
|
||||||
|
mSurface.setFrames(new Rect(5, 0, 95, 100), insets, insets);
|
||||||
|
assertEquals(new Rect(0, 0, 90, 90),
|
||||||
|
mSurface.calculateSnapshotFrame(new Rect(5, 0, 95, 90)));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDrawStatusBarBackground() {
|
public void testDrawStatusBarBackground() {
|
||||||
setupSurface(100, 100);
|
setupSurface(100, 100);
|
||||||
|
|||||||
Reference in New Issue
Block a user