Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bc3c7592 authored by Nader Jawad's avatar Nader Jawad
Browse files

Updated UnsupportedAppUsage annotation usage on setAlphaNoInvalidation

Restricted access to setAlphaNoInvalidation method on View class.
Consumers should be able to handle the same functionality by leveraging
the onSetAlpha method within a View subclass. Removed usages of
setAlphaNoInvalidation within ViewPropertyAnimator.

Change-Id: Ieab3d54313972051484ac591b6f4329d3ae7b0cc
Fixes: 123768435
Test: Re-ran CtsAnimationTestCases
parent f9a25e52
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -16068,7 +16068,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
     * @return true if the View subclass handles alpha (the return value for onSetAlpha()) and
     *         the new value for the alpha property is different from the old value
     */
    @UnsupportedAppUsage
    @UnsupportedAppUsage(maxTargetSdk  = Build.VERSION_CODES.P, trackingBug = 123768435)
    boolean setAlphaNoInvalidation(float alpha) {
        ensureTransformationInfo();
        if (mTransformationInfo.mAlpha != alpha) {
+3 −18
Original line number Diff line number Diff line
@@ -1139,12 +1139,6 @@ public class ViewPropertyAnimator {

            boolean hardwareAccelerated = mView.isHardwareAccelerated();

            // alpha requires slightly different treatment than the other (transform) properties.
            // The logic in setAlpha() is not simply setting mAlpha, plus the invalidation
            // logic is dependent on how the view handles an internal call to onSetAlpha().
            // We track what kinds of properties are set, and how alpha is handled when it is
            // set, and perform the invalidation steps appropriately.
            boolean alphaHandled = false;
            if (!hardwareAccelerated) {
                mView.invalidateParentCaches();
            }
@@ -1159,25 +1153,16 @@ public class ViewPropertyAnimator {
                for (int i = 0; i < count; ++i) {
                    NameValuesHolder values = valueList.get(i);
                    float value = values.mFromValue + fraction * values.mDeltaValue;
                    if (values.mNameConstant == ALPHA) {
                        alphaHandled = mView.setAlphaNoInvalidation(value);
                    } else {
                    setValue(values.mNameConstant, value);
                }
            }
            }
            if ((propertyMask & TRANSFORM_MASK) != 0) {
                if (!hardwareAccelerated) {
                    mView.mPrivateFlags |= View.PFLAG_DRAWN; // force another invalidation
                }
            }
            // invalidate(false) in all cases except if alphaHandled gets set to true
            // via the call to setAlphaNoInvalidation(), above
            if (alphaHandled) {
                mView.invalidate(true);
            } else {

            mView.invalidateViewProperty(false, false);
            }
            if (mUpdateListener != null) {
                mUpdateListener.onAnimationUpdate(animation);
            }