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

Commit fab46936 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add debug logs whenever we apply or reset the blur RenderEffect" into main

parents 1760acbd 52634c78
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -30,8 +30,10 @@ import android.graphics.Rect;
import android.graphics.RenderEffect;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Looper;
import android.util.AttributeSet;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;

@@ -52,6 +54,9 @@ import java.util.concurrent.Executor;
 * need to be careful to synchronize when necessary.
 */
public class ScrimView extends View {
    private static final String TAG = "ScrimView";
    private static final boolean isDebugLoggable = Build.isDebuggable() || Log.isLoggable(TAG,
            Log.DEBUG);

    private final Object mColorLock = new Object();

@@ -381,12 +386,21 @@ public class ScrimView extends View {
     */
    public void setBlurRadius(float blurRadius) {
        if (blurRadius > 0) {
            debugLog("Apply blur RenderEffect to ScrimView " + mScrimName + " for radius "
                    + blurRadius);
            setRenderEffect(RenderEffect.createBlurEffect(
                    blurRadius,
                    blurRadius,
                    Shader.TileMode.CLAMP));
        } else {
            debugLog("Resetting blur RenderEffect to ScrimView " + mScrimName);
            setRenderEffect(null);
        }
    }

    private void debugLog(String logMsg) {
        if (isDebugLoggable) {
            Log.d(TAG, logMsg);
        }
    }
}
+2 −0
Original line number Diff line number Diff line
@@ -989,8 +989,10 @@ public final class NotificationPanelViewController implements
                        mBlurConfig.getMaxBlurRadiusPx(),
                        Shader.TileMode.CLAMP);
            }
            debugLog("Applying blur RenderEffect to shade.");
            mView.setRenderEffect(mBlurRenderEffect);
        } else {
            debugLog("Resetting blur RenderEffect on shade.");
            mView.setRenderEffect(null);
        }
    }
+9 −0
Original line number Diff line number Diff line
@@ -6076,7 +6076,9 @@ public class NotificationStackScrollLayout
        if (mBlurRadius > 0) {
            mBlurEffect =
                    RenderEffect.createBlurEffect(mBlurRadius, mBlurRadius, Shader.TileMode.CLAMP);
            spewLog("Setting up blur RenderEffect for NotificationStackScrollLayout");
        } else {
            spewLog("Clearing the blur RenderEffect setup for NotificationStackScrollLayout");
            mBlurEffect = null;
        }
    }
@@ -6252,6 +6254,7 @@ public class NotificationStackScrollLayout
    @Override
    protected void dispatchDraw(@NonNull Canvas canvas) {
        if (mBlurEffect != null) {
            spewLog("Applying blur RenderEffect to NotificationStackScrollLayout");
            // reuse the cached RenderNode to blur
            mBlurNode.setPosition(0, 0, canvas.getWidth(), canvas.getHeight());
            mBlurNode.setRenderEffect(mBlurEffect);
@@ -7025,4 +7028,10 @@ public class NotificationStackScrollLayout
        SceneContainerFlag.assertInLegacyMode();
        mMaxTopPadding = maxTopPadding;
    }

    private void spewLog(String logMsg) {
        if (SPEW) {
            Log.v(TAG, logMsg);
        }
    }
}
+10 −0
Original line number Diff line number Diff line
@@ -1355,11 +1355,15 @@ public class NotificationStackScrollLayoutController implements Dumpable {
     */
    public void setBlurRadius(float blurRadius) {
        if (blurRadius > 0.0f) {
            debugLog(
                    "Setting blur RenderEffect for NotificationStackScrollLayoutController with "
                            + "radius " + blurRadius);
            mView.setRenderEffect(RenderEffect.createBlurEffect(
                    blurRadius,
                    blurRadius,
                    Shader.TileMode.CLAMP));
        } else {
            debugLog("Resetting blur RenderEffect for NotificationStackScrollLayoutController");
            mView.setRenderEffect(null);
        }
    }
@@ -2175,4 +2179,10 @@ public class NotificationStackScrollLayoutController implements Dumpable {
                    && !mSwipeHelper.isSwiping();
        }
    }

    private void debugLog(String msg) {
        if (DEBUG) {
            Log.d(TAG, msg);
        }
    }
}