Loading core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -52173,6 +52173,7 @@ package android.view { method public android.graphics.Canvas lockHardwareCanvas(); method public void readFromParcel(android.os.Parcel); method public void release(); method public void setFrameRate(@FloatRange(from=0.0) float, int, boolean); method public void setFrameRate(@FloatRange(from=0.0) float, int); method @Deprecated public void unlockCanvas(android.graphics.Canvas); method public void unlockCanvasAndPost(android.graphics.Canvas); Loading Loading @@ -52220,6 +52221,7 @@ package android.view { method @NonNull public android.view.SurfaceControl.Transaction setAlpha(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0, to=1.0) float); method @NonNull public android.view.SurfaceControl.Transaction setBufferSize(@NonNull android.view.SurfaceControl, @IntRange(from=0) int, @IntRange(from=0) int); method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int); method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int, boolean); method @NonNull public android.view.SurfaceControl.Transaction setGeometry(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, int); method @NonNull public android.view.SurfaceControl.Transaction setLayer(@NonNull android.view.SurfaceControl, @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int); method @NonNull public android.view.SurfaceControl.Transaction setVisibility(@NonNull android.view.SurfaceControl, boolean); core/java/android/view/Surface.java +22 −4 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public class Surface implements Parcelable { private static native int nativeSetAutoRefreshEnabled(long nativeObject, boolean enabled); private static native int nativeSetFrameRate( long nativeObject, float frameRate, int compatibility); long nativeObject, float frameRate, int compatibility, boolean shouldBeSeamless); public static final @android.annotation.NonNull Parcelable.Creator<Surface> CREATOR = new Parcelable.Creator<Surface>() { Loading Loading @@ -915,13 +915,20 @@ public class Surface implements Parcelable { * compatibility value may influence the system's choice of display frame rate. See * the FRAME_RATE_COMPATIBILITY_* values for more info. * * @param shouldBeSeamless Whether display refresh rate transitions should be seamless. A * seamless transition is one that doesn't have any visual interruptions, such as a black * screen for a second or two. True indicates that any frame rate changes caused by this * request should be seamless. False indicates that non-seamless refresh rates are also * acceptable. * * @throws IllegalArgumentException If frameRate or compatibility are invalid. */ public void setFrameRate( @FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility) { public void setFrameRate(@FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility, boolean shouldBeSeamless) { synchronized (mLock) { checkNotReleasedLocked(); int error = nativeSetFrameRate(mNativeObject, frameRate, compatibility); int error = nativeSetFrameRate(mNativeObject, frameRate, compatibility, shouldBeSeamless); if (error == -EINVAL) { throw new IllegalArgumentException("Invalid argument to Surface.setFrameRate()"); } else if (error != 0) { Loading @@ -930,6 +937,17 @@ public class Surface implements Parcelable { } } /** * Sets the intended frame rate for this surface. Any switching of refresh rates is * most probably going to be seamless. * * @see #setFrameRate(float, int, boolean) */ public void setFrameRate( @FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility) { setFrameRate(frameRate, compatibility, /* shouldBeSeamless = */ true); } /** * Exception thrown when a Canvas couldn't be locked with {@link Surface#lockCanvas}, or * when a SurfaceTexture could not successfully be allocated. Loading core/java/android/view/SurfaceControl.java +25 −4 Original line number Diff line number Diff line Loading @@ -212,8 +212,8 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetGlobalShadowSettings(@Size(4) float[] ambientColor, @Size(4) float[] spotColor, float lightPosY, float lightPosZ, float lightRadius); private static native void nativeSetFrameRate( long transactionObj, long nativeObject, float frameRate, int compatibility); private static native void nativeSetFrameRate(long transactionObj, long nativeObject, float frameRate, int compatibility, boolean shouldBeSeamless); private static native long nativeGetHandle(long nativeObject); private static native long nativeAcquireFrameRateFlexibilityToken(); Loading Loading @@ -3255,6 +3255,19 @@ public final class SurfaceControl implements Parcelable { return this; } /** * Sets the intended frame rate for this surface. Any switching of refresh rates is * most probably going to be seamless. * * @see #setFrameRate(SurfaceControl, float, int, boolean) */ @NonNull public Transaction setFrameRate(@NonNull SurfaceControl sc, @FloatRange(from = 0.0) float frameRate, @Surface.FrameRateCompatibility int compatibility) { return setFrameRate(sc, frameRate, compatibility, /*shouldBeSeamless*/ true); } /** * Sets the intended frame rate for the surface {@link SurfaceControl}. * <p> Loading @@ -3275,14 +3288,22 @@ public final class SurfaceControl implements Parcelable { * @param compatibility The frame rate compatibility of this surface. The compatibility * value may influence the system's choice of display frame rate. See * the Surface.FRAME_RATE_COMPATIBILITY_* values for more info. * @param shouldBeSeamless Whether display refresh rate transitions should be seamless. A * seamless transition is one that doesn't have any visual * interruptions, such as a black screen for a second or two. True * indicates that any frame rate changes caused by this request * should be seamless. False indicates that non-seamless refresh * rates are also acceptable. * @return This transaction object. */ @NonNull public Transaction setFrameRate(@NonNull SurfaceControl sc, @FloatRange(from = 0.0) float frameRate, @Surface.FrameRateCompatibility int compatibility) { @Surface.FrameRateCompatibility int compatibility, boolean shouldBeSeamless) { checkPreconditions(sc); nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate, compatibility); nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate, compatibility, shouldBeSeamless); return this; } Loading core/jni/android_view_Surface.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -438,14 +438,15 @@ static jint nativeSetAutoRefreshEnabled(JNIEnv* env, jclass clazz, jlong nativeO } static jint nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat frameRate, jint compatibility) { jint compatibility, jboolean shouldBeSeamless) { Surface* surface = reinterpret_cast<Surface*>(nativeObject); ANativeWindow* anw = static_cast<ANativeWindow*>(surface); // Our compatibility is a Surface.FRAME_RATE_COMPATIBILITY_* value, and // NATIVE_WINDOW_SET_FRAME_RATE takes an // ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* value. The values are identical // though, so no need to explicitly convert. return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, float(frameRate), compatibility); return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, double(frameRate), compatibility, int(shouldBeSeamless)); } // ---------------------------------------------------------------------------- Loading Loading @@ -474,7 +475,7 @@ static const JNINativeMethod gSurfaceMethods[] = { (void*)nativeAttachAndQueueBufferWithColorSpace}, {"nativeSetSharedBufferModeEnabled", "(JZ)I", (void*)nativeSetSharedBufferModeEnabled}, {"nativeSetAutoRefreshEnabled", "(JZ)I", (void*)nativeSetAutoRefreshEnabled}, {"nativeSetFrameRate", "(JFI)I", (void*)nativeSetFrameRate}, {"nativeSetFrameRate", "(JFIZ)I", (void*)nativeSetFrameRate}, {"nativeGetFromBlastBufferQueue", "(JJ)J", (void*)nativeGetFromBlastBufferQueue}, }; Loading core/jni/android_view_SurfaceControl.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -738,14 +738,15 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb } static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat frameRate, jint compatibility) { jfloat frameRate, jint compatibility, jboolean shouldBeSeamless) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); const auto ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); // Our compatibility is a Surface.FRAME_RATE_COMPATIBILITY_* value, and // Transaction::setFrameRate() takes an ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* value. The // values are identical though, so no need to convert anything. transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility)); transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility), bool(shouldBeSeamless)); } static jlong nativeAcquireFrameRateFlexibilityToken(JNIEnv* env, jclass clazz) { Loading Loading @@ -1668,7 +1669,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetBlurRegions }, {"nativeSetShadowRadius", "(JJF)V", (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFI)V", {"nativeSetFrameRate", "(JJFIZ)V", (void*)nativeSetFrameRate }, {"nativeAcquireFrameRateFlexibilityToken", "()J", (void*)nativeAcquireFrameRateFlexibilityToken }, Loading Loading
core/api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -52173,6 +52173,7 @@ package android.view { method public android.graphics.Canvas lockHardwareCanvas(); method public void readFromParcel(android.os.Parcel); method public void release(); method public void setFrameRate(@FloatRange(from=0.0) float, int, boolean); method public void setFrameRate(@FloatRange(from=0.0) float, int); method @Deprecated public void unlockCanvas(android.graphics.Canvas); method public void unlockCanvasAndPost(android.graphics.Canvas); Loading Loading @@ -52220,6 +52221,7 @@ package android.view { method @NonNull public android.view.SurfaceControl.Transaction setAlpha(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0, to=1.0) float); method @NonNull public android.view.SurfaceControl.Transaction setBufferSize(@NonNull android.view.SurfaceControl, @IntRange(from=0) int, @IntRange(from=0) int); method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int); method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int, boolean); method @NonNull public android.view.SurfaceControl.Transaction setGeometry(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, int); method @NonNull public android.view.SurfaceControl.Transaction setLayer(@NonNull android.view.SurfaceControl, @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int); method @NonNull public android.view.SurfaceControl.Transaction setVisibility(@NonNull android.view.SurfaceControl, boolean);
core/java/android/view/Surface.java +22 −4 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public class Surface implements Parcelable { private static native int nativeSetAutoRefreshEnabled(long nativeObject, boolean enabled); private static native int nativeSetFrameRate( long nativeObject, float frameRate, int compatibility); long nativeObject, float frameRate, int compatibility, boolean shouldBeSeamless); public static final @android.annotation.NonNull Parcelable.Creator<Surface> CREATOR = new Parcelable.Creator<Surface>() { Loading Loading @@ -915,13 +915,20 @@ public class Surface implements Parcelable { * compatibility value may influence the system's choice of display frame rate. See * the FRAME_RATE_COMPATIBILITY_* values for more info. * * @param shouldBeSeamless Whether display refresh rate transitions should be seamless. A * seamless transition is one that doesn't have any visual interruptions, such as a black * screen for a second or two. True indicates that any frame rate changes caused by this * request should be seamless. False indicates that non-seamless refresh rates are also * acceptable. * * @throws IllegalArgumentException If frameRate or compatibility are invalid. */ public void setFrameRate( @FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility) { public void setFrameRate(@FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility, boolean shouldBeSeamless) { synchronized (mLock) { checkNotReleasedLocked(); int error = nativeSetFrameRate(mNativeObject, frameRate, compatibility); int error = nativeSetFrameRate(mNativeObject, frameRate, compatibility, shouldBeSeamless); if (error == -EINVAL) { throw new IllegalArgumentException("Invalid argument to Surface.setFrameRate()"); } else if (error != 0) { Loading @@ -930,6 +937,17 @@ public class Surface implements Parcelable { } } /** * Sets the intended frame rate for this surface. Any switching of refresh rates is * most probably going to be seamless. * * @see #setFrameRate(float, int, boolean) */ public void setFrameRate( @FloatRange(from = 0.0) float frameRate, @FrameRateCompatibility int compatibility) { setFrameRate(frameRate, compatibility, /* shouldBeSeamless = */ true); } /** * Exception thrown when a Canvas couldn't be locked with {@link Surface#lockCanvas}, or * when a SurfaceTexture could not successfully be allocated. Loading
core/java/android/view/SurfaceControl.java +25 −4 Original line number Diff line number Diff line Loading @@ -212,8 +212,8 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetGlobalShadowSettings(@Size(4) float[] ambientColor, @Size(4) float[] spotColor, float lightPosY, float lightPosZ, float lightRadius); private static native void nativeSetFrameRate( long transactionObj, long nativeObject, float frameRate, int compatibility); private static native void nativeSetFrameRate(long transactionObj, long nativeObject, float frameRate, int compatibility, boolean shouldBeSeamless); private static native long nativeGetHandle(long nativeObject); private static native long nativeAcquireFrameRateFlexibilityToken(); Loading Loading @@ -3255,6 +3255,19 @@ public final class SurfaceControl implements Parcelable { return this; } /** * Sets the intended frame rate for this surface. Any switching of refresh rates is * most probably going to be seamless. * * @see #setFrameRate(SurfaceControl, float, int, boolean) */ @NonNull public Transaction setFrameRate(@NonNull SurfaceControl sc, @FloatRange(from = 0.0) float frameRate, @Surface.FrameRateCompatibility int compatibility) { return setFrameRate(sc, frameRate, compatibility, /*shouldBeSeamless*/ true); } /** * Sets the intended frame rate for the surface {@link SurfaceControl}. * <p> Loading @@ -3275,14 +3288,22 @@ public final class SurfaceControl implements Parcelable { * @param compatibility The frame rate compatibility of this surface. The compatibility * value may influence the system's choice of display frame rate. See * the Surface.FRAME_RATE_COMPATIBILITY_* values for more info. * @param shouldBeSeamless Whether display refresh rate transitions should be seamless. A * seamless transition is one that doesn't have any visual * interruptions, such as a black screen for a second or two. True * indicates that any frame rate changes caused by this request * should be seamless. False indicates that non-seamless refresh * rates are also acceptable. * @return This transaction object. */ @NonNull public Transaction setFrameRate(@NonNull SurfaceControl sc, @FloatRange(from = 0.0) float frameRate, @Surface.FrameRateCompatibility int compatibility) { @Surface.FrameRateCompatibility int compatibility, boolean shouldBeSeamless) { checkPreconditions(sc); nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate, compatibility); nativeSetFrameRate(mNativeObject, sc.mNativeObject, frameRate, compatibility, shouldBeSeamless); return this; } Loading
core/jni/android_view_Surface.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -438,14 +438,15 @@ static jint nativeSetAutoRefreshEnabled(JNIEnv* env, jclass clazz, jlong nativeO } static jint nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong nativeObject, jfloat frameRate, jint compatibility) { jint compatibility, jboolean shouldBeSeamless) { Surface* surface = reinterpret_cast<Surface*>(nativeObject); ANativeWindow* anw = static_cast<ANativeWindow*>(surface); // Our compatibility is a Surface.FRAME_RATE_COMPATIBILITY_* value, and // NATIVE_WINDOW_SET_FRAME_RATE takes an // ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* value. The values are identical // though, so no need to explicitly convert. return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, float(frameRate), compatibility); return anw->perform(surface, NATIVE_WINDOW_SET_FRAME_RATE, double(frameRate), compatibility, int(shouldBeSeamless)); } // ---------------------------------------------------------------------------- Loading Loading @@ -474,7 +475,7 @@ static const JNINativeMethod gSurfaceMethods[] = { (void*)nativeAttachAndQueueBufferWithColorSpace}, {"nativeSetSharedBufferModeEnabled", "(JZ)I", (void*)nativeSetSharedBufferModeEnabled}, {"nativeSetAutoRefreshEnabled", "(JZ)I", (void*)nativeSetAutoRefreshEnabled}, {"nativeSetFrameRate", "(JFI)I", (void*)nativeSetFrameRate}, {"nativeSetFrameRate", "(JFIZ)I", (void*)nativeSetFrameRate}, {"nativeGetFromBlastBufferQueue", "(JJ)J", (void*)nativeGetFromBlastBufferQueue}, }; Loading
core/jni/android_view_SurfaceControl.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -738,14 +738,15 @@ static void nativeSetShadowRadius(JNIEnv* env, jclass clazz, jlong transactionOb } static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat frameRate, jint compatibility) { jfloat frameRate, jint compatibility, jboolean shouldBeSeamless) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); const auto ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); // Our compatibility is a Surface.FRAME_RATE_COMPATIBILITY_* value, and // Transaction::setFrameRate() takes an ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_* value. The // values are identical though, so no need to convert anything. transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility)); transaction->setFrameRate(ctrl, frameRate, static_cast<int8_t>(compatibility), bool(shouldBeSeamless)); } static jlong nativeAcquireFrameRateFlexibilityToken(JNIEnv* env, jclass clazz) { Loading Loading @@ -1668,7 +1669,7 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetBlurRegions }, {"nativeSetShadowRadius", "(JJF)V", (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFI)V", {"nativeSetFrameRate", "(JJFIZ)V", (void*)nativeSetFrameRate }, {"nativeAcquireFrameRateFlexibilityToken", "()J", (void*)nativeAcquireFrameRateFlexibilityToken }, Loading