Merge "Revert "Merge commit '8d14dbe041199d611839140f1c9285fd4174e9f4' ...""
diff --git a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
index 68111d2..bc3b4ab 100644
--- a/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
+++ b/quickstep/src/com/android/launcher3/BaseQuickstepLauncher.java
@@ -24,10 +24,12 @@
import android.animation.AnimatorSet;
import android.animation.ValueAnimator;
+import android.app.ActivityOptions;
import android.content.Intent;
import android.content.IntentSender;
import android.os.Bundle;
import android.os.CancellationSignal;
+import android.view.View;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.model.WellbeingModel;
@@ -49,6 +51,7 @@
import com.android.quickstep.views.OverviewActionsView;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.ActivityManagerWrapper;
+import com.android.systemui.shared.system.ActivityOptionsCompat;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
import java.util.stream.Stream;
@@ -304,6 +307,15 @@
Stream.of(WellbeingModel.SHORTCUT_FACTORY));
}
+ @Override
+ public ActivityOptions getActivityLaunchOptions(View v) {
+ ActivityOptions activityOptions = super.getActivityLaunchOptions(v);
+ if (activityOptions != null && mLastTouchUpTime > 0) {
+ ActivityOptionsCompat.setLauncherSourceInfo(activityOptions, mLastTouchUpTime);
+ }
+ return activityOptions;
+ }
+
public void setHintUserWillBeActive() {
addActivityFlags(ACTIVITY_STATE_USER_WILL_BE_ACTIVE);
}
diff --git a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
index 26ad377..ef7a8f6 100644
--- a/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
+++ b/quickstep/src/com/android/quickstep/AbsSwipeUpHandler.java
@@ -1419,6 +1419,11 @@
mGestureEndCallback = gestureEndCallback;
}
+ @Override
+ public long getStartTouchTime() {
+ return mTouchTimeMs;
+ }
+
protected void linkRecentsViewScroll() {
SurfaceTransactionApplier.create(mRecentsView, applier -> {
mTransformParams.setSyncTransactionApplier(applier);
diff --git a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
index a21c714..f319b94 100644
--- a/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
+++ b/quickstep/src/com/android/quickstep/RecentsAnimationCallbacks.java
@@ -160,5 +160,12 @@
* Callback made when a task started from the recents is ready for an app transition.
*/
default void onTaskAppeared(RemoteAnimationTargetCompat appearedTaskTarget) {}
+
+ /**
+ * The time in milliseconds of the touch event that starts the recents animation.
+ */
+ default long getStartTouchTime() {
+ return 0;
+ }
}
}
diff --git a/quickstep/src/com/android/quickstep/TaskAnimationManager.java b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
index cad51f4..49f40cb 100644
--- a/quickstep/src/com/android/quickstep/TaskAnimationManager.java
+++ b/quickstep/src/com/android/quickstep/TaskAnimationManager.java
@@ -46,7 +46,7 @@
public void preloadRecentsAnimation(Intent intent) {
// Pass null animation handler to indicate this start is for preloading
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
- .startRecentsActivity(intent, null, null, null, null));
+ .startRecentsActivity(intent, 0, null, null, null));
}
/**
@@ -116,10 +116,11 @@
}
}
});
+ final long eventTime = listener.getStartTouchTime();
mCallbacks.addListener(gestureState);
mCallbacks.addListener(listener);
UI_HELPER_EXECUTOR.execute(() -> ActivityManagerWrapper.getInstance()
- .startRecentsActivity(intent, null, mCallbacks, null, null));
+ .startRecentsActivity(intent, eventTime, mCallbacks, null, null));
gestureState.setState(STATE_RECENTS_ANIMATION_INITIALIZED);
return mCallbacks;
}
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 90566f3..4c5224b 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -76,6 +76,7 @@
import android.os.Parcelable;
import android.os.Process;
import android.os.StrictMode;
+import android.os.SystemClock;
import android.text.TextUtils;
import android.text.method.TextKeyListener;
import android.util.Log;
@@ -349,7 +350,7 @@
private boolean mDeferOverlayCallbacks;
private final Runnable mDeferredOverlayCallbacks = this::checkIfOverlayStillDeferred;
- private long mLastTouchUpTime = -1;
+ protected long mLastTouchUpTime = -1;
private boolean mTouchInProgress;
private SafeCloseable mUserChangedCallbackCloseable;
@@ -1824,7 +1825,7 @@
mTouchInProgress = true;
break;
case MotionEvent.ACTION_UP:
- mLastTouchUpTime = System.currentTimeMillis();
+ mLastTouchUpTime = ev.getEventTime();
// Follow through
case MotionEvent.ACTION_CANCEL:
mTouchInProgress = false;
@@ -2457,7 +2458,7 @@
if (mDragController.isDragging()) {
return false;
} else {
- return (System.currentTimeMillis() - mLastTouchUpTime)
+ return (SystemClock.uptimeMillis() - mLastTouchUpTime)
> (NEW_APPS_ANIMATION_INACTIVE_TIMEOUT_SECONDS * 1000);
}
}