summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Galia Peycheva <galinap@google.com> 2020-10-21 09:09:04 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2020-10-21 09:09:04 +0000
commit224c843af039935077802fe72d845641d10c6979 (patch)
tree469637f913a2180f1741829ac4d927d7f977cce3
parent91114249ef112c66ca7a51813275854fbc3cc620 (diff)
parentf30a6ab670bc0958bf9ce78331430b46c1e94c62 (diff)
Merge "Add background blur in WindowManager"
-rw-r--r--core/java/android/view/SurfaceControl.java10
-rw-r--r--core/java/android/view/WindowManager.java20
-rw-r--r--data/etc/services.core.protolog.json30
-rw-r--r--services/core/java/com/android/server/wm/WindowStateAnimator.java1
-rw-r--r--services/core/java/com/android/server/wm/WindowSurfaceController.java22
5 files changed, 59 insertions, 24 deletions
diff --git a/core/java/android/view/SurfaceControl.java b/core/java/android/view/SurfaceControl.java
index bbdd7d339507..6d6fabb16b72 100644
--- a/core/java/android/view/SurfaceControl.java
+++ b/core/java/android/view/SurfaceControl.java
@@ -1623,6 +1623,16 @@ public final class SurfaceControl implements Parcelable {
/**
* @hide
*/
+ public void setBackgroundBlurRadius(int blur) {
+ checkNotReleased();
+ synchronized (SurfaceControl.class) {
+ sGlobalTransaction.setBackgroundBlurRadius(this, blur);
+ }
+ }
+
+ /**
+ * @hide
+ */
public void setMatrix(float dsdx, float dtdx, float dtdy, float dsdy) {
checkNotReleased();
synchronized(SurfaceControl.class) {
diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java
index 964ea3488710..ba3dee42c0b2 100644
--- a/core/java/android/view/WindowManager.java
+++ b/core/java/android/view/WindowManager.java
@@ -2932,6 +2932,13 @@ public interface WindowManager extends ViewManager {
public boolean preferMinimalPostProcessing = false;
/**
+ * Indicates that this window wants to have blurred content behind it.
+ *
+ * @hide
+ */
+ public int backgroundBlurRadius = 0;
+
+ /**
* The color mode requested by this window. The target display may
* not be able to honor the request. When the color mode is not set
* to {@link ActivityInfo#COLOR_MODE_DEFAULT}, it might override the
@@ -3255,6 +3262,7 @@ public interface WindowManager extends ViewManager {
out.writeInt(mFitInsetsSides);
out.writeBoolean(mFitInsetsIgnoringVisibility);
out.writeBoolean(preferMinimalPostProcessing);
+ out.writeInt(backgroundBlurRadius);
if (providesInsetsTypes != null) {
out.writeInt(providesInsetsTypes.length);
out.writeIntArray(providesInsetsTypes);
@@ -3322,6 +3330,7 @@ public interface WindowManager extends ViewManager {
mFitInsetsSides = in.readInt();
mFitInsetsIgnoringVisibility = in.readBoolean();
preferMinimalPostProcessing = in.readBoolean();
+ backgroundBlurRadius = in.readInt();
int insetsTypesLength = in.readInt();
if (insetsTypesLength > 0) {
providesInsetsTypes = new int[insetsTypesLength];
@@ -3374,6 +3383,8 @@ public interface WindowManager extends ViewManager {
public static final int INSET_FLAGS_CHANGED = 1 << 27;
/** {@hide} */
public static final int MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED = 1 << 28;
+ /** {@hide} */
+ public static final int BACKGROUND_BLUR_RADIUS_CHANGED = 1 << 29;
// internal buffer to backup/restore parameters under compatibility mode.
private int[] mCompatibilityParamsBackup = null;
@@ -3559,6 +3570,11 @@ public interface WindowManager extends ViewManager {
changes |= MINIMAL_POST_PROCESSING_PREFERENCE_CHANGED;
}
+ if (backgroundBlurRadius != o.backgroundBlurRadius) {
+ backgroundBlurRadius = o.backgroundBlurRadius;
+ changes |= BACKGROUND_BLUR_RADIUS_CHANGED;
+ }
+
// This can't change, it's only set at window creation time.
hideTimeoutMilliseconds = o.hideTimeoutMilliseconds;
@@ -3722,6 +3738,10 @@ public interface WindowManager extends ViewManager {
sb.append(" preferMinimalPostProcessing=");
sb.append(preferMinimalPostProcessing);
}
+ if (backgroundBlurRadius != 0) {
+ sb.append(" backgroundBlurRadius=");
+ sb.append(backgroundBlurRadius);
+ }
sb.append(System.lineSeparator());
sb.append(prefix).append(" fl=").append(
ViewDebug.flagsToString(LayoutParams.class, "flags", flags));
diff --git a/data/etc/services.core.protolog.json b/data/etc/services.core.protolog.json
index 31dae22df454..b19c8bfe1a6d 100644
--- a/data/etc/services.core.protolog.json
+++ b/data/etc/services.core.protolog.json
@@ -1405,12 +1405,6 @@
"group": "WM_DEBUG_RECENTS_ANIMATIONS",
"at": "com\/android\/server\/wm\/RecentsAnimationController.java"
},
- "-444624452": {
- "message": "REPARENT from: %s to: %s",
- "level": "INFO",
- "group": "WM_SHOW_TRANSACTIONS",
- "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
- },
"-443173857": {
"message": "Moving pending starting from %s to %s",
"level": "VERBOSE",
@@ -1519,12 +1513,6 @@
"group": "WM_DEBUG_STATES",
"at": "com\/android\/server\/wm\/Task.java"
},
- "-324085783": {
- "message": "SURFACE CROP %s: %s",
- "level": "INFO",
- "group": "WM_SHOW_TRANSACTIONS",
- "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
- },
"-322743468": {
"message": "setInputMethodInputTarget %s",
"level": "INFO",
@@ -1711,12 +1699,6 @@
"group": "WM_DEBUG_APP_TRANSITIONS_ANIM",
"at": "com\/android\/server\/wm\/WindowContainer.java"
},
- "-29233992": {
- "message": "SURFACE CLEAR CROP: %s",
- "level": "INFO",
- "group": "WM_SHOW_TRANSACTIONS",
- "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
- },
"-21399771": {
"message": "activity %s already destroying, skipping request with reason:%s",
"level": "VERBOSE",
@@ -2677,6 +2659,12 @@
"group": "WM_ERROR",
"at": "com\/android\/server\/wm\/WindowManagerService.java"
},
+ "1035154109": {
+ "message": "SURFACE backgroundBlur=%o: %s",
+ "level": "INFO",
+ "group": "WM_SHOW_TRANSACTIONS",
+ "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
+ },
"1040675582": {
"message": "Can't report activity configuration update - client not running, activityRecord=%s",
"level": "WARN",
@@ -2809,12 +2797,6 @@
"group": "WM_DEBUG_FOCUS",
"at": "com\/android\/server\/wm\/WindowToken.java"
},
- "1220075598": {
- "message": "SURFACE SIZE %dx%d: %s",
- "level": "INFO",
- "group": "WM_SHOW_TRANSACTIONS",
- "at": "com\/android\/server\/wm\/WindowSurfaceController.java"
- },
"1224184681": {
"message": "No longer Stopped: %s",
"level": "VERBOSE",
diff --git a/services/core/java/com/android/server/wm/WindowStateAnimator.java b/services/core/java/com/android/server/wm/WindowStateAnimator.java
index 972d0d46cec0..0111d4883eea 100644
--- a/services/core/java/com/android/server/wm/WindowStateAnimator.java
+++ b/services/core/java/com/android/server/wm/WindowStateAnimator.java
@@ -859,6 +859,7 @@ class WindowStateAnimator {
if (displayed) {
w.mToken.hasVisible = true;
+ mSurfaceController.setBackgroundBlurRadius(w.mAttrs.backgroundBlurRadius);
}
}
diff --git a/services/core/java/com/android/server/wm/WindowSurfaceController.java b/services/core/java/com/android/server/wm/WindowSurfaceController.java
index feecda79b6d7..21cb9a74c74e 100644
--- a/services/core/java/com/android/server/wm/WindowSurfaceController.java
+++ b/services/core/java/com/android/server/wm/WindowSurfaceController.java
@@ -63,6 +63,8 @@ class WindowSurfaceController {
private float mLastDsdy = 0;
private float mLastDtdy = 1;
+ private int mLastBackgroundBlurRadius = 0;
+
private float mSurfaceAlpha = 0;
private int mSurfaceLayer = 0;
@@ -268,6 +270,26 @@ class WindowSurfaceController {
}
}
+ void setBackgroundBlurRadius(int radius) {
+ ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE backgroundBlur=%o: %s", radius, title);
+
+ if (mSurfaceControl == null || radius == mLastBackgroundBlurRadius) {
+ return;
+ }
+ mLastBackgroundBlurRadius = radius;
+
+ if (SHOW_LIGHT_TRANSACTIONS) Slog.i(TAG, ">>> OPEN TRANSACTION setBackgroundBlurRadius");
+ mService.openSurfaceTransaction();
+ try {
+ mSurfaceControl.setBackgroundBlurRadius(radius);
+ } finally {
+ mService.closeSurfaceTransaction("setBackgroundBlurRadius");
+ if (SHOW_LIGHT_TRANSACTIONS) {
+ Slog.i(TAG, "<<< CLOSE TRANSACTION setBackgroundBlurRadius");
+ }
+ }
+ }
+
void setSecure(boolean isSecure) {
ProtoLog.i(WM_SHOW_TRANSACTIONS, "SURFACE isSecure=%b: %s", isSecure, title);