summaryrefslogtreecommitdiffstats
path: root/quickstep
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-05-11 23:12:13 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-05-11 23:12:13 +0000
commitfce7861620c29c990bbbd7993d94581a98472085 (patch)
tree49352bb666e6f5339eab0c8e3f80fee44f826014 /quickstep
parent6e180fdee5eb26cce398e58c659cfc7e1f0f1381 (diff)
parent9829060491919e7651b9437181e9e8e1ffd8633f (diff)
downloadandroid_packages_apps_Trebuchet-fce7861620c29c990bbbd7993d94581a98472085.tar.gz
android_packages_apps_Trebuchet-fce7861620c29c990bbbd7993d94581a98472085.tar.bz2
android_packages_apps_Trebuchet-fce7861620c29c990bbbd7993d94581a98472085.zip
Merge "Fixing various quickscrup controls for fallback activity" into ub-launcher3-edmonton
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/quickstep/ActivityControlHelper.java44
-rw-r--r--quickstep/src/com/android/quickstep/OverviewCommandHelper.java2
-rw-r--r--quickstep/src/com/android/quickstep/TouchInteractionService.java3
-rw-r--r--quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java5
-rw-r--r--quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java1
5 files changed, 43 insertions, 12 deletions
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index a63e3062b..f9dcee05b 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 static com.android.systemui.shared.system.NavigationBarCompat.HIT_TARGET_
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.RecentsView;
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 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
}
@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 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
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 interface ActivityControlHelper<T extends BaseDraggingActivity> {
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 3ec2d23bb..bde36255e 100644
--- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
+++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java
@@ -138,7 +138,7 @@ public class OverviewCommandHelper {
} 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 3babd1ffd..7496b4782 100644
--- a/quickstep/src/com/android/quickstep/TouchInteractionService.java
+++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java
@@ -350,8 +350,7 @@ public class TouchInteractionService extends Service {
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 a88b8cd96..645e749c5 100644
--- a/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -171,6 +171,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
private final ActivityInitListener mActivityInitListener;
private final int mRunningTaskId;
+ private final RunningTaskInfo mRunningTaskInfo;
private ThumbnailData mTaskSnapshot;
private MultiStateCallback mStateCallback;
@@ -207,6 +208,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
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 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
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 fb4aa0265..9e2de3395 100644
--- a/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
+++ b/quickstep/src/com/android/quickstep/fallback/FallbackRecentsView.java
@@ -35,6 +35,7 @@ public class FallbackRecentsView extends RecentsView<RecentsActivity> {
public FallbackRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
setOverviewStateEnabled(true);
+ getQuickScrubController().onFinishedTransitionToQuickScrub();
}
@Override