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

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

Merge "[VRR] Fix the scrolling not work in Contacts issue" into main

parents 787bff4e c68a826a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33989,7 +33989,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
                || mLastFrameTop != mTop)
                && viewRootImpl.shouldCheckFrameRateCategory()
                && parent instanceof View
                && ((View) parent).mFrameContentVelocity <= 0
                && ((View) parent).getFrameContentVelocity() <= 0
                && !isInputMethodWindowType) {
            return FRAME_RATE_CATEGORY_HIGH_HINT | FRAME_RATE_CATEGORY_REASON_BOOST;
+15 −0
Original line number Diff line number Diff line
@@ -15,7 +15,10 @@
 */
package android.view;

import static android.view.flags.Flags.FLAG_VIEW_VELOCITY_API;

import android.animation.LayoutTransition;
import android.annotation.FlaggedApi;
import android.annotation.NonNull;
import android.compat.annotation.UnsupportedAppUsage;
import android.content.Context;
@@ -365,6 +368,18 @@ public class ViewOverlay {
            }
            return null;
        }

        /**
         * @hide
         */
        @Override
        @FlaggedApi(FLAG_VIEW_VELOCITY_API)
        public float getFrameContentVelocity() {
            if (mHostView != null) {
                return mHostView.getFrameContentVelocity();
            }
            return super.getFrameContentVelocity();
        }
    }

}
+1 −1
Original line number Diff line number Diff line
@@ -13012,7 +13012,7 @@ public final class ViewRootImpl implements ViewParent,
    private boolean shouldSetFrameRateCategory() {
        // use toolkitSetFrameRate flag to gate the change
        return shouldEnableDvrr() && mSurface.isValid() && shouldEnableDvrr();
        return shouldEnableDvrr() && mSurface.isValid();
    }
    private boolean shouldSetFrameRate() {
+29 −0
Original line number Diff line number Diff line
@@ -994,6 +994,35 @@ public class ViewFrameRateTest {
                mViewRoot.getLastPreferredFrameRateCategory());
    }

    /**
     * If a View is an instance of ViewGroupOverlay,
     * we obtain the velocity from its hostView.
     */
    @Test
    @RequiresFlagsEnabled(FLAG_VIEW_VELOCITY_API)
    public void overlayViewGroupVelocity() throws Throwable {
        if (!ViewProperties.vrr_enabled().orElse(true)) {
            return;
        }

        FrameLayout host = new FrameLayout(mActivity);
        View childView = new View(mActivity);
        float velocity = 1000;

        mActivityRule.runOnUiThread(() -> {
            ViewGroup.LayoutParams fullSize = new ViewGroup.LayoutParams(
                    ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT);
            mActivity.setContentView(host, fullSize);
            host.setFrameContentVelocity(velocity);
            ViewGroupOverlay overlay = host.getOverlay();
            overlay.add(childView);
            assertEquals(velocity, host.getFrameContentVelocity());
            assertEquals(host.getFrameContentVelocity(),
                    ((View) childView.getParent()).getFrameContentVelocity());
        });
    }

    private void runAfterDraw(@NonNull Runnable runnable) {
        Handler handler = new Handler(Looper.getMainLooper());
        mAfterDrawLatch = new CountDownLatch(1);