Merge "Handling Launcher configuration change between touchDown and Launcher.onStart" into ub-launcher3-rvc-dev
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 a19026b..846b944 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
@@ -31,6 +31,7 @@
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
+import android.os.UserHandle;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.Surface;
@@ -42,6 +43,7 @@
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.appprediction.PredictionUiStateManager;
import com.android.launcher3.appprediction.PredictionUiStateManager.Client;
+import com.android.launcher3.model.AppLaunchTracker;
import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StateManager.StateListener;
import com.android.launcher3.uioverrides.plugins.PluginManagerWrapper;
@@ -52,6 +54,7 @@
import com.android.quickstep.util.TransformParams;
import com.android.systemui.plugins.PluginListener;
import com.android.systemui.plugins.RecentsExtraCard;
+import com.android.systemui.shared.recents.model.Task;
/**
* {@link RecentsView} used in Launcher activity
@@ -167,14 +170,21 @@
}
@Override
- protected void onTaskLaunched(boolean success) {
+ protected void onTaskLaunchAnimationEnd(boolean success) {
if (success) {
mActivity.getStateManager().goToState(NORMAL, false /* animate */);
} else {
LauncherState state = mActivity.getStateManager().getState();
mActivity.getAllAppsController().setState(state);
}
- super.onTaskLaunched(success);
+ super.onTaskLaunchAnimationEnd(success);
+ }
+
+ @Override
+ public void onTaskLaunched(Task task) {
+ UserHandle user = UserHandle.of(task.key.userId);
+ AppLaunchTracker.INSTANCE.get(getContext()).onStartApp(task.getTopComponent(), user,
+ AppLaunchTracker.CONTAINER_OVERVIEW);
}
@Override
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 92e3746..68b8975 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
@@ -1966,7 +1966,7 @@
mPendingAnimation.addEndListener((endState) -> {
if (endState.isSuccess) {
Consumer<Boolean> onLaunchResult = (result) -> {
- onTaskLaunched(result);
+ onTaskLaunchAnimationEnd(result);
if (!result) {
tv.notifyTaskLaunchFailed(TAG);
}
@@ -1981,7 +1981,7 @@
.log(LAUNCHER_TASK_LAUNCH_SWIPE_DOWN);
}
} else {
- onTaskLaunched(false);
+ onTaskLaunchAnimationEnd(false);
}
mPendingAnimation = null;
});
@@ -1993,12 +1993,17 @@
public abstract boolean shouldUseMultiWindowTaskSizeStrategy();
- protected void onTaskLaunched(boolean success) {
+ protected void onTaskLaunchAnimationEnd(boolean success) {
if (success) {
resetTaskVisuals();
}
}
+ /**
+ * Called when task activity is launched
+ */
+ public void onTaskLaunched(Task task){ }
+
@Override
protected void notifyPageSwitchListener(int prevPage) {
super.notifyPageSwitchListener(prevPage);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
index 82fabac..222f6e6 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java
@@ -30,7 +30,8 @@
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.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS;
+import static com.android.launcher3.logging.StatsLogManager.LauncherEvent
+ .LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP;
import android.animation.Animator;
@@ -384,6 +385,7 @@
}
}, resultCallbackHandler);
}
+ getRecentsView().onTaskLaunched(mTask);
}
}
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index d2e0339..47ce320 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -83,6 +83,7 @@
super.onCreate(savedInstanceState);
SysUINavigationMode.INSTANCE.get(this).addModeChangeListener(this);
+ addMultiWindowModeChangedListener(mDepthController);
}
@Override
diff --git a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
index 2b08dcd..fe8f0c6 100644
--- a/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
+++ b/quickstep/src/com/android/launcher3/statehandlers/DepthController.java
@@ -20,11 +20,15 @@
import static com.android.launcher3.states.StateAnimationConfig.ANIM_DEPTH;
import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER;
+import android.animation.Animator;
+import android.animation.AnimatorListenerAdapter;
+import android.animation.ObjectAnimator;
import android.os.IBinder;
import android.util.FloatProperty;
import android.view.View;
import android.view.ViewTreeObserver;
+import com.android.launcher3.BaseActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
@@ -41,7 +45,8 @@
/**
* Controls blur and wallpaper zoom, for the Launcher surface only.
*/
-public class DepthController implements StateHandler<LauncherState> {
+public class DepthController implements StateHandler<LauncherState>,
+ BaseActivity.MultiWindowModeChangedListener {
public static final FloatProperty<DepthController> DEPTH =
new FloatProperty<DepthController>("depth") {
@@ -104,6 +109,9 @@
*/
private float mDepth;
+ // Workaround for animating the depth when multiwindow mode changes.
+ private boolean mIgnoreStateChangesDuringMultiWindowAnimation = false;
+
private View.OnAttachStateChangeListener mOnAttachListener;
public DepthController(Launcher l) {
@@ -171,7 +179,7 @@
@Override
public void setState(LauncherState toState) {
- if (mSurface == null) {
+ if (mSurface == null || mIgnoreStateChangesDuringMultiWindowAnimation) {
return;
}
@@ -186,7 +194,8 @@
PendingAnimation animation) {
if (mSurface == null
|| config.onlyPlayAtomicComponent()
- || config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)) {
+ || config.hasAnimationFlag(SKIP_DEPTH_CONTROLLER)
+ || mIgnoreStateChangesDuringMultiWindowAnimation) {
return;
}
@@ -231,4 +240,21 @@
.apply();
}
}
+
+ @Override
+ public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
+ mIgnoreStateChangesDuringMultiWindowAnimation = true;
+
+ ObjectAnimator mwAnimation = ObjectAnimator.ofFloat(this, DEPTH,
+ mLauncher.getStateManager().getState().getDepth(mLauncher, isInMultiWindowMode))
+ .setDuration(300);
+ mwAnimation.addListener(new AnimatorListenerAdapter() {
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ mIgnoreStateChangesDuringMultiWindowAnimation = false;
+ }
+ });
+ mwAnimation.setAutoCancel(true);
+ mwAnimation.start();
+ }
}
diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java
index 31bfc09..c78df62 100644
--- a/src/com/android/launcher3/LauncherState.java
+++ b/src/com/android/launcher3/LauncherState.java
@@ -226,7 +226,16 @@
* 0 means completely zoomed in, without blurs. 1 is zoomed out, with blurs.
*/
public final float getDepth(Context context) {
- if (BaseDraggingActivity.fromContext(context).getDeviceProfile().isMultiWindowMode) {
+ return getDepth(context,
+ BaseDraggingActivity.fromContext(context).getDeviceProfile().isMultiWindowMode);
+ }
+
+ /**
+ * Returns the amount of blur and wallpaper zoom for this state with {@param isMultiWindowMode}.
+ * @see #getDepth(Context).
+ */
+ public final float getDepth(Context context, boolean isMultiWindowMode) {
+ if (isMultiWindowMode) {
return 0;
}
return getDepthUnchecked(context);
diff --git a/src/com/android/launcher3/model/AppLaunchTracker.java b/src/com/android/launcher3/model/AppLaunchTracker.java
index 13ab033..629a0ee 100644
--- a/src/com/android/launcher3/model/AppLaunchTracker.java
+++ b/src/com/android/launcher3/model/AppLaunchTracker.java
@@ -40,6 +40,7 @@
public static final String CONTAINER_ALL_APPS = Integer.toString(ContainerType.ALLAPPS);
public static final String CONTAINER_PREDICTIONS = Integer.toString(ContainerType.PREDICTION);
public static final String CONTAINER_SEARCH = Integer.toString(ContainerType.SEARCHRESULT);
+ public static final String CONTAINER_OVERVIEW = Integer.toString(ContainerType.OVERVIEW);
public static final MainThreadInitializedObject<AppLaunchTracker> INSTANCE =