Merge "Fixing various quickscrup controls for fallback activity" into ub-launcher3-edmonton
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index a63e306..f9dcee0 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -15,6 +15,7 @@
*/
package com.android.quickstep;
+import static com.android.launcher3.LauncherAnimUtils.OVERVIEW_TRANSITION_MS;
import static com.android.launcher3.LauncherState.FAST_OVERVIEW;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.allapps.AllAppsTransitionController.ALL_APPS_PROGRESS;
@@ -24,10 +25,15 @@
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
+import android.annotation.TargetApi;
+import android.app.ActivityManager.RunningTaskInfo;
+import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Rect;
+import android.os.Build;
import android.os.Handler;
+import android.os.Looper;
import android.support.annotation.Nullable;
import android.support.annotation.UiThread;
import android.view.View;
@@ -52,21 +58,23 @@
import com.android.quickstep.views.RecentsViewContainer;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+import java.util.Objects;
import java.util.function.BiPredicate;
import java.util.function.Consumer;
/**
* Utility class which abstracts out the logical differences between Launcher and RecentsActivity.
*/
+@TargetApi(Build.VERSION_CODES.P)
public interface ActivityControlHelper<T extends BaseDraggingActivity> {
LayoutListener createLayoutListener(T activity);
/**
* Updates the UI to indicate quick interaction.
- * @return true if there any any UI change as a result of this
*/
- boolean onQuickInteractionStart(T activity, boolean activityVisible);
+ void onQuickInteractionStart(T activity, @Nullable RunningTaskInfo taskInfo,
+ boolean activityVisible);
float getTranslationYForQuickScrub(T activity);
@@ -120,10 +128,14 @@
}
@Override
- public boolean onQuickInteractionStart(Launcher activity, boolean activityVisible) {
+ public void onQuickInteractionStart(Launcher activity, RunningTaskInfo taskInfo,
+ boolean activityVisible) {
LauncherState fromState = activity.getStateManager().getState();
activity.getStateManager().goToState(FAST_OVERVIEW, activityVisible);
- return !fromState.overviewUi;
+
+ QuickScrubController controller = activity.<RecentsView>getOverviewPanel()
+ .getQuickScrubController();
+ controller.onQuickScrubStart(activityVisible && !fromState.overviewUi, this);
}
@Override
@@ -311,10 +323,27 @@
class FallbackActivityControllerHelper implements ActivityControlHelper<RecentsActivity> {
+ private final ComponentName mHomeComponent;
+ private final Handler mUiHandler = new Handler(Looper.getMainLooper());
+
+ public FallbackActivityControllerHelper(ComponentName homeComponent) {
+ mHomeComponent = homeComponent;
+ }
+
@Override
- public boolean onQuickInteractionStart(RecentsActivity activity, boolean activityVisible) {
- // Activity does not need any UI change for quickscrub.
- return false;
+ public void onQuickInteractionStart(RecentsActivity activity, RunningTaskInfo taskInfo,
+ boolean activityVisible) {
+ QuickScrubController controller = activity.<RecentsView>getOverviewPanel()
+ .getQuickScrubController();
+
+ // TODO: match user is as well
+ boolean startingFromHome = !activityVisible &&
+ (taskInfo == null || Objects.equals(taskInfo.topActivity, mHomeComponent));
+ controller.onQuickScrubStart(startingFromHome, this);
+ if (activityVisible) {
+ mUiHandler.postDelayed(controller::onFinishedTransitionToQuickScrub,
+ OVERVIEW_TRANSITION_MS);
+ }
}
@Override
@@ -465,6 +494,7 @@
public AlphaProperty getAlphaProperty(RecentsActivity activity) {
return activity.getDragLayer().getAlphaProperty(0);
}
+
}
interface LayoutListener {
diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
index 3ec2d23..bde3625 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -138,7 +138,7 @@
} else {
// The default home app is a different launcher. Use the fallback Overview instead.
overviewComponent = new ComponentName(mContext, RecentsActivity.class);
- mActivityControlHelper = new FallbackActivityControllerHelper();
+ mActivityControlHelper = new FallbackActivityControllerHelper(defaultHome);
overviewIntentCategory = Intent.CATEGORY_DEFAULT;
// User's default home app can change as a result of package updates of this app (such
diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java
index 3babd1f..7496b47 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -350,8 +350,7 @@
mStartPending = true;
Runnable action = () -> {
- mQuickScrubController.onQuickScrubStart(mActivityHelper.onQuickInteractionStart(
- mActivity, true), mActivityHelper);
+ mActivityHelper.onQuickInteractionStart(mActivity, null, true);
mQuickScrubController.onQuickScrubProgress(mLastProgress);
mStartPending = false;
diff --git a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
index a88b8cd..645e749 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -171,6 +171,7 @@
private final ActivityInitListener mActivityInitListener;
private final int mRunningTaskId;
+ private final RunningTaskInfo mRunningTaskInfo;
private ThumbnailData mTaskSnapshot;
private MultiStateCallback mStateCallback;
@@ -207,6 +208,7 @@
WindowTransformSwipeHandler(RunningTaskInfo runningTaskInfo, Context context, long touchTimeMs,
ActivityControlHelper<T> controller) {
mContext = context;
+ mRunningTaskInfo = runningTaskInfo;
mRunningTaskId = runningTaskInfo.id;
mTouchTimeMs = touchTimeMs;
mActivityControlHelper = controller;
@@ -772,8 +774,7 @@
mLauncherTransitionController = null;
}
- mActivityControlHelper.onQuickInteractionStart(mActivity, false);
- mQuickScrubController.onQuickScrubStart(false, mActivityControlHelper);
+ mActivityControlHelper.onQuickInteractionStart(mActivity, mRunningTaskInfo, false);
// Inform the last progress in case we skipped before.
mQuickScrubController.onQuickScrubProgress(mCurrentQuickScrubProgress);
diff --git a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
index fb4aa02..9e2de33 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -35,6 +35,7 @@
public FallbackRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setOverviewStateEnabled(true);
+ getQuickScrubController().onFinishedTransitionToQuickScrub();
}
@Override