Loading core/java/android/service/wallpaper/WallpaperService.java +4 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.graphics.Matrix.MSCALE_X; import static android.graphics.Matrix.MSCALE_Y; import static android.graphics.Matrix.MSKEW_X; import static android.graphics.Matrix.MSKEW_Y; import static android.view.SurfaceControl.METADATA_WINDOW_TYPE; import static android.view.View.SYSTEM_UI_FLAG_VISIBLE; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; Loading Loading @@ -1168,12 +1167,14 @@ public abstract class WallpaperService extends Service { mBbqSurfaceControl = new SurfaceControl.Builder() .setName("Wallpaper BBQ wrapper") .setHidden(false) // TODO(b/192291754) .setMetadata(METADATA_WINDOW_TYPE, TYPE_WALLPAPER) .setBLASTLayer() .setParent(mSurfaceControl) .setCallsite("Wallpaper#relayout") .build(); SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); transaction.setDefaultFrameRateCompatibility(mBbqSurfaceControl, Surface.FRAME_RATE_COMPATIBILITY_MIN).apply(); } // Propagate transform hint from WM, so we can use the right hint for the // first frame. Loading core/java/android/view/Surface.java +13 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,19 @@ public class Surface implements Parcelable { */ public static final int FRAME_RATE_COMPATIBILITY_EXACT = 100; // From window.h. Keep these in sync. /** * This surface is ignored while choosing the refresh rate. * @hide */ public static final int FRAME_RATE_COMPATIBILITY_NO_VOTE = 101; // From window.h. Keep these in sync. /** * This surface will vote for the minimum refresh rate. * @hide */ public static final int FRAME_RATE_COMPATIBILITY_MIN = 102; /** @hide */ @Retention(RetentionPolicy.SOURCE) Loading core/java/android/view/SurfaceControl.java +21 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetFrameRate(long transactionObj, long nativeObject, float frameRate, int compatibility, int changeFrameRateStrategy); private static native void nativeSetDefaultFrameRateCompatibility(long transactionObj, long nativeObject, int compatibility); private static native long nativeGetHandle(long nativeObject); private static native void nativeSetFixedTransformHint(long transactionObj, long nativeObject, Loading Loading @@ -3613,6 +3615,25 @@ public final class SurfaceControl implements Parcelable { return this; } /** * Sets the default frame rate compatibility for the surface {@link SurfaceControl} * * @param sc The SurfaceControl to specify the frame rate of. * @param compatibility The frame rate compatibility of this surface. The compatibility * value may influence the system's choice of display frame rate. * * @return This transaction object. * * @hide */ @NonNull public Transaction setDefaultFrameRateCompatibility(@NonNull SurfaceControl sc, @Surface.FrameRateCompatibility int compatibility) { checkPreconditions(sc); nativeSetDefaultFrameRateCompatibility(mNativeObject, sc.mNativeObject, compatibility); return this; } /** * Sets focus on the window identified by the input {@code token} if the window is focusable * otherwise the request is dropped. Loading core/java/android/view/ViewRootImpl.java +6 −1 Original line number Diff line number Diff line Loading @@ -3024,6 +3024,12 @@ public final class ViewRootImpl implements ViewParent, if (surfaceControlChanged && mDisplayDecorationCached) { updateDisplayDecoration(); } if (surfaceControlChanged && mWindowAttributes.type == WindowManager.LayoutParams.TYPE_STATUS_BAR) { mTransaction.setDefaultFrameRateCompatibility(mSurfaceControl, Surface.FRAME_RATE_COMPATIBILITY_NO_VOTE).apply(); } } if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString() Loading Loading @@ -3064,7 +3070,6 @@ public final class ViewRootImpl implements ViewParent, if (surfaceReplaced) { mSurfaceSequenceId++; } if (alwaysConsumeSystemBarsChanged) { mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars; dispatchApplyInsets = true; Loading core/jni/android_view_SurfaceControl.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1018,6 +1018,15 @@ static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, static_cast<int8_t>(changeFrameRateStrategy)); } static void nativeSetDefaultFrameRateCompatibility(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint compatibility) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); const auto ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setDefaultFrameRateCompatibility(ctrl, static_cast<int8_t>(compatibility)); } static void nativeSetFixedTransformHint(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint transformHint) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -2157,6 +2166,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFII)V", (void*)nativeSetFrameRate }, {"nativeSetDefaultFrameRateCompatibility", "(JJI)V", (void*)nativeSetDefaultFrameRateCompatibility}, {"nativeGetPhysicalDisplayIds", "()[J", (void*)nativeGetPhysicalDisplayIds }, {"nativeGetPrimaryPhysicalDisplayId", "()J", Loading Loading
core/java/android/service/wallpaper/WallpaperService.java +4 −3 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import static android.graphics.Matrix.MSCALE_X; import static android.graphics.Matrix.MSCALE_Y; import static android.graphics.Matrix.MSKEW_X; import static android.graphics.Matrix.MSKEW_Y; import static android.view.SurfaceControl.METADATA_WINDOW_TYPE; import static android.view.View.SYSTEM_UI_FLAG_VISIBLE; import static android.view.WindowManager.LayoutParams.TYPE_WALLPAPER; Loading Loading @@ -1168,12 +1167,14 @@ public abstract class WallpaperService extends Service { mBbqSurfaceControl = new SurfaceControl.Builder() .setName("Wallpaper BBQ wrapper") .setHidden(false) // TODO(b/192291754) .setMetadata(METADATA_WINDOW_TYPE, TYPE_WALLPAPER) .setBLASTLayer() .setParent(mSurfaceControl) .setCallsite("Wallpaper#relayout") .build(); SurfaceControl.Transaction transaction = new SurfaceControl.Transaction(); transaction.setDefaultFrameRateCompatibility(mBbqSurfaceControl, Surface.FRAME_RATE_COMPATIBILITY_MIN).apply(); } // Propagate transform hint from WM, so we can use the right hint for the // first frame. Loading
core/java/android/view/Surface.java +13 −0 Original line number Diff line number Diff line Loading @@ -228,6 +228,19 @@ public class Surface implements Parcelable { */ public static final int FRAME_RATE_COMPATIBILITY_EXACT = 100; // From window.h. Keep these in sync. /** * This surface is ignored while choosing the refresh rate. * @hide */ public static final int FRAME_RATE_COMPATIBILITY_NO_VOTE = 101; // From window.h. Keep these in sync. /** * This surface will vote for the minimum refresh rate. * @hide */ public static final int FRAME_RATE_COMPATIBILITY_MIN = 102; /** @hide */ @Retention(RetentionPolicy.SOURCE) Loading
core/java/android/view/SurfaceControl.java +21 −0 Original line number Diff line number Diff line Loading @@ -249,6 +249,8 @@ public final class SurfaceControl implements Parcelable { private static native void nativeSetFrameRate(long transactionObj, long nativeObject, float frameRate, int compatibility, int changeFrameRateStrategy); private static native void nativeSetDefaultFrameRateCompatibility(long transactionObj, long nativeObject, int compatibility); private static native long nativeGetHandle(long nativeObject); private static native void nativeSetFixedTransformHint(long transactionObj, long nativeObject, Loading Loading @@ -3613,6 +3615,25 @@ public final class SurfaceControl implements Parcelable { return this; } /** * Sets the default frame rate compatibility for the surface {@link SurfaceControl} * * @param sc The SurfaceControl to specify the frame rate of. * @param compatibility The frame rate compatibility of this surface. The compatibility * value may influence the system's choice of display frame rate. * * @return This transaction object. * * @hide */ @NonNull public Transaction setDefaultFrameRateCompatibility(@NonNull SurfaceControl sc, @Surface.FrameRateCompatibility int compatibility) { checkPreconditions(sc); nativeSetDefaultFrameRateCompatibility(mNativeObject, sc.mNativeObject, compatibility); return this; } /** * Sets focus on the window identified by the input {@code token} if the window is focusable * otherwise the request is dropped. Loading
core/java/android/view/ViewRootImpl.java +6 −1 Original line number Diff line number Diff line Loading @@ -3024,6 +3024,12 @@ public final class ViewRootImpl implements ViewParent, if (surfaceControlChanged && mDisplayDecorationCached) { updateDisplayDecoration(); } if (surfaceControlChanged && mWindowAttributes.type == WindowManager.LayoutParams.TYPE_STATUS_BAR) { mTransaction.setDefaultFrameRateCompatibility(mSurfaceControl, Surface.FRAME_RATE_COMPATIBILITY_NO_VOTE).apply(); } } if (DEBUG_LAYOUT) Log.v(mTag, "relayout: frame=" + frame.toShortString() Loading Loading @@ -3064,7 +3070,6 @@ public final class ViewRootImpl implements ViewParent, if (surfaceReplaced) { mSurfaceSequenceId++; } if (alwaysConsumeSystemBarsChanged) { mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars; dispatchApplyInsets = true; Loading
core/jni/android_view_SurfaceControl.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -1018,6 +1018,15 @@ static void nativeSetFrameRate(JNIEnv* env, jclass clazz, jlong transactionObj, static_cast<int8_t>(changeFrameRateStrategy)); } static void nativeSetDefaultFrameRateCompatibility(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint compatibility) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); const auto ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setDefaultFrameRateCompatibility(ctrl, static_cast<int8_t>(compatibility)); } static void nativeSetFixedTransformHint(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint transformHint) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -2157,6 +2166,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetShadowRadius }, {"nativeSetFrameRate", "(JJFII)V", (void*)nativeSetFrameRate }, {"nativeSetDefaultFrameRateCompatibility", "(JJI)V", (void*)nativeSetDefaultFrameRateCompatibility}, {"nativeGetPhysicalDisplayIds", "()[J", (void*)nativeGetPhysicalDisplayIds }, {"nativeGetPrimaryPhysicalDisplayId", "()J", Loading