summaryrefslogtreecommitdiff
path: root/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
diff options
context:
space:
mode:
authorLucas Dupin <dupin@google.com>2021-08-30 20:33:57 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-08-30 20:33:57 +0000
commit512f95131ccbda217b69cdc20c8566eb7548edf0 (patch)
treeb97d8b317c3dec4453e618f552f85cb8af23b3c8 /quickstep/src/com/android/launcher3/statehandlers/DepthController.java
parent3c79aa579bd89dc0c13afb24f267e4151b6974f6 (diff)
parent937eff0e76a849f4320ae077982e8b9cdd84a02c (diff)
Merge "Dispatch blur radius for BACKGROUND_APP state" into sc-v2-dev
Diffstat (limited to 'quickstep/src/com/android/launcher3/statehandlers/DepthController.java')
-rw-r--r--quickstep/src/com/android/launcher3/statehandlers/DepthController.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index ab88b2b218..3e2fb639e3 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -96,7 +96,11 @@ public class DepthController implements StateHandler<LauncherState>,
public void onDraw() {
View view = mLauncher.getDragLayer();
ViewRootImpl viewRootImpl = view.getViewRootImpl();
- setSurface(viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null);
+ boolean applied = setSurface(
+ viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null);
+ if (!applied) {
+ dispatchTransactionSurface(mDepth);
+ }
view.post(() -> view.getViewTreeObserver().removeOnDrawListener(this));
}
};
@@ -202,20 +206,22 @@ public class DepthController implements StateHandler<LauncherState>,
/**
* Sets the specified app target surface to apply the blur to.
+ * @return true when surface was valid and transaction was dispatched.
*/
- public void setSurface(SurfaceControl surface) {
+ public boolean setSurface(SurfaceControl surface) {
// Set launcher as the SurfaceControl when we don't need an external target anymore.
if (surface == null) {
ViewRootImpl viewRootImpl = mLauncher.getDragLayer().getViewRootImpl();
surface = viewRootImpl != null ? viewRootImpl.getSurfaceControl() : null;
}
-
if (mSurface != surface) {
mSurface = surface;
if (surface != null) {
dispatchTransactionSurface(mDepth);
+ return true;
}
}
+ return false;
}
@Override
@@ -229,6 +235,8 @@ public class DepthController implements StateHandler<LauncherState>,
setDepth(toDepth);
} else if (toState == LauncherState.OVERVIEW) {
dispatchTransactionSurface(mDepth);
+ } else if (toState == LauncherState.BACKGROUND_APP) {
+ mLauncher.getDragLayer().getViewTreeObserver().addOnDrawListener(mOnDrawListener);
}
}