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

Commit 86e46760 authored by Cairn Overturf's avatar Cairn Overturf
Browse files

Remove client drawn shadow code

Shadows will continue to be drawn by surfaceflinger

Bug: 29584510 , 391428079
Change-Id: Ic527a091e77d69c6e9529782d283379a2651dea8
Test: Shadows work in free form mode
Flag: com.android.window.flags.ignore_corner_radius_and_shadows
parent b2aa2290
Loading
Loading
Loading
Loading
+0 −31
Original line number Diff line number Diff line
@@ -162,8 +162,6 @@ public final class SurfaceControl implements Parcelable {
            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,
@@ -3690,35 +3688,6 @@ public final class SurfaceControl implements Parcelable {
            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}.
         *
+0 −10
Original line number Diff line number Diff line
@@ -1121,14 +1121,6 @@ static void nativeSetClientDrawnCornerRadius(JNIEnv* env, jclass clazz, jlong tr
    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);
@@ -2565,8 +2557,6 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*)nativeSetCornerRadius },
    {"nativeSetClientDrawnCornerRadius", "(JJF)V",
            (void*) nativeSetClientDrawnCornerRadius },
    {"nativeSetClientDrawnShadows", "(JJF)V",
            (void*) nativeSetClientDrawnShadows },
    {"nativeSetBackgroundBlurRadius", "(JJI)V",
            (void*)nativeSetBackgroundBlurRadius },
    {"nativeSetLayerStack", "(JJI)V",