Merge "Handle slow gesture handling" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
8b9ca27cb8
@@ -66,6 +66,8 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
private Runnable mLiveTileCleanUpHandler;
|
||||
private Context mCtx;
|
||||
|
||||
private boolean mRecentsAnimationStartPending = false;
|
||||
|
||||
private final TaskStackChangeListener mLiveTileRestartListener = new TaskStackChangeListener() {
|
||||
@Override
|
||||
public void onActivityRestartAttempt(ActivityManager.RunningTaskInfo task,
|
||||
@@ -100,6 +102,10 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
.startRecentsActivity(intent, 0, null, null, null));
|
||||
}
|
||||
|
||||
public boolean isRecentsAnimationStartPending() {
|
||||
return mRecentsAnimationStartPending;
|
||||
}
|
||||
|
||||
/**
|
||||
* Starts a new recents animation for the activity with the given {@param intent}.
|
||||
*/
|
||||
@@ -109,6 +115,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
ActiveGestureLog.INSTANCE.addLog(
|
||||
/* event= */ "startRecentsAnimation",
|
||||
/* gestureEvent= */ START_RECENTS_ANIMATION);
|
||||
mRecentsAnimationStartPending = true;
|
||||
// Notify if recents animation is still running
|
||||
if (mController != null) {
|
||||
String msg = "New recents animation started before old animation completed";
|
||||
@@ -138,6 +145,7 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
@Override
|
||||
public void onRecentsAnimationStart(RecentsAnimationController controller,
|
||||
RecentsAnimationTargets targets) {
|
||||
mRecentsAnimationStartPending = false;
|
||||
if (mCallbacks == null) {
|
||||
// It's possible for the recents animation to have finished and be cleaned up
|
||||
// by the time we process the start callback, and in that case, just we can skip
|
||||
@@ -178,11 +186,13 @@ public class TaskAnimationManager implements RecentsAnimationCallbacks.RecentsAn
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationCanceled(HashMap<Integer, ThumbnailData> thumbnailDatas) {
|
||||
mRecentsAnimationStartPending = false;
|
||||
cleanUpRecentsAnimation(newCallbacks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRecentsAnimationFinished(RecentsAnimationController controller) {
|
||||
mRecentsAnimationStartPending = false;
|
||||
cleanUpRecentsAnimation(newCallbacks);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_DOWN;
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_MOVE;
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.MOTION_UP;
|
||||
import static com.android.quickstep.util.ActiveGestureErrorDetector.GestureEvent.RECENTS_ANIMATION_START_PENDING;
|
||||
import static com.android.systemui.shared.system.ActivityManagerWrapper.CLOSE_SYSTEM_WINDOWS_REASON_RECENTS;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_SYSUI_PROXY;
|
||||
import static com.android.systemui.shared.system.QuickStepContract.KEY_EXTRA_UNFOLD_ANIMATION_FORWARDER;
|
||||
@@ -697,7 +698,7 @@ public class TouchInteractionService extends Service {
|
||||
private void onInputEvent(InputEvent ev) {
|
||||
if (!(ev instanceof MotionEvent)) {
|
||||
ActiveGestureLog.INSTANCE.addLog(new CompoundString("TIS.onInputEvent: ")
|
||||
.append("Cannot process input event, received unknown event ")
|
||||
.append("Cannot process input event: received unknown event ")
|
||||
.append(ev.toString()));
|
||||
return;
|
||||
}
|
||||
@@ -710,22 +711,32 @@ public class TouchInteractionService extends Service {
|
||||
if (!isUserUnlocked || (mDeviceState.isButtonNavMode()
|
||||
&& !isTrackpadMotionEvent(event))) {
|
||||
ActiveGestureLog.INSTANCE.addLog(new CompoundString("TIS.onInputEvent: ")
|
||||
.append("Cannot process input event, ")
|
||||
.append("Cannot process input event: ")
|
||||
.append(!isUserUnlocked
|
||||
? "user is locked"
|
||||
: "using 3-button nav and event is not a trackpad event"));
|
||||
return;
|
||||
}
|
||||
|
||||
SafeCloseable traceToken = TraceHelper.INSTANCE.allowIpcs("TIS.onInputEvent");
|
||||
|
||||
final int action = event.getActionMasked();
|
||||
// Note this will create a new consumer every mouse click, as after ACTION_UP from the click
|
||||
// an ACTION_HOVER_ENTER will fire as well.
|
||||
boolean isHoverActionWithoutConsumer = enableCursorHoverStates()
|
||||
&& isHoverActionWithoutConsumer(event);
|
||||
if (mTaskAnimationManager.isRecentsAnimationStartPending()
|
||||
&& (action == ACTION_DOWN || isHoverActionWithoutConsumer)) {
|
||||
ActiveGestureLog.INSTANCE.addLog(
|
||||
new CompoundString("TIS.onInputEvent: ")
|
||||
.append("Cannot process input event: a recents animation has been ")
|
||||
.append("requested, but hasn't started."),
|
||||
RECENTS_ANIMATION_START_PENDING);
|
||||
return;
|
||||
}
|
||||
|
||||
SafeCloseable traceToken = TraceHelper.INSTANCE.allowIpcs("TIS.onInputEvent");
|
||||
|
||||
CompoundString reasonString = action == ACTION_DOWN
|
||||
? new CompoundString("onMotionEvent: ") : CompoundString.NO_OP;
|
||||
? new CompoundString("TIS.onMotionEvent: ") : CompoundString.NO_OP;
|
||||
if (action == ACTION_DOWN || isHoverActionWithoutConsumer) {
|
||||
mRotationTouchHelper.setOrientationTransformIfNeeded(event);
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ActiveGestureErrorDetector {
|
||||
SET_ON_PAGE_TRANSITION_END_CALLBACK, CANCEL_CURRENT_ANIMATION, CLEANUP_SCREENSHOT,
|
||||
SCROLLER_ANIMATION_ABORTED, TASK_APPEARED, EXPECTING_TASK_APPEARED,
|
||||
FLAG_USING_OTHER_ACTIVITY_INPUT_CONSUMER, LAUNCHER_DESTROYED, RECENT_TASKS_MISSING,
|
||||
INVALID_VELOCITY_ON_SWIPE_UP,
|
||||
INVALID_VELOCITY_ON_SWIPE_UP, RECENTS_ANIMATION_START_PENDING,
|
||||
|
||||
/**
|
||||
* These GestureEvents are specifically associated to state flags that get set in
|
||||
@@ -273,6 +273,14 @@ public class ActiveGestureErrorDetector {
|
||||
case START_RECENTS_ANIMATION:
|
||||
lastStartRecentAnimationEventEntryTime = eventEntry.getTime();
|
||||
break;
|
||||
case RECENTS_ANIMATION_START_PENDING:
|
||||
errorDetected |= printErrorIfTrue(
|
||||
true,
|
||||
prefix,
|
||||
/* errorMessage= */ "new gesture attempted while a requested recents"
|
||||
+ " animation is still pending.",
|
||||
writer);
|
||||
break;
|
||||
case EXPECTING_TASK_APPEARED:
|
||||
case MOTION_DOWN:
|
||||
case SET_END_TARGET:
|
||||
|
||||
Reference in New Issue
Block a user