Skip to content
Snippets Groups Projects
Commit 428629d5 authored by Jian-Syuan (Shane) Wong's avatar Jian-Syuan (Shane) Wong Committed by Android (Google) Code Review
Browse files

Merge "[VRR] Add sysprop to allow disabling View VRR frame rate check" into main

parents 319c7f0e 64bab3e8
No related branches found
No related tags found
No related merge requests found
......@@ -404,6 +404,7 @@ java_defaults {
"android.hardware.common.fmq-V1-java",
"bouncycastle-repackaged-unbundled",
"com.android.sysprop.foldlockbehavior",
"com.android.sysprop.view",
"framework-internal-utils",
// If MimeMap ever becomes its own APEX, then this dependency would need to be removed
// in favor of an API stubs dependency in java_library "framework" below.
......
......@@ -203,6 +203,7 @@ import android.os.Trace;
import android.os.UserHandle;
import android.provider.Settings;
import android.sysprop.DisplayProperties;
import android.sysprop.ViewProperties;
import android.text.TextUtils;
import android.util.AndroidRuntimeException;
import android.util.DisplayMetrics;
......@@ -1209,6 +1210,7 @@ public final class ViewRootImpl implements ViewParent,
Flags.enableInvalidateCheckThread();
private static boolean sSurfaceFlingerBugfixFlagValue =
com.android.graphics.surfaceflinger.flags.Flags.vrrBugfix24q4();
private static final boolean sEnableVrr = ViewProperties.vrr_enabled().orElse(true);
 
static {
sToolkitSetFrameRateReadOnlyFlagValue = toolkitSetFrameRateReadOnly();
......@@ -12924,13 +12926,13 @@ public final class ViewRootImpl implements ViewParent,
 
private boolean shouldSetFrameRateCategory() {
// use toolkitSetFrameRate flag to gate the change
return mSurface.isValid() && shouldEnableDvrr();
return shouldEnableDvrr() && mSurface.isValid() && shouldEnableDvrr();
}
 
private boolean shouldSetFrameRate() {
// use toolkitSetFrameRate flag to gate the change
return mSurface.isValid() && mPreferredFrameRate >= 0
&& shouldEnableDvrr() && !mIsFrameRateConflicted;
return shouldEnableDvrr() && mSurface.isValid() && mPreferredFrameRate >= 0
&& !mIsFrameRateConflicted;
}
 
private boolean shouldTouchBoost(int motionEventAction, int windowType) {
......@@ -12965,7 +12967,7 @@ public final class ViewRootImpl implements ViewParent,
* @param view The View with the ThreadedRenderer animation that started.
*/
public void addThreadedRendererView(View view) {
if (!mThreadedRendererViews.contains(view)) {
if (shouldEnableDvrr() && !mThreadedRendererViews.contains(view)) {
mThreadedRendererViews.add(view);
}
}
......@@ -12977,7 +12979,8 @@ public final class ViewRootImpl implements ViewParent,
*/
public void removeThreadedRendererView(View view) {
mThreadedRendererViews.remove(view);
if (!mInvalidationIdleMessagePosted && sSurfaceFlingerBugfixFlagValue) {
if (shouldEnableDvrr()
&& !mInvalidationIdleMessagePosted && sSurfaceFlingerBugfixFlagValue) {
mInvalidationIdleMessagePosted = true;
mHandler.sendEmptyMessageDelayed(MSG_CHECK_INVALIDATION_IDLE, IDLE_TIME_MILLIS);
}
......@@ -13198,7 +13201,7 @@ public final class ViewRootImpl implements ViewParent,
 
private boolean shouldEnableDvrr() {
// uncomment this when we are ready for enabling dVRR
if (sToolkitFrameRateViewEnablingReadOnlyFlagValue) {
if (sEnableVrr && sToolkitFrameRateViewEnablingReadOnlyFlagValue) {
return sToolkitSetFrameRateReadOnlyFlagValue && isFrameRatePowerSavingsBalanced();
}
return false;
......
......@@ -43,3 +43,10 @@ sysprop_library {
property_owner: "Platform",
api_packages: ["android.sysprop"],
}
sysprop_library {
name: "com.android.sysprop.view",
srcs: ["ViewProperties.sysprop"],
property_owner: "Platform",
api_packages: ["android.sysprop"],
}
# Copyright (C) 2024 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
module: "android.sysprop.ViewProperties"
owner: Platform
# On low-end devices, the cost of calculating frame rate can
# have noticeable overhead. These devices don't benefit from
# reduced frame rate as much as they benefit from reduced
# work. By setting this to false, the device won't do any
# VRR frame rate calculation for Views.
prop {
api_name: "vrr_enabled"
type: Boolean
prop_name: "ro.view.vrr.enabled"
scope: Internal
access: Readonly
}
......@@ -45,6 +45,7 @@ import android.platform.test.annotations.LargeTest;
import android.platform.test.annotations.RequiresFlagsEnabled;
import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.sysprop.ViewProperties;
import android.util.DisplayMetrics;
import android.widget.FrameLayout;
import android.widget.ProgressBar;
......@@ -101,6 +102,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_VIEW_VELOCITY_API,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void frameRateChangesWhenContentMoves() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
waitForFrameRateCategoryToSettle();
mActivityRule.runOnUiThread(() -> {
mMovingView.offsetLeftAndRight(100);
......@@ -127,6 +131,9 @@ public class ViewFrameRateTest {
@Test
@RequiresFlagsEnabled(FLAG_VIEW_VELOCITY_API)
public void frameBoostDisable() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mActivityRule.runOnUiThread(() -> {
long now = SystemClock.uptimeMillis();
MotionEvent down = MotionEvent.obtain(
......@@ -155,6 +162,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VELOCITY_MAPPING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void lowVelocity60() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mActivityRule.runOnUiThread(() -> {
ViewGroup.LayoutParams layoutParams = mMovingView.getLayoutParams();
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
......@@ -175,6 +185,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VELOCITY_MAPPING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void velocityWithChildMovement() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
FrameLayout frameLayout = new FrameLayout(mActivity);
mActivityRule.runOnUiThread(() -> {
ViewGroup.LayoutParams fullSize = new ViewGroup.LayoutParams(
......@@ -201,6 +214,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VELOCITY_MAPPING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void highVelocity120() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mActivityRule.runOnUiThread(() -> {
ViewGroup.LayoutParams layoutParams = mMovingView.getLayoutParams();
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
......@@ -222,6 +238,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void noVelocityUsesCategorySmall() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final CountDownLatch drawLatch1 = new CountDownLatch(1);
mActivityRule.runOnUiThread(() -> {
DisplayMetrics displayMetrics = mActivity.getResources().getDisplayMetrics();
......@@ -259,6 +278,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void noVelocityUsesCategoryNarrowWidth() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final CountDownLatch drawLatch1 = new CountDownLatch(1);
mActivityRule.runOnUiThread(() -> {
DisplayMetrics displayMetrics = mActivity.getResources().getDisplayMetrics();
......@@ -295,6 +317,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void noVelocityUsesCategoryNarrowHeight() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final CountDownLatch drawLatch1 = new CountDownLatch(1);
mActivityRule.runOnUiThread(() -> {
DisplayMetrics displayMetrics = mActivity.getResources().getDisplayMetrics();
......@@ -331,6 +356,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void noVelocityUsesCategoryLargeWidth() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final CountDownLatch drawLatch1 = new CountDownLatch(1);
mActivityRule.runOnUiThread(() -> {
DisplayMetrics displayMetrics = mActivity.getResources().getDisplayMetrics();
......@@ -367,6 +395,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void noVelocityUsesCategoryLargeHeight() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final CountDownLatch drawLatch1 = new CountDownLatch(1);
mActivityRule.runOnUiThread(() -> {
DisplayMetrics displayMetrics = mActivity.getResources().getDisplayMetrics();
......@@ -403,6 +434,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void defaultNormal() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mActivityRule.runOnUiThread(() -> {
View parent = (View) mMovingView.getParent();
ViewGroup.LayoutParams layoutParams = mMovingView.getLayoutParams();
......@@ -427,6 +461,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VELOCITY_MAPPING_READ_ONLY
})
public void frameRateAndCategory() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE);
waitForFrameRateCategoryToSettle();
mActivityRule.runOnUiThread(() -> {
......@@ -447,6 +484,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY
})
public void willNotDrawUsesCategory() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mActivityRule.runOnUiThread(() -> {
mMovingView.setWillNotDraw(true);
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_LOW);
......@@ -480,6 +520,9 @@ public class ViewFrameRateTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void intermittentDoubleInvalidate() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
View parent = (View) mMovingView.getParent();
mActivityRule.runOnUiThread(() -> {
parent.setWillNotDraw(false);
......@@ -526,6 +569,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY
})
public void sameFrameMotion() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE);
waitForFrameRateCategoryToSettle();
......@@ -549,6 +595,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY
})
public void frameRateReset() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mMovingView.setRequestedFrameRate(120f);
waitForFrameRateCategoryToSettle();
mActivityRule.runOnUiThread(() -> mMovingView.setVisibility(View.INVISIBLE));
......@@ -570,6 +619,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY
})
public void frameRateResetWithInvalidations() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mMovingView.setRequestedFrameRate(120f);
waitForFrameRateCategoryToSettle();
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_NORMAL);
......@@ -590,6 +642,9 @@ public class ViewFrameRateTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY
})
public void testQuickTouchBoost() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mActivityRule.runOnUiThread(() -> {
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_LOW);
ViewGroup.LayoutParams layoutParams = mMovingView.getLayoutParams();
......@@ -630,6 +685,9 @@ public class ViewFrameRateTest {
com.android.graphics.surfaceflinger.flags.Flags.FLAG_VRR_BUGFIX_24Q4
})
public void idleDetected() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
waitForFrameRateCategoryToSettle();
mActivityRule.runOnUiThread(() -> {
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_HIGH);
......@@ -654,6 +712,9 @@ public class ViewFrameRateTest {
com.android.graphics.surfaceflinger.flags.Flags.FLAG_VRR_BUGFIX_24Q4
})
public void vectorDrawableFrameRate() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final ProgressBar[] progressBars = new ProgressBar[3];
final ViewGroup[] parents = new ViewGroup[1];
mActivityRule.runOnUiThread(() -> {
......@@ -711,6 +772,9 @@ public class ViewFrameRateTest {
com.android.graphics.surfaceflinger.flags.Flags.FLAG_VRR_BUGFIX_24Q4
})
public void renderNodeAnimatorFrameRateCanceled() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE);
waitForFrameRateCategoryToSettle();
......@@ -748,6 +812,9 @@ public class ViewFrameRateTest {
com.android.graphics.surfaceflinger.flags.Flags.FLAG_VRR_BUGFIX_24Q4
})
public void renderNodeAnimatorFrameRateRemoved() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mMovingView.setRequestedFrameRate(View.REQUESTED_FRAME_RATE_CATEGORY_NO_PREFERENCE);
waitForFrameRateCategoryToSettle();
......
......@@ -72,6 +72,7 @@ import android.platform.test.flag.junit.CheckFlagsRule;
import android.platform.test.flag.junit.DeviceFlagsValueProvider;
import android.platform.test.flag.junit.SetFlagsRule;
import android.provider.Settings;
import android.sysprop.ViewProperties;
import android.util.DisplayMetrics;
import android.util.Log;
import android.view.WindowInsets.Side;
......@@ -503,6 +504,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_getDefaultValues() {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
ViewRootImpl viewRootImpl = new ViewRootImpl(sContext,
sContext.getDisplayNoVerify());
assertEquals(FRAME_RATE_CATEGORY_DEFAULT,
......@@ -521,6 +525,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_BY_SIZE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_visibility_bySize() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
attachViewToWindow(mView);
mViewRootImpl = mView.getViewRootImpl();
......@@ -558,6 +565,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_BY_SIZE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_smallSize_bySize() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -590,6 +600,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_BY_SIZE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_normalSize_bySize() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -627,6 +640,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_visibility_defaultHigh()
throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -688,6 +704,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_smallSize_defaultHigh()
throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -723,6 +742,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_normalSize_defaultHigh()
throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -758,6 +780,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_aggregate() {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
attachViewToWindow(mView);
mViewRootImpl = mView.getViewRootImpl();
......@@ -804,6 +829,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRate_aggregate() {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
attachViewToWindow(mView);
mViewRootImpl = mView.getViewRootImpl();
......@@ -876,6 +904,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_FUNCTION_ENABLING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRate_category() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
attachViewToWindow(mView);
sInstrumentation.waitForIdleSync();
......@@ -930,6 +961,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_FUNCTION_ENABLING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateCategory_velocityToHigh() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -973,6 +1007,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_insetsAnimation() {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
WindowManager.LayoutParams wmlp = new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
wmlp.token = new Binder(); // Set a fake token to bypass 'is your activity running' check
......@@ -1010,6 +1047,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_frameRateBoostOnTouch() {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
attachViewToWindow(mView);
sInstrumentation.waitForIdleSync();
......@@ -1043,6 +1083,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateTimeOut() throws InterruptedException {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final long delay = 200L;
mView = new View(sContext);
......@@ -1082,6 +1125,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_FUNCTION_ENABLING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_voteFrameRateOnly() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
float frameRate = 20;
attachViewToWindow(mView);
......@@ -1133,6 +1179,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_FUNCTION_ENABLING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_infrequentLayer_defaultHigh() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final long delay = 200L;
mView = new View(sContext);
......@@ -1211,6 +1260,9 @@ public class ViewRootImplTest {
@RequiresFlagsEnabled({FLAG_TOOLKIT_SET_FRAME_RATE_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_isFrameRatePowerSavingsBalanced() {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
attachViewToWindow(mView);
sInstrumentation.waitForIdleSync();
......@@ -1245,6 +1297,9 @@ public class ViewRootImplTest {
FLAG_TOOLKIT_FRAME_RATE_FUNCTION_ENABLING_READ_ONLY,
FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY})
public void votePreferredFrameRate_applyTextureViewHeuristic() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
final long delay = 30L;
mView = new TextureView(sContext);
......@@ -1289,6 +1344,9 @@ public class ViewRootImplTest {
@Test
@RequiresFlagsEnabled(FLAG_TOOLKIT_FRAME_RATE_VIEW_ENABLING_READ_ONLY)
public void votePreferredFrameRate_velocityVotedAfterOnDraw() throws Throwable {
if (!ViewProperties.vrr_enabled().orElse(true)) {
return;
}
mView = new View(sContext);
double delta = 0.1;
float pixelsPerSecond = 1000_000;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment