Loading core/java/android/view/SurfaceControl.java +64 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,10 @@ public final class SurfaceControl implements Parcelable { float l, float t, float r, float b); private static native void nativeSetCornerRadius(long transactionObj, long nativeObject, float cornerRadius); private static native void nativeSetClientDrawnCornerRadius(long transactionObj, long nativeObject, float clientDrawnCornerRadius); private static native void nativeSetClientDrawnShadows(long transactionObj, long nativeObject, float clientDrawnShadows); private static native void nativeSetBackgroundBlurRadius(long transactionObj, long nativeObject, int blurRadius); private static native void nativeSetLayerStack(long transactionObj, long nativeObject, Loading Loading @@ -3654,6 +3658,66 @@ public final class SurfaceControl implements Parcelable { return this; } /** * Disables corner radius of a {@link SurfaceControl}. When the radius set by * {@link Transaction#setCornerRadius(SurfaceControl, float)} is equal to * clientDrawnCornerRadius the corner radius drawn by SurfaceFlinger is disabled. * * @param sc SurfaceControl * @param clientDrawnCornerRadius Corner radius drawn by the client * @return Itself. * @hide */ @NonNull public Transaction setClientDrawnCornerRadius(@NonNull SurfaceControl sc, float clientDrawnCornerRadius) { checkPreconditions(sc); if (SurfaceControlRegistry.sCallStackDebuggingEnabled) { SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging( "setClientDrawnCornerRadius", this, sc, "clientDrawnCornerRadius=" + clientDrawnCornerRadius); } if (Flags.ignoreCornerRadiusAndShadows()) { nativeSetClientDrawnCornerRadius(mNativeObject, sc.mNativeObject, clientDrawnCornerRadius); } else { Log.w(TAG, "setClientDrawnCornerRadius was called but" + "ignore_corner_radius_and_shadows flag is disabled"); } return this; } /** * Disables shadows of a {@link SurfaceControl}. When the radius set by * {@link Transaction#setClientDrawnShadows(SurfaceControl, float)} is equal to * clientDrawnShadowRadius the shadows drawn by SurfaceFlinger is disabled. * * @param sc SurfaceControl * @param clientDrawnShadowRadius Shadow radius drawn by the client * @return Itself. * @hide */ @NonNull public Transaction setClientDrawnShadows(@NonNull SurfaceControl sc, float clientDrawnShadowRadius) { checkPreconditions(sc); if (SurfaceControlRegistry.sCallStackDebuggingEnabled) { SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging( "setClientDrawnShadows", this, sc, "clientDrawnShadowRadius=" + clientDrawnShadowRadius); } if (Flags.ignoreCornerRadiusAndShadows()) { nativeSetClientDrawnShadows(mNativeObject, sc.mNativeObject, clientDrawnShadowRadius); } else { Log.w(TAG, "setClientDrawnShadows was called but" + "ignore_corner_radius_and_shadows flag is disabled"); } return this; } /** * Sets the background blur radius of the {@link SurfaceControl}. * Loading core/java/android/window/flags/window_surfaces.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,14 @@ flag { bug: "308662081" } flag { name: "ignore_corner_radius_and_shadows" namespace: "window_surfaces" description: "Ignore the corner radius and shadows of a SurfaceControl" bug: "375624570" is_fixed_read_only: true } # ignore_corner_radius_and_shadows flag { name: "jank_api" namespace: "window_surfaces" Loading core/jni/android_view_SurfaceControl.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -1113,6 +1113,22 @@ static void nativeSetCornerRadius(JNIEnv* env, jclass clazz, jlong transactionOb transaction->setCornerRadius(ctrl, cornerRadius); } static void nativeSetClientDrawnCornerRadius(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat clientDrawnCornerRadius) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setClientDrawnCornerRadius(ctrl, clientDrawnCornerRadius); } static void nativeSetClientDrawnShadows(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat clientDrawnShadowRadius) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setClientDrawnShadowRadius(ctrl, clientDrawnShadowRadius); } static void nativeSetBackgroundBlurRadius(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint blurRadius) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -2547,6 +2563,10 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetCrop }, {"nativeSetCornerRadius", "(JJF)V", (void*)nativeSetCornerRadius }, {"nativeSetClientDrawnCornerRadius", "(JJF)V", (void*) nativeSetClientDrawnCornerRadius }, {"nativeSetClientDrawnShadows", "(JJF)V", (void*) nativeSetClientDrawnShadows }, {"nativeSetBackgroundBlurRadius", "(JJI)V", (void*)nativeSetBackgroundBlurRadius }, {"nativeSetLayerStack", "(JJI)V", Loading Loading
core/java/android/view/SurfaceControl.java +64 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,10 @@ public final class SurfaceControl implements Parcelable { float l, float t, float r, float b); private static native void nativeSetCornerRadius(long transactionObj, long nativeObject, float cornerRadius); private static native void nativeSetClientDrawnCornerRadius(long transactionObj, long nativeObject, float clientDrawnCornerRadius); private static native void nativeSetClientDrawnShadows(long transactionObj, long nativeObject, float clientDrawnShadows); private static native void nativeSetBackgroundBlurRadius(long transactionObj, long nativeObject, int blurRadius); private static native void nativeSetLayerStack(long transactionObj, long nativeObject, Loading Loading @@ -3654,6 +3658,66 @@ public final class SurfaceControl implements Parcelable { return this; } /** * Disables corner radius of a {@link SurfaceControl}. When the radius set by * {@link Transaction#setCornerRadius(SurfaceControl, float)} is equal to * clientDrawnCornerRadius the corner radius drawn by SurfaceFlinger is disabled. * * @param sc SurfaceControl * @param clientDrawnCornerRadius Corner radius drawn by the client * @return Itself. * @hide */ @NonNull public Transaction setClientDrawnCornerRadius(@NonNull SurfaceControl sc, float clientDrawnCornerRadius) { checkPreconditions(sc); if (SurfaceControlRegistry.sCallStackDebuggingEnabled) { SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging( "setClientDrawnCornerRadius", this, sc, "clientDrawnCornerRadius=" + clientDrawnCornerRadius); } if (Flags.ignoreCornerRadiusAndShadows()) { nativeSetClientDrawnCornerRadius(mNativeObject, sc.mNativeObject, clientDrawnCornerRadius); } else { Log.w(TAG, "setClientDrawnCornerRadius was called but" + "ignore_corner_radius_and_shadows flag is disabled"); } return this; } /** * Disables shadows of a {@link SurfaceControl}. When the radius set by * {@link Transaction#setClientDrawnShadows(SurfaceControl, float)} is equal to * clientDrawnShadowRadius the shadows drawn by SurfaceFlinger is disabled. * * @param sc SurfaceControl * @param clientDrawnShadowRadius Shadow radius drawn by the client * @return Itself. * @hide */ @NonNull public Transaction setClientDrawnShadows(@NonNull SurfaceControl sc, float clientDrawnShadowRadius) { checkPreconditions(sc); if (SurfaceControlRegistry.sCallStackDebuggingEnabled) { SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging( "setClientDrawnShadows", this, sc, "clientDrawnShadowRadius=" + clientDrawnShadowRadius); } if (Flags.ignoreCornerRadiusAndShadows()) { nativeSetClientDrawnShadows(mNativeObject, sc.mNativeObject, clientDrawnShadowRadius); } else { Log.w(TAG, "setClientDrawnShadows was called but" + "ignore_corner_radius_and_shadows flag is disabled"); } return this; } /** * Sets the background blur radius of the {@link SurfaceControl}. * Loading
core/java/android/window/flags/window_surfaces.aconfig +8 −0 Original line number Diff line number Diff line Loading @@ -90,6 +90,14 @@ flag { bug: "308662081" } flag { name: "ignore_corner_radius_and_shadows" namespace: "window_surfaces" description: "Ignore the corner radius and shadows of a SurfaceControl" bug: "375624570" is_fixed_read_only: true } # ignore_corner_radius_and_shadows flag { name: "jank_api" namespace: "window_surfaces" Loading
core/jni/android_view_SurfaceControl.cpp +20 −0 Original line number Diff line number Diff line Loading @@ -1113,6 +1113,22 @@ static void nativeSetCornerRadius(JNIEnv* env, jclass clazz, jlong transactionOb transaction->setCornerRadius(ctrl, cornerRadius); } static void nativeSetClientDrawnCornerRadius(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat clientDrawnCornerRadius) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setClientDrawnCornerRadius(ctrl, clientDrawnCornerRadius); } static void nativeSetClientDrawnShadows(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jfloat clientDrawnShadowRadius) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl*>(nativeObject); transaction->setClientDrawnShadowRadius(ctrl, clientDrawnShadowRadius); } static void nativeSetBackgroundBlurRadius(JNIEnv* env, jclass clazz, jlong transactionObj, jlong nativeObject, jint blurRadius) { auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj); Loading Loading @@ -2547,6 +2563,10 @@ static const JNINativeMethod sSurfaceControlMethods[] = { (void*)nativeSetCrop }, {"nativeSetCornerRadius", "(JJF)V", (void*)nativeSetCornerRadius }, {"nativeSetClientDrawnCornerRadius", "(JJF)V", (void*) nativeSetClientDrawnCornerRadius }, {"nativeSetClientDrawnShadows", "(JJF)V", (void*) nativeSetClientDrawnShadows }, {"nativeSetBackgroundBlurRadius", "(JJI)V", (void*)nativeSetBackgroundBlurRadius }, {"nativeSetLayerStack", "(JJI)V", Loading