diff --git a/api/current.txt b/api/current.txt
index b9dd90698428c..47b71b6d9233b 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -1243,6 +1243,8 @@ package android {
field public static final int transition = 16843743; // 0x10103df
field public static final int transitionGroup = 16843803; // 0x101041b
field public static final int transitionOrdering = 16843744; // 0x10103e0
+ field public static final int translateX = 16843869; // 0x101045d
+ field public static final int translateY = 16843870; // 0x101045e
field public static final int translationX = 16843554; // 0x1010322
field public static final int translationY = 16843555; // 0x1010323
field public static final int translationZ = 16843796; // 0x1010414
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 0b72c2cb6c75a..e34730240974b 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -4790,6 +4790,14 @@
android:viewportHeight
* android:viewportWidth
*
<group>android:rotation
+ * android:pivotX
+ * android:pivotY
+ * android:scaleX
+ * android:scaleY
+ * android:translateX
+ * android:translateY
+ * <path>android:strokeOpacity
* android:rotation
- * android:pivotX
- * android:pivotY
- * android:fillOpacity
* android:trimPathStart
@@ -457,7 +467,13 @@ public class VectorDrawable extends Drawable {
mMatrix.reset();
- mMatrix.postRotate(vGroup.mRotate, vGroup.mPivotX, vGroup.mPivotY);
+ // The order we apply is the same as the
+ // RenderNode.cpp::applyViewPropertyTransforms().
+ mMatrix.postTranslate(-vGroup.mPivotX, -vGroup.mPivotY);
+ mMatrix.postScale(vGroup.mScaleX, vGroup.mScaleY);
+ mMatrix.postRotate(vGroup.mRotate, 0, 0);
+ mMatrix.postTranslate(vGroup.mTranslateX + vGroup.mPivotX, vGroup.mTranslateY + vGroup.mPivotY);
+
mMatrix.postScale(scale, scale, mViewportWidth / 2f, mViewportHeight / 2f);
mMatrix.postTranslate(w / 2f - mViewportWidth / 2f, h / 2f - mViewportHeight / 2f);
@@ -577,6 +593,10 @@ public class VectorDrawable extends Drawable {
private float mRotate = 0;
private float mPivotX = 0;
private float mPivotY = 0;
+ private float mScaleX = 1;
+ private float mScaleY = 1;
+ private float mTranslateX = 0;
+ private float mTranslateY = 0;
private int[] mThemeAttrs;
@@ -597,6 +617,10 @@ public class VectorDrawable extends Drawable {
mRotate = a.getFloat(R.styleable.VectorDrawableGroup_rotation, mRotate);
mPivotX = a.getFloat(R.styleable.VectorDrawableGroup_pivotX, mPivotX);
mPivotY = a.getFloat(R.styleable.VectorDrawableGroup_pivotY, mPivotY);
+ mScaleX = a.getFloat(R.styleable.VectorDrawableGroup_scaleX, mScaleX);
+ mScaleY = a.getFloat(R.styleable.VectorDrawableGroup_scaleY, mScaleY);
+ mTranslateX = a.getFloat(R.styleable.VectorDrawableGroup_translateX, mTranslateX);
+ mTranslateY = a.getFloat(R.styleable.VectorDrawableGroup_translateY, mTranslateY);
a.recycle();
}
@@ -620,6 +644,22 @@ public class VectorDrawable extends Drawable {
mPivotY = a.getFloat(R.styleable.VectorDrawableGroup_pivotY, mPivotY);
}
+ if (themeAttrs == null || themeAttrs[R.styleable.VectorDrawableGroup_scaleX] == 0) {
+ mScaleX = a.getFloat(R.styleable.VectorDrawableGroup_scaleX, mScaleX);
+ }
+
+ if (themeAttrs == null || themeAttrs[R.styleable.VectorDrawableGroup_scaleY] == 0) {
+ mScaleY = a.getFloat(R.styleable.VectorDrawableGroup_scaleY, mScaleY);
+ }
+
+ if (themeAttrs == null || themeAttrs[R.styleable.VectorDrawableGroup_translateX] == 0) {
+ mTranslateX = a.getFloat(R.styleable.VectorDrawableGroup_translateX, mTranslateX);
+ }
+
+ if (themeAttrs == null || themeAttrs[R.styleable.VectorDrawableGroup_translateY] == 0) {
+ mTranslateY = a.getFloat(R.styleable.VectorDrawableGroup_translateY, mTranslateY);
+ }
+
a.recycle();
}
diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml
index d0f2a2db366a8..66a9452d53800 100644
--- a/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml
+++ b/tests/VectorDrawableTest/res/drawable/vector_drawable01.xml
@@ -13,8 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-