summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2019-03-12 16:22:57 -0700
committerSunny Goyal <sunnygoyal@google.com>2019-03-12 16:24:05 -0700
commit58ddac1d09a05b3fc8359545285d363407883f37 (patch)
tree5073c1c90ed97b7a138443d4dd8dda4b875b74ce
parentf820d5d8178d003e20d42c317828be2ddfcb05bb (diff)
downloadpackages_apps_Trebuchet-58ddac1d09a05b3fc8359545285d363407883f37.tar.gz
packages_apps_Trebuchet-58ddac1d09a05b3fc8359545285d363407883f37.tar.bz2
packages_apps_Trebuchet-58ddac1d09a05b3fc8359545285d363407883f37.zip
Removing fade animation on swipe up
Fade animation is no longer required as the transform is also handled on the main thread. So we will get the RecentsAnimaiton always after Launcher has drawn Change-Id: Ieb05406c9a5b9132b0518155bdbda16c1f73a6ec
-rw-r--r--go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java6
-rw-r--r--go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java7
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java5
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java5
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/MultiStateCallback.java5
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java71
-rw-r--r--quickstep/src/com/android/quickstep/ActivityControlHelper.java3
-rw-r--r--src/com/android/launcher3/dragndrop/DragLayer.java3
8 files changed, 26 insertions, 79 deletions
diff --git a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
index abb924224..bba08a40a 100644
--- a/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -26,7 +26,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
-import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.quickstep.views.IconRecentsView;
@@ -110,11 +109,6 @@ public final class FallbackActivityControllerHelper extends
}
@Override
- public AlphaProperty getAlphaProperty(RecentsActivity activity) {
- return activity.getDragLayer().getAlphaProperty(0);
- }
-
- @Override
public int getContainerType() {
return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER;
}
diff --git a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java b/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
index 76685f341..d55d2e5fd 100644
--- a/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/go/quickstep/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -22,9 +22,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherInitListener;
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.views.IconRecentsView;
import java.util.function.BiPredicate;
@@ -94,11 +92,6 @@ public final class LauncherActivityControllerHelper extends GoActivityControlHel
}
@Override
- public AlphaProperty getAlphaProperty(Launcher activity) {
- return activity.getDragLayer().getAlphaProperty(DragLayer.ALPHA_INDEX_SWIPE_UP);
- }
-
- @Override
public int getContainerType() {
final Launcher launcher = getVisibleLauncher();
return launcher != null ? launcher.getStateManager().getState().containerType
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
index 1ed1353c6..d61ed724d 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/FallbackActivityControllerHelper.java
@@ -182,11 +182,6 @@ public final class FallbackActivityControllerHelper implements
}
@Override
- public AlphaProperty getAlphaProperty(RecentsActivity activity) {
- return activity.getDragLayer().getAlphaProperty(0);
- }
-
- @Override
public int getContainerType() {
return LauncherLogProto.ContainerType.SIDELOADED_LAUNCHER;
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
index eee03441d..e95e2a0de 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java
@@ -394,11 +394,6 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe
}
@Override
- public AlphaProperty getAlphaProperty(Launcher activity) {
- return activity.getDragLayer().getAlphaProperty(DragLayer.ALPHA_INDEX_SWIPE_UP);
- }
-
- @Override
public int getContainerType() {
final Launcher launcher = getVisibleLauncher();
return launcher != null ? launcher.getStateManager().getState().containerType
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/MultiStateCallback.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/MultiStateCallback.java
index 9fceab4ac..357c9fc35 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/MultiStateCallback.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/MultiStateCallback.java
@@ -18,6 +18,8 @@ package com.android.quickstep;
import android.util.Log;
import android.util.SparseArray;
+import com.android.launcher3.config.FeatureFlags;
+
import java.util.StringJoiner;
import java.util.function.Consumer;
@@ -101,6 +103,9 @@ public class MultiStateCallback {
* The callback is only run once.
*/
public void addCallback(int stateMask, Runnable callback) {
+ if (FeatureFlags.IS_DOGFOOD_BUILD && mCallbacks.get(stateMask) != null) {
+ throw new IllegalStateException("Multiple callbacks on same state");
+ }
mCallbacks.put(stateMask, callback);
}
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 7bea5935c..00dbdff1b 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -40,7 +40,6 @@ import static com.android.quickstep.WindowTransformSwipeHandler.GestureEndTarget
import static com.android.quickstep.views.RecentsView.UPDATE_SYSUI_FLAGS_THRESHOLD;
import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
@@ -78,8 +77,6 @@ import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
-import com.android.launcher3.util.MultiValueAlpha;
-import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.launcher3.util.RaceConditionTracker;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.views.FloatingIconView;
@@ -113,7 +110,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
implements SwipeAnimationListener, OnApplyWindowInsetsListener {
private static final String TAG = WindowTransformSwipeHandler.class.getSimpleName();
- private static final String[] STATE_NAMES = DEBUG_STATES ? new String[19] : null;
+ private static final String[] STATE_NAMES = DEBUG_STATES ? new String[16] : null;
private static int getFlagForIndex(int index, String name) {
if (DEBUG_STATES) {
@@ -126,47 +123,44 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
private static final int STATE_LAUNCHER_PRESENT = getFlagForIndex(0, "STATE_LAUNCHER_PRESENT");
private static final int STATE_LAUNCHER_STARTED = getFlagForIndex(1, "STATE_LAUNCHER_STARTED");
private static final int STATE_LAUNCHER_DRAWN = getFlagForIndex(2, "STATE_LAUNCHER_DRAWN");
- private static final int STATE_ACTIVITY_MULTIPLIER_COMPLETE =
- getFlagForIndex(3, "STATE_ACTIVITY_MULTIPLIER_COMPLETE");
// Internal initialization states
private static final int STATE_APP_CONTROLLER_RECEIVED =
- getFlagForIndex(4, "STATE_APP_CONTROLLER_RECEIVED");
+ getFlagForIndex(3, "STATE_APP_CONTROLLER_RECEIVED");
// Interaction finish states
private static final int STATE_SCALED_CONTROLLER_HOME =
- getFlagForIndex(5, "STATE_SCALED_CONTROLLER_HOME");
+ getFlagForIndex(4, "STATE_SCALED_CONTROLLER_HOME");
private static final int STATE_SCALED_CONTROLLER_RECENTS =
- getFlagForIndex(6, "STATE_SCALED_CONTROLLER_RECENTS");
+ getFlagForIndex(5, "STATE_SCALED_CONTROLLER_RECENTS");
private static final int STATE_SCALED_CONTROLLER_LAST_TASK =
- getFlagForIndex(7, "STATE_SCALED_CONTROLLER_LAST_TASK");
+ getFlagForIndex(6, "STATE_SCALED_CONTROLLER_LAST_TASK");
private static final int STATE_HANDLER_INVALIDATED =
- getFlagForIndex(8, "STATE_HANDLER_INVALIDATED");
+ getFlagForIndex(7, "STATE_HANDLER_INVALIDATED");
private static final int STATE_GESTURE_STARTED =
- getFlagForIndex(9, "STATE_GESTURE_STARTED");
+ getFlagForIndex(8, "STATE_GESTURE_STARTED");
private static final int STATE_GESTURE_CANCELLED =
- getFlagForIndex(10, "STATE_GESTURE_CANCELLED");
+ getFlagForIndex(9, "STATE_GESTURE_CANCELLED");
private static final int STATE_GESTURE_COMPLETED =
- getFlagForIndex(11, "STATE_GESTURE_COMPLETED");
+ getFlagForIndex(10, "STATE_GESTURE_COMPLETED");
private static final int STATE_CAPTURE_SCREENSHOT =
- getFlagForIndex(12, "STATE_CAPTURE_SCREENSHOT");
+ getFlagForIndex(11, "STATE_CAPTURE_SCREENSHOT");
private static final int STATE_SCREENSHOT_CAPTURED =
- getFlagForIndex(13, "STATE_SCREENSHOT_CAPTURED");
+ getFlagForIndex(12, "STATE_SCREENSHOT_CAPTURED");
private static final int STATE_SCREENSHOT_VIEW_SHOWN =
- getFlagForIndex(14, "STATE_SCREENSHOT_VIEW_SHOWN");
+ getFlagForIndex(13, "STATE_SCREENSHOT_VIEW_SHOWN");
private static final int STATE_RESUME_LAST_TASK =
- getFlagForIndex(15, "STATE_RESUME_LAST_TASK");
+ getFlagForIndex(14, "STATE_RESUME_LAST_TASK");
private static final int STATE_START_NEW_TASK =
- getFlagForIndex(16, "STATE_START_NEW_TASK");
+ getFlagForIndex(15, "STATE_START_NEW_TASK");
private static final int STATE_CURRENT_TASK_FINISHED =
- getFlagForIndex(17, "STATE_CURRENT_TASK_FINISHED");
+ getFlagForIndex(16, "STATE_CURRENT_TASK_FINISHED");
private static final int LAUNCHER_UI_STATES =
- STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_ACTIVITY_MULTIPLIER_COMPLETE
- | STATE_LAUNCHER_STARTED;
+ STATE_LAUNCHER_PRESENT | STATE_LAUNCHER_DRAWN | STATE_LAUNCHER_STARTED;
// For debugging, keep in sync with above states
@@ -226,7 +220,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
// 1 => preview snapShot is completely aligned with the recents view and hotseat is completely
// visible.
private final AnimatedFloat mCurrentShift = new AnimatedFloat(this::updateFinalShift);
- private boolean mDispatchedDownEvent;
private boolean mContinuingLastGesture;
// To avoid UI jump when gesture is started, we offset the animation by the threshold.
private float mShiftAtGestureStart = 0;
@@ -238,7 +231,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
private final ActivityInitListener mActivityInitListener;
private final int mRunningTaskId;
- private final RunningTaskInfo mRunningTaskInfo;
private ThumbnailData mTaskSnapshot;
private MultiStateCallback mStateCallback;
@@ -265,7 +257,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
long touchTimeMs, ActivityControlHelper<T> controller, boolean continuingLastGesture,
InputConsumerController inputConsumer) {
mContext = context;
- mRunningTaskInfo = runningTaskInfo;
mRunningTaskId = runningTaskInfo.id;
mTouchTimeMs = touchTimeMs;
mActivityControlHelper = controller;
@@ -312,8 +303,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
this::startNewTask);
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_APP_CONTROLLER_RECEIVED
- | STATE_ACTIVITY_MULTIPLIER_COMPLETE
- | STATE_CAPTURE_SCREENSHOT,
+ | STATE_LAUNCHER_DRAWN | STATE_CAPTURE_SCREENSHOT,
this::switchToScreenshot);
mStateCallback.addCallback(STATE_SCREENSHOT_CAPTURED | STATE_GESTURE_COMPLETED
@@ -322,13 +312,13 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_GESTURE_COMPLETED
| STATE_SCALED_CONTROLLER_HOME | STATE_APP_CONTROLLER_RECEIVED
- | STATE_ACTIVITY_MULTIPLIER_COMPLETE,
+ | STATE_LAUNCHER_DRAWN,
this::finishCurrentTransitionToHome);
mStateCallback.addCallback(STATE_SCALED_CONTROLLER_HOME | STATE_CURRENT_TASK_FINISHED,
this::reset);
mStateCallback.addCallback(STATE_LAUNCHER_PRESENT | STATE_APP_CONTROLLER_RECEIVED
- | STATE_ACTIVITY_MULTIPLIER_COMPLETE | STATE_SCALED_CONTROLLER_RECENTS
+ | STATE_LAUNCHER_DRAWN | STATE_SCALED_CONTROLLER_RECENTS
| STATE_CURRENT_TASK_FINISHED | STATE_GESTURE_COMPLETED
| STATE_GESTURE_STARTED,
this::setupLauncherUiAfterSwipeUpAnimation);
@@ -440,11 +430,10 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
AbstractFloatingView.closeAllOpenViews(activity, mWasLauncherAlreadyVisible);
if (mWasLauncherAlreadyVisible) {
- mStateCallback.setState(STATE_ACTIVITY_MULTIPLIER_COMPLETE | STATE_LAUNCHER_DRAWN);
+ mStateCallback.setState(STATE_LAUNCHER_DRAWN);
} else {
TraceHelper.beginSection("WTS-init");
View dragLayer = activity.getDragLayer();
- mActivityControlHelper.getAlphaProperty(activity).setValue(0);
dragLayer.getViewTreeObserver().addOnDrawListener(new OnDrawListener() {
@Override
@@ -477,25 +466,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
}
private void launcherFrameDrawn() {
- AlphaProperty property = mActivityControlHelper.getAlphaProperty(mActivity);
- if (property.getValue() < 1) {
- if (mGestureStarted) {
- final MultiStateCallback callback = mStateCallback;
- ObjectAnimator animator = ObjectAnimator.ofFloat(
- property, MultiValueAlpha.VALUE, 1);
- animator.setDuration(getFadeInDuration()).addListener(
- new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- callback.setState(STATE_ACTIVITY_MULTIPLIER_COMPLETE);
- }
- });
- animator.start();
- } else {
- property.setValue(1);
- mStateCallback.setState(STATE_ACTIVITY_MULTIPLIER_COMPLETE);
- }
- }
mLauncherFrameDrawnTime = SystemClock.uptimeMillis();
}
@@ -1074,7 +1044,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
private void invalidateHandlerWithLauncher() {
mLauncherTransitionController = null;
- mActivityControlHelper.getAlphaProperty(mActivity).setValue(1);
mRecentsView.setEnableFreeScroll(true);
mRecentsView.setRunningTaskIconScaledDown(false);
diff --git a/quickstep/src/com/android/quickstep/ActivityControlHelper.java b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
index eccef0428..75be2e48e 100644
--- a/quickstep/src/com/android/quickstep/ActivityControlHelper.java
+++ b/quickstep/src/com/android/quickstep/ActivityControlHelper.java
@@ -31,7 +31,6 @@ import android.view.animation.Interpolator;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.anim.AnimatorPlaybackController;
-import com.android.launcher3.util.MultiValueAlpha.AlphaProperty;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.util.RemoteAnimationTargetSet;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -85,8 +84,6 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
return true;
}
- AlphaProperty getAlphaProperty(T activity);
-
/**
* Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher}
*/
diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java
index f005ce7bf..6950a1fad 100644
--- a/src/com/android/launcher3/dragndrop/DragLayer.java
+++ b/src/com/android/launcher3/dragndrop/DragLayer.java
@@ -63,8 +63,7 @@ public class DragLayer extends BaseDragLayer<Launcher> {
public static final int ALPHA_INDEX_OVERLAY = 0;
public static final int ALPHA_INDEX_LAUNCHER_LOAD = 1;
public static final int ALPHA_INDEX_TRANSITIONS = 2;
- public static final int ALPHA_INDEX_SWIPE_UP = 3;
- private static final int ALPHA_CHANNEL_COUNT = 4;
+ private static final int ALPHA_CHANNEL_COUNT = 3;
public static final int ANIMATION_END_DISAPPEAR = 0;
public static final int ANIMATION_END_REMAIN_VISIBLE = 2;