Add wallpaper zoom to areas that have blur
Whenever blurring, the wallpaper should also zoom out. This is the
mental model of our Depth System.
Test: manual
Bug: 149792636
Change-Id: I1783eb87fefeb6f917f0ba64f2c6ec8f1f2004fa
diff --git a/quickstep/recents_ui_overrides/res/values/config.xml b/quickstep/recents_ui_overrides/res/values/config.xml
index 527eec6..120e034 100644
--- a/quickstep/recents_ui_overrides/res/values/config.xml
+++ b/quickstep/recents_ui_overrides/res/values/config.xml
@@ -14,8 +14,5 @@
limitations under the License.
-->
<resources>
- <integer name="app_background_blur_radius">150</integer>
- <integer name="allapps_background_blur_radius">90</integer>
- <integer name="overview_background_blur_radius">50</integer>
- <integer name="folder_background_blur_radius_adjustment">20</integer>
+ <integer name="max_depth_blur_radius">150</integer>
</resources>
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
index 9afa862..0019ecb 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java
@@ -91,7 +91,7 @@
AppWindowAnimationHelper helper =
new AppWindowAnimationHelper(recentsView.getPagedViewOrientedState(), mLauncher);
Animator recentsAnimator = getRecentsWindowAnimator(taskView, skipLauncherChanges,
- appTargets, wallpaperTargets, mLauncher.getBackgroundBlurController(), helper);
+ appTargets, wallpaperTargets, mLauncher.getDepthController(), helper);
anim.play(recentsAnimator.setDuration(RECENTS_LAUNCH_DURATION));
Animator childStateAnimation = null;
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
index 5bac964..de3fce1 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/BackgroundAppState.java
@@ -19,7 +19,6 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
-import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.util.LayoutUtils;
@@ -107,7 +106,7 @@
}
@Override
- public int getBackgroundBlurRadius(Context context) {
- return context.getResources().getInteger(R.integer.app_background_blur_radius);
+ public float getDepth(Context context) {
+ return 1f;
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
index 6a34917..024872f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
+++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewState.java
@@ -207,8 +207,8 @@
}
@Override
- public int getBackgroundBlurRadius(Context context) {
- return context.getResources().getInteger(R.integer.overview_background_blur_radius);
+ public float getDepth(Context context) {
+ return 1f;
}
@Override
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
index aaf7619..ce7fa0d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java
@@ -19,7 +19,7 @@
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
-import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
+import static com.android.launcher3.uioverrides.DepthController.DEPTH;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_CLOSING;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
@@ -34,7 +34,7 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.anim.AnimationSuccessListener;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.AppWindowAnimationHelper.TransformParams;
import com.android.quickstep.util.RemoteAnimationProvider;
@@ -105,10 +105,10 @@
mRecentsView.setRunningTaskIconScaledDown(true);
}
- BackgroundBlurController blurController = mActivityInterface.getBackgroundBlurController();
- if (blurController != null) {
+ DepthController depthController = mActivityInterface.getDepthController();
+ if (depthController != null) {
// Update the surface to be the lowest closing app surface
- blurController.setSurfaceToLauncher(mRecentsView);
+ depthController.setSurfaceToLauncher(mRecentsView);
}
AnimatorSet anim = new AnimatorSet();
@@ -124,7 +124,7 @@
if (mActivity == null) {
Log.e(TAG, "Animation created, before activity");
anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION))
- .with(createBackgroundBlurAnimator(blurController));
+ .with(createDepthAnimator(depthController));
return anim;
}
@@ -136,7 +136,7 @@
if (runningTaskTarget == null) {
Log.e(TAG, "No closing app");
anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION))
- .with(createBackgroundBlurAnimator(blurController));
+ .with(createDepthAnimator(depthController));
return anim;
}
@@ -184,7 +184,7 @@
});
}
anim.play(valueAnimator)
- .with(createBackgroundBlurAnimator(blurController));
+ .with(createDepthAnimator(depthController));
return anim;
}
@@ -197,14 +197,14 @@
return RECENTS_LAUNCH_DURATION;
}
- private Animator createBackgroundBlurAnimator(BackgroundBlurController blurController) {
- if (blurController == null) {
+ private Animator createDepthAnimator(DepthController depthController) {
+ if (depthController == null) {
// Dummy animation
return ValueAnimator.ofInt(0);
}
- return ObjectAnimator.ofInt(blurController, BACKGROUND_BLUR,
- BACKGROUND_APP.getBackgroundBlurRadius(mActivity),
- OVERVIEW.getBackgroundBlurRadius(mActivity))
+ return ObjectAnimator.ofFloat(depthController, DEPTH,
+ BACKGROUND_APP.getDepth(mActivity),
+ OVERVIEW.getDepth(mActivity))
.setDuration(RECENTS_LAUNCH_DURATION);
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
index d402a75..55e6ba2 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityInterface.java
@@ -56,8 +56,8 @@
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.touch.PagedOrientationHandler;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
-import com.android.launcher3.uioverrides.BackgroundBlurController.ClampedBlurProperty;
+import com.android.launcher3.uioverrides.DepthController;
+import com.android.launcher3.uioverrides.DepthController.ClampedDepthProperty;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.views.FloatingIconView;
import com.android.quickstep.SysUINavigationMode.Mode;
@@ -330,18 +330,17 @@
endState.getVerticalProgress(activity)));
}
- // Animate the blur
- BackgroundBlurController blurController = getBackgroundBlurController();
- int fromBlurRadius = fromState.getBackgroundBlurRadius(activity);
- int toBlurRadius = endState.getBackgroundBlurRadius(activity);
- Animator backgroundBlur = ObjectAnimator.ofInt(blurController,
- new ClampedBlurProperty(toBlurRadius, fromBlurRadius),
- fromBlurRadius, toBlurRadius);
- anim.play(backgroundBlur);
+ // Animate the blur and wallpaper zoom
+ DepthController depthController = getDepthController();
+ float fromDepthRatio = fromState.getDepth(activity);
+ float toDepthRatio = endState.getDepth(activity);
+ Animator depthAnimator = ObjectAnimator.ofFloat(depthController,
+ new ClampedDepthProperty(fromDepthRatio, toDepthRatio),
+ fromDepthRatio, toDepthRatio);
+ anim.play(depthAnimator);
playScaleDownAnim(anim, activity, fromState, endState);
-
anim.setDuration(transitionLength * 2);
anim.setInterpolator(LINEAR);
AnimatorPlaybackController controller =
@@ -558,11 +557,11 @@
@Nullable
@Override
- public BackgroundBlurController getBackgroundBlurController() {
+ public DepthController getDepthController() {
BaseQuickstepLauncher launcher = getCreatedActivity();
if (launcher == null) {
return null;
}
- return launcher.getBackgroundBlurController();
+ return launcher.getDepthController();
}
}
\ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
index 3328abc..de38d13 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherSwipeHandler.java
@@ -294,7 +294,7 @@
}
setupRecentsViewUi();
- mActivityInterface.getBackgroundBlurController().setSurfaceToLauncher(mRecentsView);
+ mActivityInterface.getDepthController().setSurfaceToLauncher(mRecentsView);
if (mDeviceState.getNavMode() == TWO_BUTTONS) {
// If the device is in two button mode, swiping up will show overview with predictions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
index 3ab0f19..42d944f 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/RecentsActivity.java
@@ -186,7 +186,7 @@
AppWindowAnimationHelper helper = new AppWindowAnimationHelper(
mFallbackRecentsView.getPagedViewOrientedState(), this);
Animator recentsAnimator = getRecentsWindowAnimator(taskView, !activityClosing, appTargets,
- wallpaperTargets, null /* backgroundBlurController */,
+ wallpaperTargets, null /* depthController */,
helper);
target.play(recentsAnimator.setDuration(RECENTS_LAUNCH_DURATION));
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java
index 38b86ce..7ec083e 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskViewUtils.java
@@ -19,7 +19,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.anim.Interpolators.TOUCH_RESPONSE_INTERPOLATOR;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
-import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
+import static com.android.launcher3.uioverrides.DepthController.DEPTH;
import static com.android.systemui.shared.system.RemoteAnimationTargetCompat.MODE_OPENING;
import android.animation.Animator;
@@ -35,7 +35,7 @@
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.Utilities;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.MultiValueUpdateListener;
import com.android.quickstep.views.RecentsView;
@@ -123,7 +123,7 @@
public static Animator getRecentsWindowAnimator(TaskView v, boolean skipViewChanges,
RemoteAnimationTargetCompat[] appTargets,
RemoteAnimationTargetCompat[] wallpaperTargets,
- BackgroundBlurController backgroundBlurController,
+ DepthController depthController,
final AppWindowAnimationHelper inOutHelper) {
SyncRtSurfaceTransactionApplierCompat applier =
new SyncRtSurfaceTransactionApplierCompat(v);
@@ -215,9 +215,9 @@
}
});
- if (backgroundBlurController != null) {
- ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofInt(backgroundBlurController,
- BACKGROUND_BLUR, BACKGROUND_APP.getBackgroundBlurRadius(v.getContext()));
+ if (depthController != null) {
+ ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController,
+ DEPTH, BACKGROUND_APP.getDepth(v.getContext()));
animatorSet.playTogether(appAnimator, backgroundRadiusAnim);
} else {
animatorSet.play(appAnimator);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
index 3ed7530..a027fea 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java
@@ -46,9 +46,9 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
-import com.android.launcher3.states.RotationHelper;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.config.FeatureFlags;
+import com.android.launcher3.states.RotationHelper;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.views.ScrimView;
@@ -409,7 +409,7 @@
}
@Override
- protected BackgroundBlurController getBackgroundBlurController() {
- return mActivity.getBackgroundBlurController();
+ protected DepthController getDepthController() {
+ return mActivity.getDepthController();
}
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
index e15ac46..4917cbe 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java
@@ -29,7 +29,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_ACTIONS;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
-import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
+import static com.android.launcher3.uioverrides.DepthController.DEPTH;
import static com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController.SUCCESS_TRANSITION_PROGRESS;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON;
@@ -97,7 +97,7 @@
import com.android.launcher3.graphics.RotationMode;
import com.android.launcher3.states.RotationHelper;
import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
@@ -1702,11 +1702,11 @@
appWindowAnimationHelper.prepareAnimation(mActivity.getDeviceProfile(), true /* isOpening */);
AnimatorSet anim = createAdjacentPageAnimForTaskLaunch(tv, appWindowAnimationHelper);
- BackgroundBlurController blurController = getBackgroundBlurController();
- if (blurController != null) {
- ObjectAnimator backgroundBlur = ObjectAnimator.ofInt(blurController, BACKGROUND_BLUR,
- BACKGROUND_APP.getBackgroundBlurRadius(mActivity));
- anim.play(backgroundBlur);
+ DepthController depthController = getDepthController();
+ if (depthController != null) {
+ ObjectAnimator depthAnimator = ObjectAnimator.ofFloat(depthController, DEPTH,
+ BACKGROUND_APP.getDepth(mActivity));
+ anim.play(depthAnimator);
}
anim.play(progressAnim);
anim.setDuration(duration).setInterpolator(interpolator);
@@ -2009,7 +2009,7 @@
}
@Nullable
- protected BackgroundBlurController getBackgroundBlurController() {
+ protected DepthController getDepthController() {
return null;
}
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index a7d00c5..ec66f11 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -244,7 +244,7 @@
return new StateHandler[] {
getAllAppsController(),
getWorkspace(),
- getBackgroundBlurController(),
+ getDepthController(),
new RecentsViewStateController(this),
new BackButtonAlphaHandler(this)};
}
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 1b39242..a366f08 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -33,7 +33,7 @@
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.KEYGUARD_ANIMATION;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_TRANSITIONS;
-import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
+import static com.android.launcher3.uioverrides.DepthController.DEPTH;
import static com.android.launcher3.views.FloatingIconView.SHAPE_PROGRESS_DURATION;
import static com.android.quickstep.TaskUtils.taskIsATargetWithMode;
import static com.android.systemui.shared.system.QuickStepContract.getWindowCornerRadius;
@@ -73,7 +73,7 @@
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.shortcuts.DeepShortcutView;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.launcher3.util.DynamicResource;
import com.android.launcher3.util.MultiValueAlpha;
import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
@@ -596,17 +596,17 @@
// When launching an app from overview that doesn't map to a task, we still want to just
// blur the wallpaper instead of the launcher surface as well
boolean allowBlurringLauncher = mLauncher.getStateManager().getState() != OVERVIEW;
- BackgroundBlurController blurController = mLauncher.getBackgroundBlurController();
- ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofInt(blurController, BACKGROUND_BLUR,
- BACKGROUND_APP.getBackgroundBlurRadius(mLauncher))
+ DepthController depthController = mLauncher.getDepthController();
+ ObjectAnimator backgroundRadiusAnim = ObjectAnimator.ofFloat(depthController, DEPTH,
+ BACKGROUND_APP.getDepth(mLauncher))
.setDuration(APP_LAUNCH_DURATION);
if (allowBlurringLauncher) {
- blurController.setSurfaceToApp(RemoteAnimationProvider.findLowestOpaqueLayerTarget(
+ depthController.setSurfaceToApp(RemoteAnimationProvider.findLowestOpaqueLayerTarget(
appTargets, MODE_OPENING));
backgroundRadiusAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
- blurController.setSurfaceToLauncher(mLauncher.getDragLayer());
+ depthController.setSurfaceToLauncher(mLauncher.getDragLayer());
}
});
}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/BackgroundBlurController.java b/quickstep/src/com/android/launcher3/uioverrides/BackgroundBlurController.java
deleted file mode 100644
index 513310e..0000000
--- a/quickstep/src/com/android/launcher3/uioverrides/BackgroundBlurController.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2020 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.launcher3.uioverrides;
-
-import static com.android.launcher3.anim.Interpolators.LINEAR;
-
-import android.util.IntProperty;
-import android.view.View;
-
-import com.android.launcher3.Launcher;
-import com.android.launcher3.LauncherState;
-import com.android.launcher3.LauncherStateManager;
-import com.android.launcher3.R;
-import com.android.launcher3.Utilities;
-import com.android.launcher3.anim.PendingAnimation;
-import com.android.launcher3.states.StateAnimationConfig;
-import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
-import com.android.systemui.shared.system.SurfaceControlCompat;
-import com.android.systemui.shared.system.TransactionCompat;
-
-/**
- * Controls the blur, for the Launcher surface only.
- */
-public class BackgroundBlurController implements LauncherStateManager.StateHandler {
-
- public static final IntProperty<BackgroundBlurController> BACKGROUND_BLUR =
- new IntProperty<BackgroundBlurController>("backgroundBlur") {
- @Override
- public void setValue(BackgroundBlurController blurController, int blurRadius) {
- blurController.setBackgroundBlurRadius(blurRadius);
- }
-
- @Override
- public Integer get(BackgroundBlurController blurController) {
- return blurController.mBackgroundBlurRadius;
- }
- };
-
- /**
- * A property that updates the background blur within a given range of values (ie. even if the
- * animator goes beyond 0..1, the interpolated value will still be bounded).
- */
- public static class ClampedBlurProperty extends IntProperty<BackgroundBlurController> {
- private final int mMinValue;
- private final int mMaxValue;
-
- public ClampedBlurProperty(int minValue, int maxValue) {
- super(("backgroundBlurClamped"));
- mMinValue = minValue;
- mMaxValue = maxValue;
- }
-
- @Override
- public void setValue(BackgroundBlurController blurController, int blurRadius) {
- blurController.setBackgroundBlurRadius(Utilities.boundToRange(blurRadius,
- mMinValue, mMaxValue));
- }
-
- @Override
- public Integer get(BackgroundBlurController blurController) {
- return blurController.mBackgroundBlurRadius;
- }
- }
-
- private final Launcher mLauncher;
- private SurfaceControlCompat mSurface;
- private int mBackgroundBlurRadius;
-
- public BackgroundBlurController(Launcher l) {
- mLauncher = l;
- }
-
- /**
- * @return the background blur adjustment for folders
- */
- public int getFolderBackgroundBlurAdjustment() {
- return mLauncher.getResources().getInteger(
- R.integer.folder_background_blur_radius_adjustment);
- }
-
- /**
- * Sets the specified app target surface to apply the blur to.
- */
- public void setSurfaceToApp(RemoteAnimationTargetCompat target) {
- if (target != null) {
- setSurface(target.leash);
- }
- }
-
- /**
- * Sets the surface to apply the blur to as the launcher surface.
- */
- public void setSurfaceToLauncher(View v) {
- setSurface(v != null ? new SurfaceControlCompat(v) : null);
- }
-
- private void setSurface(SurfaceControlCompat surface) {
- if (mSurface != surface) {
- mSurface = surface;
- if (surface != null) {
- setBackgroundBlurRadius(mBackgroundBlurRadius);
- } else {
- // If there is no surface, then reset the blur radius
- setBackgroundBlurRadius(0);
- }
- }
- }
-
- @Override
- public void setState(LauncherState toState) {
- if (mSurface == null) {
- return;
- }
-
- int toBackgroundBlurRadius = toState.getBackgroundBlurRadius(mLauncher);
- if (mBackgroundBlurRadius != toBackgroundBlurRadius) {
- setBackgroundBlurRadius(toBackgroundBlurRadius);
- }
- }
-
- @Override
- public void setStateWithAnimation(LauncherState toState, StateAnimationConfig config,
- PendingAnimation animation) {
- if (mSurface == null || config.onlyPlayAtomicComponent()) {
- return;
- }
-
- int toBackgroundBlurRadius = toState.getBackgroundBlurRadius(mLauncher);
- if (mBackgroundBlurRadius != toBackgroundBlurRadius) {
- animation.setInt(this, BACKGROUND_BLUR, toBackgroundBlurRadius, LINEAR);
- }
- }
-
- private void setBackgroundBlurRadius(int blurRadius) {
- // TODO: Do nothing if the shadows are not enabled
- // Always update the background blur as it will be reapplied when a surface is next
- // available
- mBackgroundBlurRadius = blurRadius;
- if (mSurface == null || !mSurface.isValid()) {
- return;
- }
- new TransactionCompat()
- .setBackgroundBlurRadius(mSurface, blurRadius)
- .apply();
- }
-}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/DepthController.java b/quickstep/src/com/android/launcher3/uioverrides/DepthController.java
new file mode 100644
index 0000000..8995a7e
--- /dev/null
+++ b/quickstep/src/com/android/launcher3/uioverrides/DepthController.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.launcher3.uioverrides;
+
+import static com.android.launcher3.anim.Interpolators.LINEAR;
+
+import android.os.IBinder;
+import android.util.FloatProperty;
+import android.view.View;
+
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.LauncherStateManager;
+import com.android.launcher3.R;
+import com.android.launcher3.Utilities;
+import com.android.launcher3.anim.PendingAnimation;
+import com.android.launcher3.states.StateAnimationConfig;
+import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+import com.android.systemui.shared.system.SurfaceControlCompat;
+import com.android.systemui.shared.system.TransactionCompat;
+import com.android.systemui.shared.system.WallpaperManagerCompat;
+
+/**
+ * Controls blur and wallpaper zoom, for the Launcher surface only.
+ */
+public class DepthController implements LauncherStateManager.StateHandler {
+
+ public static final FloatProperty<DepthController> DEPTH =
+ new FloatProperty<DepthController>("depth") {
+ @Override
+ public void setValue(DepthController depthController, float depth) {
+ depthController.setDepth(depth);
+ }
+
+ @Override
+ public Float get(DepthController depthController) {
+ return depthController.mDepth;
+ }
+ };
+
+ /**
+ * A property that updates the background blur within a given range of values (ie. even if the
+ * animator goes beyond 0..1, the interpolated value will still be bounded).
+ */
+ public static class ClampedDepthProperty extends FloatProperty<DepthController> {
+ private final float mMinValue;
+ private final float mMaxValue;
+
+ public ClampedDepthProperty(float minValue, float maxValue) {
+ super("depthClamped");
+ mMinValue = minValue;
+ mMaxValue = maxValue;
+ }
+
+ @Override
+ public void setValue(DepthController depthController, float depth) {
+ depthController.setDepth(Utilities.boundToRange(depth, mMinValue, mMaxValue));
+ }
+
+ @Override
+ public Float get(DepthController depthController) {
+ return depthController.mDepth;
+ }
+ }
+
+ private final Launcher mLauncher;
+ /**
+ * Blur radius when completely zoomed out, in pixels.
+ */
+ private int mMaxBlurRadius;
+ private WallpaperManagerCompat mWallpaperManager;
+ private SurfaceControlCompat mSurface;
+ /**
+ * Ratio from 0 to 1, where 0 is fully zoomed out, and 1 is zoomed in.
+ * @see android.service.wallpaper.WallpaperService.Engine#onZoomChanged(float)
+ */
+ private float mDepth;
+
+ public DepthController(Launcher l) {
+ mLauncher = l;
+ }
+
+ private void ensureDependencies() {
+ if (mWallpaperManager != null) {
+ return;
+ }
+ mMaxBlurRadius = mLauncher.getResources().getInteger(R.integer.max_depth_blur_radius);
+ mWallpaperManager = new WallpaperManagerCompat(mLauncher);
+ }
+
+ /**
+ * Sets the specified app target surface to apply the blur to.
+ */
+ public void setSurfaceToApp(RemoteAnimationTargetCompat target) {
+ if (target != null) {
+ setSurface(target.leash);
+ }
+ }
+
+ /**
+ * Sets the surface to apply the blur to as the launcher surface.
+ */
+ public void setSurfaceToLauncher(View v) {
+ setSurface(v != null ? new SurfaceControlCompat(v) : null);
+ }
+
+ private void setSurface(SurfaceControlCompat surface) {
+ if (mSurface != surface) {
+ mSurface = surface;
+ if (surface != null) {
+ setDepth(mDepth);
+ } else {
+ // If there is no surface, then reset the ratio
+ setDepth(0f);
+ }
+ }
+ }
+
+ @Override
+ public void setState(LauncherState toState) {
+ if (mSurface == null) {
+ return;
+ }
+
+ float toDepth = toState.getDepth(mLauncher);
+ if (Float.compare(mDepth, toDepth) != 0) {
+ setDepth(toDepth);
+ }
+ }
+
+ @Override
+ public void setStateWithAnimation(LauncherState toState, StateAnimationConfig config,
+ PendingAnimation animation) {
+ if (mSurface == null || config.onlyPlayAtomicComponent()) {
+ return;
+ }
+
+ float toDepth = toState.getDepth(mLauncher);
+ if (Float.compare(mDepth, toDepth) != 0) {
+ animation.setFloat(this, DEPTH, toDepth, LINEAR);
+ }
+ }
+
+ private void setDepth(float depth) {
+ mDepth = depth;
+ if (mSurface == null || !mSurface.isValid()) {
+ return;
+ }
+ ensureDependencies();
+ IBinder windowToken = mLauncher.getRootView().getWindowToken();
+ if (windowToken != null) {
+ mWallpaperManager.setWallpaperZoomOut(windowToken, mDepth);
+ }
+ new TransactionCompat()
+ .setBackgroundBlurRadius(mSurface, (int) (mDepth * mMaxBlurRadius))
+ .apply();
+ }
+}
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
index 971d917..93e02a1 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/AllAppsState.java
@@ -22,7 +22,6 @@
import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
-import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.SysUINavigationMode;
@@ -88,8 +87,8 @@
}
@Override
- public int getBackgroundBlurRadius(Context context) {
- return context.getResources().getInteger(R.integer.allapps_background_blur_radius);
+ public float getDepth(Context context) {
+ return 1f;
}
@Override
diff --git a/quickstep/src/com/android/quickstep/BaseActivityInterface.java b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
index be0bdd8..2a569f5 100644
--- a/quickstep/src/com/android/quickstep/BaseActivityInterface.java
+++ b/quickstep/src/com/android/quickstep/BaseActivityInterface.java
@@ -33,7 +33,7 @@
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.touch.PagedOrientationHandler;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.ShelfPeekAnim;
import com.android.systemui.shared.recents.model.ThumbnailData;
@@ -81,7 +81,8 @@
@Nullable
T getCreatedActivity();
- default @Nullable BackgroundBlurController getBackgroundBlurController() {
+ @Nullable
+ default DepthController getDepthController() {
return null;
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 1413a5c..921d34a 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -124,7 +124,7 @@
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.AllAppsSwipeController;
import com.android.launcher3.touch.ItemClickHandler;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
+import com.android.launcher3.uioverrides.DepthController;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
@@ -326,14 +326,14 @@
private boolean mDeferOverlayCallbacks;
private final Runnable mDeferredOverlayCallbacks = this::checkIfOverlayStillDeferred;
- private BackgroundBlurController mBackgroundBlurController =
- new BackgroundBlurController(this);
+ private DepthController mDepthController =
+ new DepthController(this);
private final ViewTreeObserver.OnDrawListener mOnDrawListener =
new ViewTreeObserver.OnDrawListener() {
@Override
public void onDraw() {
- getBackgroundBlurController().setSurfaceToLauncher(mDragLayer);
+ getDepthController().setSurfaceToLauncher(mDragLayer);
mDragLayer.post(() -> mDragLayer.getViewTreeObserver().removeOnDrawListener(
this));
}
@@ -954,7 +954,7 @@
NotificationListener.removeNotificationsChangedListener();
getStateManager().moveToRestState();
- getBackgroundBlurController().setSurfaceToLauncher(null);
+ getDepthController().setSurfaceToLauncher(null);
// Workaround for b/78520668, explicitly trim memory once UI is hidden
onTrimMemory(TRIM_MEMORY_UI_HIDDEN);
@@ -2708,7 +2708,7 @@
protected StateHandler[] createStateHandlers() {
return new StateHandler[] { getAllAppsController(), getWorkspace(),
- getBackgroundBlurController() };
+ getDepthController() };
}
public TouchController[] createTouchControllers() {
@@ -2745,8 +2745,8 @@
return Stream.of(APP_INFO, WIDGETS, INSTALL);
}
- public BackgroundBlurController getBackgroundBlurController() {
- return mBackgroundBlurController;
+ public DepthController getDepthController() {
+ return mDepthController;
}
public static Launcher getLauncher(Context context) {
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index df71f16..6ee82cd 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -271,11 +271,13 @@
}
/**
- * The amount of blur to apply to the background of either the app or Launcher surface in this
- * state.
+ * The amount of blur and wallpaper zoom to apply to the background of either the app
+ * or Launcher surface in this state. Should be a number between 0 and 1, inclusive.
+ *
+ * 0 means completely zoomed in, without blurs. 1 is zoomed out, with blurs.
*/
- public int getBackgroundBlurRadius(Context context) {
- return 0;
+ public float getDepth(Context context) {
+ return 0f;
}
public String getDescription(Launcher launcher) {
diff --git a/src/com/android/launcher3/folder/FolderAnimationManager.java b/src/com/android/launcher3/folder/FolderAnimationManager.java
index f72e674..b83609e 100644
--- a/src/com/android/launcher3/folder/FolderAnimationManager.java
+++ b/src/com/android/launcher3/folder/FolderAnimationManager.java
@@ -21,7 +21,6 @@
import static com.android.launcher3.folder.ClippedFolderIconLayoutRule.MAX_NUM_ITEMS_IN_PREVIEW;
import static com.android.launcher3.graphics.IconShape.getShape;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
-import static com.android.launcher3.uioverrides.BackgroundBlurController.BACKGROUND_BLUR;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -47,7 +46,6 @@
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.PropertyResetListener;
import com.android.launcher3.dragndrop.DragLayer;
-import com.android.launcher3.uioverrides.BackgroundBlurController;
import com.android.launcher3.util.Themes;
import java.util.List;
@@ -222,14 +220,6 @@
Animator z = getAnimator(mFolder, View.TRANSLATION_Z, -mFolder.getElevation(), 0);
play(a, z, mIsOpening ? midDuration : 0, midDuration);
- BackgroundBlurController blurController = mLauncher.getBackgroundBlurController();
- int stateBackgroundBlur = mLauncher.getStateManager().getState()
- .getBackgroundBlurRadius(mLauncher);
- int folderBackgroundBlurAdjustment = blurController.getFolderBackgroundBlurAdjustment();
- play(a, ObjectAnimator.ofInt(blurController, BACKGROUND_BLUR, mIsOpening
- ? stateBackgroundBlur + folderBackgroundBlurAdjustment
- : stateBackgroundBlur));
-
// Store clip variables
CellLayout cellLayout = mContent.getCurrentCellLayout();
boolean folderClipChildren = mFolder.getClipChildren();
diff --git a/src_ui_overrides/com/android/launcher3/uioverrides/BackgroundBlurController.java b/src_ui_overrides/com/android/launcher3/uioverrides/DepthController.java
similarity index 66%
rename from src_ui_overrides/com/android/launcher3/uioverrides/BackgroundBlurController.java
rename to src_ui_overrides/com/android/launcher3/uioverrides/DepthController.java
index 75f99a9..7ad85e2 100644
--- a/src_ui_overrides/com/android/launcher3/uioverrides/BackgroundBlurController.java
+++ b/src_ui_overrides/com/android/launcher3/uioverrides/DepthController.java
@@ -17,7 +17,7 @@
package com.android.launcher3.uioverrides;
-import android.util.IntProperty;
+import android.util.FloatProperty;
import android.view.View;
import com.android.launcher3.Launcher;
@@ -27,26 +27,22 @@
import com.android.launcher3.states.StateAnimationConfig;
/**
- * Controls the blur, for the Launcher surface only.
+ * Controls blur and wallpaper zoom, for the Launcher surface only.
*/
-public class BackgroundBlurController implements LauncherStateManager.StateHandler {
+public class DepthController implements LauncherStateManager.StateHandler {
- public static final IntProperty<BackgroundBlurController> BACKGROUND_BLUR =
- new IntProperty<BackgroundBlurController>("backgroundBlur") {
+ public static final FloatProperty<DepthController> DEPTH =
+ new FloatProperty<DepthController>("depth") {
@Override
- public void setValue(BackgroundBlurController blurController, int blurRadius) {}
+ public void setValue(DepthController depthController, float depth) {}
@Override
- public Integer get(BackgroundBlurController blurController) {
- return 0;
+ public Float get(DepthController depthController) {
+ return 0f;
}
};
- public BackgroundBlurController(Launcher l) {}
-
- public int getFolderBackgroundBlurAdjustment() {
- return 0;
- }
+ public DepthController(Launcher l) {}
public void setSurfaceToLauncher(View v) {}