From c15c9ca54cb9b09b6c1d92eef3ffef810fe0fbea Mon Sep 17 00:00:00 2001 From: Andrey Kulikov Date: Tue, 12 Mar 2019 14:53:06 +0000 Subject: Introduce View.getAnimationMatrix() Adding a corresponding getter for the recently opened View.setAnimationMatrix(Matrix). Bug: 126376184 Test: new cts tests added Change-Id: I9d5abb1ae3606d2e3884859ce9a81c11c65613d6 --- graphics/java/android/graphics/RenderNode.java | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'graphics/java/android') diff --git a/graphics/java/android/graphics/RenderNode.java b/graphics/java/android/graphics/RenderNode.java index 5e48ea1c98d8..760f83baec9b 100644 --- a/graphics/java/android/graphics/RenderNode.java +++ b/graphics/java/android/graphics/RenderNode.java @@ -808,13 +808,36 @@ public final class RenderNode { * for the matrix parameter. * * @param matrix The matrix, null indicates that the matrix should be cleared. + * @see #getAnimationMatrix() + * * @hide TODO Do we want this? */ - public boolean setAnimationMatrix(Matrix matrix) { + public boolean setAnimationMatrix(@Nullable Matrix matrix) { return nSetAnimationMatrix(mNativeRenderNode, (matrix != null) ? matrix.native_instance : 0); } + /** + * Returns the previously set Animation matrix. This matrix exists if an Animation is + * currently playing on a View, and is set on the display list during at draw() time. + * Returns null when there is no transformation provided by + * {@link #setAnimationMatrix(Matrix)}. + * + * @return the current Animation matrix. + * @see #setAnimationMatrix(Matrix) + * + * @hide + */ + @Nullable + public Matrix getAnimationMatrix() { + Matrix output = new Matrix(); + if (nGetAnimationMatrix(mNativeRenderNode, output.native_instance)) { + return output; + } else { + return null; + } + } + /** * Sets the translucency level for the display list. * @@ -1659,6 +1682,9 @@ public final class RenderNode { @CriticalNative private static native boolean nHasOverlappingRendering(long renderNode); + @CriticalNative + private static native boolean nGetAnimationMatrix(long renderNode, long animationMatrix); + @CriticalNative private static native boolean nGetClipToOutline(long renderNode); -- cgit v1.2.3-59-g8ed1b