Loading libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentAnimationAdapter.java +18 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ class TaskFragmentAnimationAdapter { final Transformation mTransformation = new Transformation(); final float[] mMatrix = new float[9]; final float[] mVecs = new float[4]; final Rect mRect = new Rect(); private boolean mIsFirstFrame = true; TaskFragmentAnimationAdapter(@NonNull Animation animation, Loading Loading @@ -76,6 +78,22 @@ class TaskFragmentAnimationAdapter { mTarget.localBounds.left, mTarget.localBounds.top); t.setMatrix(mLeash, mTransformation.getMatrix(), mMatrix); t.setAlpha(mLeash, mTransformation.getAlpha()); // Open/close animation may scale up the surface. Apply an inverse scale to the window crop // so that it will not be covering other windows. mVecs[1] = mVecs[2] = 0; mVecs[0] = mVecs[3] = 1; mTransformation.getMatrix().mapVectors(mVecs); mVecs[0] = 1.f / mVecs[0]; mVecs[3] = 1.f / mVecs[3]; final Rect clipRect = mTarget.localBounds; mRect.left = (int) (clipRect.left * mVecs[0] + 0.5f); mRect.right = (int) (clipRect.right * mVecs[0] + 0.5f); mRect.top = (int) (clipRect.top * mVecs[3] + 0.5f); mRect.bottom = (int) (clipRect.bottom * mVecs[3] + 0.5f); mRect.offsetTo(Math.round(mTarget.localBounds.width() * (1 - mVecs[0]) / 2.f), Math.round(mTarget.localBounds.height() * (1 - mVecs[3]) / 2.f)); t.setWindowCrop(mLeash, mRect); } /** Called after animation finished. */ Loading Loading @@ -157,8 +175,6 @@ class TaskFragmentAnimationAdapter { * Should be used for the animation of the {@link RemoteAnimationTarget} that has size change. */ static class BoundsChangeAdapter extends TaskFragmentAnimationAdapter { private final float[] mVecs = new float[4]; private final Rect mRect = new Rect(); BoundsChangeAdapter(@NonNull Animation animation, @NonNull RemoteAnimationTarget target) { super(animation, target); Loading Loading
libs/WindowManager/Jetpack/src/androidx/window/extensions/embedding/TaskFragmentAnimationAdapter.java +18 −2 Original line number Diff line number Diff line Loading @@ -39,6 +39,8 @@ class TaskFragmentAnimationAdapter { final Transformation mTransformation = new Transformation(); final float[] mMatrix = new float[9]; final float[] mVecs = new float[4]; final Rect mRect = new Rect(); private boolean mIsFirstFrame = true; TaskFragmentAnimationAdapter(@NonNull Animation animation, Loading Loading @@ -76,6 +78,22 @@ class TaskFragmentAnimationAdapter { mTarget.localBounds.left, mTarget.localBounds.top); t.setMatrix(mLeash, mTransformation.getMatrix(), mMatrix); t.setAlpha(mLeash, mTransformation.getAlpha()); // Open/close animation may scale up the surface. Apply an inverse scale to the window crop // so that it will not be covering other windows. mVecs[1] = mVecs[2] = 0; mVecs[0] = mVecs[3] = 1; mTransformation.getMatrix().mapVectors(mVecs); mVecs[0] = 1.f / mVecs[0]; mVecs[3] = 1.f / mVecs[3]; final Rect clipRect = mTarget.localBounds; mRect.left = (int) (clipRect.left * mVecs[0] + 0.5f); mRect.right = (int) (clipRect.right * mVecs[0] + 0.5f); mRect.top = (int) (clipRect.top * mVecs[3] + 0.5f); mRect.bottom = (int) (clipRect.bottom * mVecs[3] + 0.5f); mRect.offsetTo(Math.round(mTarget.localBounds.width() * (1 - mVecs[0]) / 2.f), Math.round(mTarget.localBounds.height() * (1 - mVecs[3]) / 2.f)); t.setWindowCrop(mLeash, mRect); } /** Called after animation finished. */ Loading Loading @@ -157,8 +175,6 @@ class TaskFragmentAnimationAdapter { * Should be used for the animation of the {@link RemoteAnimationTarget} that has size change. */ static class BoundsChangeAdapter extends TaskFragmentAnimationAdapter { private final float[] mVecs = new float[4]; private final Rect mRect = new Rect(); BoundsChangeAdapter(@NonNull Animation animation, @NonNull RemoteAnimationTarget target) { super(animation, target); Loading