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

Commit 4a5d0364 authored by Jian-Syuan (Shane) Wong's avatar Jian-Syuan (Shane) Wong Committed by Android (Google) Code Review
Browse files

Merge "Replace getVisibity and getAlpha function in getSizePercentage" into main

parents 12431035 4863ac4c
Loading
Loading
Loading
Loading
+22 −18
Original line number Diff line number Diff line
@@ -33056,7 +33056,10 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    }
    private float getSizePercentage() {
        if (mResources == null || getVisibility() != VISIBLE) {
        float alpha = mTransformationInfo != null ? mTransformationInfo.mAlpha : 1;
        int visibility = mViewFlags & VISIBILITY_MASK;
        if (mResources == null || alpha == 0 || visibility != VISIBLE) {
            return 0;
        }
@@ -33081,11 +33084,11 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
    private void votePreferredFrameRate() {
        // use toolkitSetFrameRate flag to gate the change
        if (sToolkitSetFrameRateReadOnlyFlagValue) {
            ViewRootImpl viewRootImpl = getViewRootImpl();
            float sizePercentage = getSizePercentage();
            int frameRateCateogry = calculateFrameRateCategory(sizePercentage);
        if (sToolkitSetFrameRateReadOnlyFlagValue && viewRootImpl != null
                && sizePercentage > 0) {
            if (viewRootImpl != null && sizePercentage > 0) {
                if (mPreferredFrameRate < 0) {
                    if (mPreferredFrameRate == REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE) {
                        frameRateCateogry = FRAME_RATE_CATEGORY_NO_PREFERENCE;
@@ -33102,6 +33105,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                viewRootImpl.votePreferredFrameRateCategory(frameRateCateogry);
            }
        }
    }
    /**
     * Set the current velocity of the View, we only track positive value.