Loading services/core/java/com/android/server/wm/WindowAnimationSpec.java +4 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,10 @@ public class WindowAnimationSpec implements AnimationSpec { if (mStackClipMode == STACK_CLIP_NONE) { t.setWindowCrop(leash, tmp.transformation.getClipRect()); } else if (mStackClipMode == STACK_CLIP_AFTER_ANIM) { t.setFinalCrop(leash, mStackBounds); mTmpRect.set(mStackBounds); // Offset stack bounds to stack position so the final crop is in screen space. mTmpRect.offsetTo(mPosition.x, mPosition.y); t.setFinalCrop(leash, mTmpRect); t.setWindowCrop(leash, tmp.transformation.getClipRect()); } else { mTmpRect.set(mStackBounds); Loading services/tests/servicestests/src/com/android/server/wm/WindowAnimationSpecTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import android.graphics.Point; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; import android.support.test.filters.SmallTest; Loading Loading @@ -71,6 +72,19 @@ public class WindowAnimationSpecTest { argThat(rect -> rect.equals(mStackBounds))); } @Test public void testApply_clipAfterOffsetPosition() { // Stack bounds is (0, 0, 10, 10) position is (20, 40) WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(mAnimation, new Point(20, 40), mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_AFTER_ANIM); windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0); verify(mTransaction).setWindowCrop(eq(mSurfaceControl), argThat(Rect::isEmpty)); verify(mTransaction).setFinalCrop(eq(mSurfaceControl), argThat(rect -> rect.left == 20 && rect.top == 40 && rect.right == 30 && rect.bottom == 50)); } @Test public void testApply_clipBeforeNoAnimationBounds() { // Stack bounds is (0, 0, 10, 10) animation clip is (0, 0, 0, 0) Loading Loading
services/core/java/com/android/server/wm/WindowAnimationSpec.java +4 −1 Original line number Diff line number Diff line Loading @@ -89,7 +89,10 @@ public class WindowAnimationSpec implements AnimationSpec { if (mStackClipMode == STACK_CLIP_NONE) { t.setWindowCrop(leash, tmp.transformation.getClipRect()); } else if (mStackClipMode == STACK_CLIP_AFTER_ANIM) { t.setFinalCrop(leash, mStackBounds); mTmpRect.set(mStackBounds); // Offset stack bounds to stack position so the final crop is in screen space. mTmpRect.offsetTo(mPosition.x, mPosition.y); t.setFinalCrop(leash, mTmpRect); t.setWindowCrop(leash, tmp.transformation.getClipRect()); } else { mTmpRect.set(mStackBounds); Loading
services/tests/servicestests/src/com/android/server/wm/WindowAnimationSpecTest.java +14 −0 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import android.graphics.Point; import android.graphics.Rect; import android.platform.test.annotations.Presubmit; import android.support.test.filters.SmallTest; Loading Loading @@ -71,6 +72,19 @@ public class WindowAnimationSpecTest { argThat(rect -> rect.equals(mStackBounds))); } @Test public void testApply_clipAfterOffsetPosition() { // Stack bounds is (0, 0, 10, 10) position is (20, 40) WindowAnimationSpec windowAnimationSpec = new WindowAnimationSpec(mAnimation, new Point(20, 40), mStackBounds, false /* canSkipFirstFrame */, STACK_CLIP_AFTER_ANIM); windowAnimationSpec.apply(mTransaction, mSurfaceControl, 0); verify(mTransaction).setWindowCrop(eq(mSurfaceControl), argThat(Rect::isEmpty)); verify(mTransaction).setFinalCrop(eq(mSurfaceControl), argThat(rect -> rect.left == 20 && rect.top == 40 && rect.right == 30 && rect.bottom == 50)); } @Test public void testApply_clipBeforeNoAnimationBounds() { // Stack bounds is (0, 0, 10, 10) animation clip is (0, 0, 0, 0) Loading