Merge "Tighten up dismiss animation springs." into ub-launcher3-master
diff --git a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
new file mode 100644
index 0000000..e1df3ba
--- /dev/null
+++ b/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (C) 2019 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.quickstep;
+
+import static com.android.launcher3.LauncherState.OVERVIEW;
+
+import android.app.ActivityManager;
+import android.content.Context;
+import android.graphics.Rect;
+
+import com.android.launcher3.DeviceProfile;
+import com.android.launcher3.Launcher;
+import com.android.launcher3.LauncherAppState;
+import com.android.launcher3.LauncherInitListener;
+import com.android.launcher3.LauncherState;
+import com.android.launcher3.anim.AnimatorPlaybackController;
+import com.android.launcher3.dragndrop.DragLayer;
+import com.android.launcher3.userevent.nano.LauncherLogProto;
+import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
+import com.android.quickstep.util.TransformedRect;
+import com.android.quickstep.views.IconRecentsView;
+import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
+
+import java.util.function.BiPredicate;
+import java.util.function.Consumer;
+
+/**
+ * {@link ActivityControlHelper} for the in-launcher recents. As Go does not support most gestures
+ * from app to overview/home, most of this class is stubbed out.
+ * TODO: Implement the app to overview animation functionality
+ */
+public final class LauncherActivityControllerHelper implements ActivityControlHelper<Launcher>{
+
+ @Override
+ public LayoutListener createLayoutListener(Launcher activity) {
+ // Go does not have draggable task snapshots.
+ return null;
+ }
+
+ @Override
+ public void onQuickInteractionStart(Launcher activity, ActivityManager.RunningTaskInfo taskInfo,
+ boolean activityVisible, TouchInteractionLog touchInteractionLog) {
+ // Go does not have quick interactions.
+ }
+
+ @Override
+ public float getTranslationYForQuickScrub(TransformedRect targetRect, DeviceProfile dp,
+ Context context) {
+ // Go does not have quick scrub.
+ return 0;
+ }
+
+ @Override
+ public void executeOnWindowAvailable(Launcher activity, Runnable action) {
+ // Go does not support live tiles.
+ }
+
+ @Override
+ public void onTransitionCancelled(Launcher activity, boolean activityVisible) {
+ LauncherState startState = activity.getStateManager().getRestState();
+ activity.getStateManager().goToState(startState, activityVisible);
+ }
+
+ @Override
+ public int getSwipeUpDestinationAndLength(DeviceProfile dp, Context context,
+ int interactionType, TransformedRect outRect) {
+ // TODO Implement outRect depending on where the task should animate to.
+ // Go does not support swipe up gesture.
+ return 0;
+ }
+
+ @Override
+ public void onSwipeUpComplete(Launcher activity) {
+ // Go does not support swipe up gesture.
+ }
+
+ @Override
+ public HomeAnimationFactory prepareHomeUI(Launcher activity) {
+ // Go does not support gestures from app to home.
+ return null;
+ }
+
+ @Override
+ public AnimationFactory prepareRecentsUI(Launcher activity,
+ boolean activityVisible, boolean animateActivity,
+ Consumer<AnimatorPlaybackController> callback) {
+ //TODO: Implement this based off where the recents view needs to be for app => recents anim.
+ return new AnimationFactory() {
+ @Override
+ public void createActivityController(long transitionLength,
+ @TouchConsumer.InteractionType int interactionType) {}
+
+ @Override
+ public void onTransitionCancelled() {}
+ };
+ }
+
+ @Override
+ public ActivityInitListener createActivityInitListener(
+ BiPredicate<Launcher, Boolean> onInitListener) {
+ return new LauncherInitListener(onInitListener);
+ }
+
+ @Override
+ public Launcher getCreatedActivity() {
+ LauncherAppState app = LauncherAppState.getInstanceNoCreate();
+ if (app == null) {
+ return null;
+ }
+ return (Launcher) app.getModel().getCallback();
+ }
+
+ private Launcher getVisibleLauncher() {
+ Launcher launcher = getCreatedActivity();
+ return (launcher != null) && launcher.isStarted() && launcher.hasWindowFocus() ?
+ launcher : null;
+ }
+
+ @Override
+ public IconRecentsView getVisibleRecentsView() {
+ Launcher launcher = getVisibleLauncher();
+ return launcher != null && launcher.getStateManager().getState().overviewUi
+ ? launcher.getOverviewPanel() : null;
+ }
+
+ @Override
+ public boolean switchToRecentsIfVisible(boolean fromRecentsButton) {
+ Launcher launcher = getVisibleLauncher();
+ if (launcher == null) {
+ return false;
+ }
+ if (fromRecentsButton) {
+ launcher.getUserEventDispatcher().logActionCommand(
+ LauncherLogProto.Action.Command.RECENTS_BUTTON,
+ getContainerType(),
+ LauncherLogProto.ContainerType.TASKSWITCHER);
+ }
+ launcher.getStateManager().goToState(OVERVIEW);
+ return true;
+ }
+
+ @Override
+ public Rect getOverviewWindowBounds(Rect homeBounds, RemoteAnimationTargetCompat target) {
+ return homeBounds;
+ }
+
+ @Override
+ public boolean shouldMinimizeSplitScreen() {
+ return true;
+ }
+
+ @Override
+ public boolean deferStartingActivity(int downHitTarget) {
+ // Go only supports back to overview so we always defer starting activity.
+ return true;
+ }
+
+ @Override
+ public boolean supportsLongSwipe(Launcher activity) {
+ // Go does not support long swipe from the app.
+ return false;
+ }
+
+ @Override
+ public AlphaProperty getAlphaProperty(Launcher activity) {
+ return activity.getDragLayer().getAlphaProperty(DragLayer.ALPHA_INDEX_SWIPE_UP);
+ }
+
+ @Override
+ public LongSwipeHelper getLongSwipeController(Launcher activity, int runningTaskId) {
+ // Go does not support long swipe from the app.
+ return null;
+ }
+
+ @Override
+ public int getContainerType() {
+ final Launcher launcher = getVisibleLauncher();
+ return launcher != null ? launcher.getStateManager().getState().containerType
+ : LauncherLogProto.ContainerType.APP;
+ }
+
+ @Override
+ public boolean isInLiveTileMode() {
+ // Go does not support live tiles.
+ return false;
+ }
+}
diff --git a/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
similarity index 96%
rename from quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
rename to quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index e8cc6fb..4df1b37 100644
--- a/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -371,7 +371,7 @@
@Nullable
@UiThread
- private Launcher getVisibleLaucher() {
+ private Launcher getVisibleLauncher() {
Launcher launcher = getCreatedActivity();
return (launcher != null) && launcher.isStarted() && launcher.hasWindowFocus() ?
launcher : null;
@@ -380,25 +380,25 @@
@Nullable
@Override
public RecentsView getVisibleRecentsView() {
- Launcher launcher = getVisibleLaucher();
+ Launcher launcher = getVisibleLauncher();
return launcher != null && launcher.getStateManager().getState().overviewUi
? launcher.getOverviewPanel() : null;
}
@Override
public boolean switchToRecentsIfVisible(boolean fromRecentsButton) {
- Launcher launcher = getVisibleLaucher();
- if (launcher != null) {
- if (fromRecentsButton) {
- launcher.getUserEventDispatcher().logActionCommand(
- LauncherLogProto.Action.Command.RECENTS_BUTTON,
- getContainerType(),
- LauncherLogProto.ContainerType.TASKSWITCHER);
- }
- launcher.getStateManager().goToState(OVERVIEW);
- return true;
+ Launcher launcher = getVisibleLauncher();
+ if (launcher == null) {
+ return false;
}
- return false;
+ if (fromRecentsButton) {
+ launcher.getUserEventDispatcher().logActionCommand(
+ LauncherLogProto.Action.Command.RECENTS_BUTTON,
+ getContainerType(),
+ LauncherLogProto.ContainerType.TASKSWITCHER);
+ }
+ launcher.getStateManager().goToState(OVERVIEW);
+ return true;
}
@Override
@@ -436,7 +436,7 @@
@Override
public int getContainerType() {
- final Launcher launcher = getVisibleLaucher();
+ final Launcher launcher = getVisibleLauncher();
return launcher != null ? launcher.getStateManager().getState().containerType
: LauncherLogProto.ContainerType.APP;
}
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index fcb0f6e..0bdb578 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -24,6 +24,7 @@
import android.graphics.RectF;
import android.os.Build;
import android.os.Handler;
+import android.view.View;
import android.view.animation.Interpolator;
import androidx.annotation.NonNull;
@@ -87,7 +88,7 @@
@UiThread
@Nullable
- RecentsView getVisibleRecentsView();
+ <T extends View> T getVisibleRecentsView();
@UiThread
boolean switchToRecentsIfVisible(boolean fromRecentsButton);