Loading core/java/android/view/Choreographer.java +14 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public final class Choreographer { private long mLastFrameTimeNanos; private long mFrameIntervalNanos; private boolean mDebugPrintNextFrameTimeDelta; private int mFPSDivisor = 1; /** * Contains information about the current frame for jank-tracking, Loading Loading @@ -601,6 +602,11 @@ public final class Choreographer { } } void setFPSDivisor(int divisor) { if (divisor <= 0) divisor = 1; mFPSDivisor = divisor; } void doFrame(long frameTimeNanos, int frame) { final long startNanos; synchronized (mLock) { Loading Loading @@ -643,6 +649,14 @@ public final class Choreographer { return; } if (mFPSDivisor > 1) { long timeSinceVsync = frameTimeNanos - mLastFrameTimeNanos; if (timeSinceVsync < (mFrameIntervalNanos * mFPSDivisor) && timeSinceVsync > 0) { scheduleVsyncLocked(); return; } } mFrameInfo.setVsync(intendedFrameTimeNanos, frameTimeNanos); mFrameScheduled = false; mLastFrameTimeNanos = frameTimeNanos; Loading core/java/android/view/ThreadedRenderer.java +23 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,17 @@ public final class ThreadedRenderer { public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY = "debug.hwui.show_non_rect_clip"; /** * Sets the FPS devisor to lower the FPS. * * Sets a positive integer as a divisor. 1 (the default value) menas the full FPS, and 2 * means half the full FPS. * * * @hide */ public static final String DEBUG_FPS_DIVISOR = "debug.hwui.fps_divisor"; static { // Try to check OpenGL support early if possible. isAvailable(); Loading Loading @@ -955,6 +966,9 @@ public final class ThreadedRenderer { if (mInitialized) return; mInitialized = true; mAppContext = context.getApplicationContext(); // b/68769804: For low FPS experiments. setFPSDivisor(SystemProperties.getInt(DEBUG_FPS_DIVISOR, 1)); initSched(renderProxy); initGraphicsStats(); } Loading Loading @@ -1007,6 +1021,13 @@ public final class ThreadedRenderer { observer.mNative = null; } /** b/68769804: For low FPS experiments. */ public static void setFPSDivisor(int divisor) { if (divisor <= 0) divisor = 1; Choreographer.getInstance().setFPSDivisor(divisor); nHackySetRTAnimationsEnabled(divisor == 1); } /** Not actually public - internal use only. This doc to make lint happy */ public static native void disableVsync(); Loading Loading @@ -1075,4 +1096,6 @@ public final class ThreadedRenderer { private static native Bitmap nCreateHardwareBitmap(long renderNode, int width, int height); private static native void nSetHighContrastText(boolean enabled); // For temporary experimentation b/66945974 private static native void nHackySetRTAnimationsEnabled(boolean enabled); } core/jni/android_view_ThreadedRenderer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -937,6 +937,11 @@ static void android_view_ThreadedRenderer_setHighContrastText(JNIEnv*, jclass, j Properties::enableHighContrastText = enable; } static void android_view_ThreadedRenderer_hackySetRTAnimationsEnabled(JNIEnv*, jclass, jboolean enable) { Properties::enableRTAnimations = enable; } // ---------------------------------------------------------------------------- // FrameMetricsObserver // ---------------------------------------------------------------------------- Loading Loading @@ -1041,6 +1046,8 @@ static const JNINativeMethod gMethods[] = { (void*)android_view_ThreadedRenderer_createHardwareBitmapFromRenderNode }, { "disableVsync", "()V", (void*)android_view_ThreadedRenderer_disableVsync }, { "nSetHighContrastText", "(Z)V", (void*)android_view_ThreadedRenderer_setHighContrastText }, { "nHackySetRTAnimationsEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled }, }; static JavaVM* mJvm = nullptr; Loading libs/hwui/Properties.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ bool Properties::forceDrawFrame = false; bool Properties::filterOutTestOverhead = false; bool Properties::disableVsync = false; bool Properties::skpCaptureEnabled = false; bool Properties::enableRTAnimations = true; static int property_get_int(const char* key, int defaultValue) { char buf[PROPERTY_VALUE_MAX] = { Loading libs/hwui/Properties.h +3 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,9 @@ public: static bool skpCaptureEnabled; // For experimentation b/68769804 ANDROID_API static bool enableRTAnimations; // Used for testing only to change the render pipeline. static void overrideRenderPipelineType(RenderPipelineType); Loading Loading
core/java/android/view/Choreographer.java +14 −0 Original line number Diff line number Diff line Loading @@ -164,6 +164,7 @@ public final class Choreographer { private long mLastFrameTimeNanos; private long mFrameIntervalNanos; private boolean mDebugPrintNextFrameTimeDelta; private int mFPSDivisor = 1; /** * Contains information about the current frame for jank-tracking, Loading Loading @@ -601,6 +602,11 @@ public final class Choreographer { } } void setFPSDivisor(int divisor) { if (divisor <= 0) divisor = 1; mFPSDivisor = divisor; } void doFrame(long frameTimeNanos, int frame) { final long startNanos; synchronized (mLock) { Loading Loading @@ -643,6 +649,14 @@ public final class Choreographer { return; } if (mFPSDivisor > 1) { long timeSinceVsync = frameTimeNanos - mLastFrameTimeNanos; if (timeSinceVsync < (mFrameIntervalNanos * mFPSDivisor) && timeSinceVsync > 0) { scheduleVsyncLocked(); return; } } mFrameInfo.setVsync(intendedFrameTimeNanos, frameTimeNanos); mFrameScheduled = false; mLastFrameTimeNanos = frameTimeNanos; Loading
core/java/android/view/ThreadedRenderer.java +23 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,17 @@ public final class ThreadedRenderer { public static final String DEBUG_SHOW_NON_RECTANGULAR_CLIP_PROPERTY = "debug.hwui.show_non_rect_clip"; /** * Sets the FPS devisor to lower the FPS. * * Sets a positive integer as a divisor. 1 (the default value) menas the full FPS, and 2 * means half the full FPS. * * * @hide */ public static final String DEBUG_FPS_DIVISOR = "debug.hwui.fps_divisor"; static { // Try to check OpenGL support early if possible. isAvailable(); Loading Loading @@ -955,6 +966,9 @@ public final class ThreadedRenderer { if (mInitialized) return; mInitialized = true; mAppContext = context.getApplicationContext(); // b/68769804: For low FPS experiments. setFPSDivisor(SystemProperties.getInt(DEBUG_FPS_DIVISOR, 1)); initSched(renderProxy); initGraphicsStats(); } Loading Loading @@ -1007,6 +1021,13 @@ public final class ThreadedRenderer { observer.mNative = null; } /** b/68769804: For low FPS experiments. */ public static void setFPSDivisor(int divisor) { if (divisor <= 0) divisor = 1; Choreographer.getInstance().setFPSDivisor(divisor); nHackySetRTAnimationsEnabled(divisor == 1); } /** Not actually public - internal use only. This doc to make lint happy */ public static native void disableVsync(); Loading Loading @@ -1075,4 +1096,6 @@ public final class ThreadedRenderer { private static native Bitmap nCreateHardwareBitmap(long renderNode, int width, int height); private static native void nSetHighContrastText(boolean enabled); // For temporary experimentation b/66945974 private static native void nHackySetRTAnimationsEnabled(boolean enabled); }
core/jni/android_view_ThreadedRenderer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -937,6 +937,11 @@ static void android_view_ThreadedRenderer_setHighContrastText(JNIEnv*, jclass, j Properties::enableHighContrastText = enable; } static void android_view_ThreadedRenderer_hackySetRTAnimationsEnabled(JNIEnv*, jclass, jboolean enable) { Properties::enableRTAnimations = enable; } // ---------------------------------------------------------------------------- // FrameMetricsObserver // ---------------------------------------------------------------------------- Loading Loading @@ -1041,6 +1046,8 @@ static const JNINativeMethod gMethods[] = { (void*)android_view_ThreadedRenderer_createHardwareBitmapFromRenderNode }, { "disableVsync", "()V", (void*)android_view_ThreadedRenderer_disableVsync }, { "nSetHighContrastText", "(Z)V", (void*)android_view_ThreadedRenderer_setHighContrastText }, { "nHackySetRTAnimationsEnabled", "(Z)V", (void*)android_view_ThreadedRenderer_hackySetRTAnimationsEnabled }, }; static JavaVM* mJvm = nullptr; Loading
libs/hwui/Properties.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -59,6 +59,7 @@ bool Properties::forceDrawFrame = false; bool Properties::filterOutTestOverhead = false; bool Properties::disableVsync = false; bool Properties::skpCaptureEnabled = false; bool Properties::enableRTAnimations = true; static int property_get_int(const char* key, int defaultValue) { char buf[PROPERTY_VALUE_MAX] = { Loading
libs/hwui/Properties.h +3 −0 Original line number Diff line number Diff line Loading @@ -255,6 +255,9 @@ public: static bool skpCaptureEnabled; // For experimentation b/68769804 ANDROID_API static bool enableRTAnimations; // Used for testing only to change the render pipeline. static void overrideRenderPipelineType(RenderPipelineType); Loading