@@ -2129,27 +2129,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
21292129 */
21302130 static final int ACCESSIBILITY_STATE_CHANGED = 0x00000080 << IMPORTANT_FOR_ACCESSIBILITY_SHIFT;
21312131
2132- /**
2133- * Flag indicating that view has an animation set on it. This is used to track whether an
2134- * animation is cleared between successive frames, in order to tell the associated
2135- * DisplayList to clear its animation matrix.
2136- */
2137- static final int VIEW_IS_ANIMATING_TRANSFORM = 0x10000000;
2138-
21392132 /**
21402133 * Flag indicating whether a view failed the quickReject() check in draw(). This condition
21412134 * is used to check whether later changes to the view's transform should invalidate the
21422135 * view to force the quickReject test to run again.
21432136 */
2144- static final int VIEW_QUICK_REJECTED = 0x20000000 ;
2137+ static final int VIEW_QUICK_REJECTED = 0x10000000 ;
21452138
21462139 // Accessiblity constants for mPrivateFlags2
21472140
21482141 /**
21492142 * Shift for the bits in {@link #mPrivateFlags2} related to the
21502143 * "accessibilityFocusable" attribute.
21512144 */
2152- static final int ACCESSIBILITY_FOCUSABLE_SHIFT = 30 ;
2145+ static final int ACCESSIBILITY_FOCUSABLE_SHIFT = 29 ;
21532146
21542147 /**
21552148 * The system determines whether the view can take accessibility focus - default (recommended).
@@ -2211,6 +2204,25 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
22112204
22122205 /* End of masks for mPrivateFlags2 */
22132206
2207+ /* Masks for mPrivateFlags3 */
2208+
2209+ /**
2210+ * Flag indicating that view has a transform animation set on it. This is used to track whether
2211+ * an animation is cleared between successive frames, in order to tell the associated
2212+ * DisplayList to clear its animation matrix.
2213+ */
2214+ static final int VIEW_IS_ANIMATING_TRANSFORM = 0x1;
2215+
2216+ /**
2217+ * Flag indicating that view has an alpha animation set on it. This is used to track whether an
2218+ * animation is cleared between successive frames, in order to tell the associated
2219+ * DisplayList to restore its alpha value.
2220+ */
2221+ static final int VIEW_IS_ANIMATING_ALPHA = 0x2;
2222+
2223+
2224+ /* End of masks for mPrivateFlags3 */
2225+
22142226 static final int DRAG_MASK = DRAG_CAN_ACCEPT | DRAG_HOVERED;
22152227
22162228 /**
@@ -2591,6 +2603,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
25912603 })
25922604 int mPrivateFlags;
25932605 int mPrivateFlags2;
2606+ int mPrivateFlags3;
25942607
25952608 /**
25962609 * This view's request for the visibility of the status bar.
@@ -13041,15 +13054,15 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1304113054 more = drawAnimation(parent, drawingTime, a, scalingRequired);
1304213055 concatMatrix = a.willChangeTransformationMatrix();
1304313056 if (concatMatrix) {
13044- mPrivateFlags2 |= VIEW_IS_ANIMATING_TRANSFORM;
13057+ mPrivateFlags3 |= VIEW_IS_ANIMATING_TRANSFORM;
1304513058 }
1304613059 transformToApply = parent.mChildTransformation;
1304713060 } else {
13048- if ((mPrivateFlags2 & VIEW_IS_ANIMATING_TRANSFORM) == VIEW_IS_ANIMATING_TRANSFORM &&
13061+ if ((mPrivateFlags3 & VIEW_IS_ANIMATING_TRANSFORM) == VIEW_IS_ANIMATING_TRANSFORM &&
1304913062 mDisplayList != null) {
1305013063 // No longer animating: clear out old animation matrix
1305113064 mDisplayList.setAnimationMatrix(null);
13052- mPrivateFlags2 &= ~VIEW_IS_ANIMATING_TRANSFORM;
13065+ mPrivateFlags3 &= ~VIEW_IS_ANIMATING_TRANSFORM;
1305313066 }
1305413067 if (!useDisplayListProperties &&
1305513068 (flags & ViewGroup.FLAG_SUPPORT_STATIC_TRANSFORMATIONS) != 0) {
@@ -13161,7 +13174,8 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1316113174 }
1316213175
1316313176 float alpha = useDisplayListProperties ? 1 : getAlpha();
13164- if (transformToApply != null || alpha < 1 || !hasIdentityMatrix()) {
13177+ if (transformToApply != null || alpha < 1 || !hasIdentityMatrix() ||
13178+ (mPrivateFlags3 & VIEW_IS_ANIMATING_ALPHA) == VIEW_IS_ANIMATING_ALPHA) {
1316513179 if (transformToApply != null || !childHasIdentityMatrix) {
1316613180 int transX = 0;
1316713181 int transY = 0;
@@ -13187,7 +13201,7 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1318713201
1318813202 float transformAlpha = transformToApply.getAlpha();
1318913203 if (transformAlpha < 1) {
13190- alpha *= transformToApply.getAlpha() ;
13204+ alpha *= transformAlpha ;
1319113205 parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
1319213206 }
1319313207 }
@@ -13199,7 +13213,14 @@ boolean draw(Canvas canvas, ViewGroup parent, long drawingTime) {
1319913213 }
1320013214 }
1320113215
13202- if (alpha < 1) {
13216+ // Deal with alpha if it is or used to be <1
13217+ if (alpha < 1 ||
13218+ (mPrivateFlags3 & VIEW_IS_ANIMATING_ALPHA) == VIEW_IS_ANIMATING_ALPHA) {
13219+ if (alpha < 1) {
13220+ mPrivateFlags3 |= VIEW_IS_ANIMATING_ALPHA;
13221+ } else {
13222+ mPrivateFlags3 &= ~VIEW_IS_ANIMATING_ALPHA;
13223+ }
1320313224 parent.mGroupFlags |= ViewGroup.FLAG_CLEAR_TRANSFORMATION;
1320413225 if (hasNoCache) {
1320513226 final int multipliedAlpha = (int) (255 * alpha);
0 commit comments