Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 317942d9 authored by Robin Lee's avatar Robin Lee
Browse files

Add DoF zoom support to SurfaceControl blur

Test: atest LayerLifecycleManagerTest
Bug: 391463550
Flag: com.android.systemui.spatial_model_pushback_in_shader
Change-Id: I45698ef3432fa89a83cad70faa83fbbe9a21f9cd
parent 0b80b606
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ public final class SurfaceControl implements Parcelable {
            long nativeObject, float clientDrawnCornerRadius);
    private static native void nativeSetBackgroundBlurRadius(long transactionObj, long nativeObject,
            int blurRadius);
    private static native void nativeSetBackgroundBlurScale(long transactionObj, long nativeObject,
            float blurScale);
    private static native void nativeSetLayerStack(long transactionObj, long nativeObject,
            int layerStack);
    private static native void nativeSetBlurRegions(long transactionObj, long nativeObj,
@@ -3807,6 +3809,24 @@ public final class SurfaceControl implements Parcelable {
            return this;
        }

        /**
         * Sets the background blur scaling of the {@link SurfaceControl}.
         *
         * @param sc SurfaceControl.
         * @param scale Zoom level to apply, where 1.0f is 100%.
         * @return itself.
         * @hide
         */
        public Transaction setBackgroundBlurScale(SurfaceControl sc, float scale) {
            checkPreconditions(sc);
            if (SurfaceControlRegistry.sCallStackDebuggingEnabled) {
                SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging(
                        "setBackgroundBlurScale", this, sc, "scale=" + scale);
            }
            nativeSetBackgroundBlurScale(mNativeObject, sc.mNativeObject, scale);
            return this;
        }

        /**
         * Specify what regions should be blurred on the {@link SurfaceControl}.
         *
+10 −0
Original line number Diff line number Diff line
@@ -1130,6 +1130,14 @@ static void nativeSetBackgroundBlurRadius(JNIEnv* env, jclass clazz, jlong trans
    transaction->setBackgroundBlurRadius(ctrl, blurRadius);
}

static void nativeSetBackgroundBlurScale(JNIEnv* env, jclass clazz, jlong transactionObj,
         jlong nativeObject, jfloat blurScale) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);

    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    transaction->setBackgroundBlurScale(ctrl, blurScale);
}

static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong transactionObj,
        jlong nativeObject, jint layerStack) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
@@ -2603,6 +2611,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*) nativeSetClientDrawnCornerRadius },
    {"nativeSetBackgroundBlurRadius", "(JJI)V",
            (void*)nativeSetBackgroundBlurRadius },
    {"nativeSetBackgroundBlurScale", "(JJF)V",
            (void*)nativeSetBackgroundBlurScale },
    {"nativeSetLayerStack", "(JJI)V",
            (void*)nativeSetLayerStack },
    {"nativeSetBlurRegions", "(JJ[[FI)V",