diff options
| author | Galia Peycheva <galinap@google.com> | 2021-03-11 10:59:01 +0100 |
|---|---|---|
| committer | Galia Peycheva <galinap@google.com> | 2021-03-12 11:03:31 +0100 |
| commit | 191c35b966c08299905d0cce7d7df06d2120f3ee (patch) | |
| tree | 4e3e5c64ea5e93b87a9b24fd5dae588e4eee0ccd /core/java/android/view/WindowManager.java | |
| parent | 07fedbce463d23fcb433c5ea072069dff83a6d16 (diff) | |
Add executor to window blur api
Bug: 181593110
Test: atest BlurTests
CTS-Coverage-Bug: 179990440
Change-Id: Ifc15afd100d5e75c63ded524f43b0d7442dc815d
Diffstat (limited to 'core/java/android/view/WindowManager.java')
| -rw-r--r-- | core/java/android/view/WindowManager.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index 818a2b04b5c0..04512c9abc0a 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -81,6 +81,7 @@ import static android.view.WindowLayoutParamsProto.X; import static android.view.WindowLayoutParamsProto.Y; import android.Manifest.permission; +import android.annotation.CallbackExecutor; import android.annotation.IntDef; import android.annotation.IntRange; import android.annotation.NonNull; @@ -121,6 +122,7 @@ import java.lang.annotation.RetentionPolicy; import java.util.Arrays; import java.util.List; import java.util.Objects; +import java.util.concurrent.Executor; import java.util.function.Consumer; /** @@ -864,6 +866,33 @@ public interface WindowManager extends ViewManager { } /** + * Adds a listener, which will be called when cross-window blurs are enabled/disabled at + * runtime. This affects both window blur behind (see {@link LayoutParams#setBlurBehindRadius}) + * and window background blur (see {@link Window#setBackgroundBlurRadius}). + * + * Cross-window blur might not be supported by some devices due to GPU limitations. It can also + * be disabled at runtime, e.g. during battery saving mode, when multimedia tunneling is used or + * when minimal post processing is requested. In such situations, no blur will be computed or + * drawn, so the blur target area will not be blurred. To handle this, the app might want to + * change its theme to one that does not use blurs. + * + * If the listener is added successfully, it will be called immediately with the current + * cross-window blur enabled state. + * + * @param executor {@link Executor} to handle the listener callback + * @param listener the listener to be added. It will be called back with a boolean parameter, + * which is true if cross-window blur is enabled and false if it is disabled + * + * @see #removeCrossWindowBlurEnabledListener + * @see #isCrossWindowBlurEnabled + * @see LayoutParams#setBlurBehindRadius + * @see Window#setBackgroundBlurRadius + */ + default void addCrossWindowBlurEnabledListener(@NonNull @CallbackExecutor Executor executor, + @NonNull Consumer<Boolean> listener) { + } + + /** * Removes a listener, previously added with {@link #addCrossWindowBlurEnabledListener} * * @param listener the listener to be removed |
