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

Commit 5e11b629 authored by Fengjiang Li's avatar Fengjiang Li Committed by Android (Google) Code Review
Browse files

Merge "Let DecorView call addCrossWindowBlurEnabledListener() with...

Merge "Let DecorView call addCrossWindowBlurEnabledListener() with HandlerExecutor if DecorView is rendered on separate UI thread" into main
parents 32b87237 20466969
Loading
Loading
Loading
Loading
+12 −1
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.graphics.drawable.LayerDrawable;
import android.os.Handler;
import android.os.HandlerExecutor;
import android.os.Looper;
import android.util.DisplayMetrics;
import android.util.Log;
import android.util.Pair;
@@ -114,6 +117,7 @@ import com.android.internal.widget.floatingtoolbar.FloatingToolbar;
import com.android.window.flags.Flags;

import java.util.List;
import java.util.concurrent.Executor;
import java.util.function.Consumer;

/** @hide */
@@ -1348,8 +1352,15 @@ public class DecorView extends FrameLayout implements RootViewSurfaceTaker, Wind
                    mCrossWindowBlurEnabled = enabled;
                    updateBackgroundBlurRadius();
                };
                // The executor to receive callback {@link mCrossWindowBlurEnabledListener}. It
                // should be the executor for this {@link DecorView}'s ui thread (not necessarily
                // the main thread).
                final Executor executor = Looper.myLooper() == Looper.getMainLooper()
                        ? getContext().getMainExecutor()
                        : new HandlerExecutor(new Handler(Looper.myLooper()));
                getContext().getSystemService(WindowManager.class)
                        .addCrossWindowBlurEnabledListener(mCrossWindowBlurEnabledListener);
                        .addCrossWindowBlurEnabledListener(
                                executor, mCrossWindowBlurEnabledListener);
                getViewTreeObserver().addOnPreDrawListener(mBackgroundBlurOnPreDrawListener);
            } else {
                updateBackgroundBlurRadius();