Add some gesture logging to track down quickscrub launch issue
- Keep rudimentary log of the last few gestures for dumping with the BR - Also renaming updateInteractionType since we only use it to change to the quickscrub starting interaction type now, which is less confusing Bug: 112783625 Change-Id: Ic024684caf2841cd7c09df9481163ea0c0ae03bd
This commit is contained in:
@@ -91,7 +91,7 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
* Updates the UI to indicate quick interaction.
|
||||
*/
|
||||
void onQuickInteractionStart(T activity, @Nullable RunningTaskInfo taskInfo,
|
||||
boolean activityVisible);
|
||||
boolean activityVisible, TouchInteractionLog touchInteractionLog);
|
||||
|
||||
float getTranslationYForQuickScrub(TransformedRect targetRect, DeviceProfile dp,
|
||||
Context context);
|
||||
@@ -153,13 +153,14 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
|
||||
@Override
|
||||
public void onQuickInteractionStart(Launcher activity, RunningTaskInfo taskInfo,
|
||||
boolean activityVisible) {
|
||||
boolean activityVisible, TouchInteractionLog touchInteractionLog) {
|
||||
LauncherState fromState = activity.getStateManager().getState();
|
||||
activity.getStateManager().goToState(FAST_OVERVIEW, activityVisible);
|
||||
|
||||
QuickScrubController controller = activity.<RecentsView>getOverviewPanel()
|
||||
.getQuickScrubController();
|
||||
controller.onQuickScrubStart(activityVisible && !fromState.overviewUi, this);
|
||||
controller.onQuickScrubStart(activityVisible && !fromState.overviewUi, this,
|
||||
touchInteractionLog);
|
||||
|
||||
if (!activityVisible) {
|
||||
// For the duration of the gesture, lock the screen orientation to ensure that we
|
||||
@@ -425,14 +426,14 @@ public interface ActivityControlHelper<T extends BaseDraggingActivity> {
|
||||
|
||||
@Override
|
||||
public void onQuickInteractionStart(RecentsActivity activity, RunningTaskInfo taskInfo,
|
||||
boolean activityVisible) {
|
||||
boolean activityVisible, TouchInteractionLog touchInteractionLog) {
|
||||
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);
|
||||
controller.onQuickScrubStart(startingFromHome, this, touchInteractionLog);
|
||||
if (activityVisible) {
|
||||
mUiHandler.postDelayed(controller::onFinishedTransitionToQuickScrub,
|
||||
OVERVIEW_TRANSITION_MS);
|
||||
|
||||
@@ -49,8 +49,8 @@ public class DeferredTouchConsumer implements TouchConsumer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTouchTracking(int interactionType) {
|
||||
mTarget.updateTouchTracking(interactionType);
|
||||
public void onQuickScrubStart() {
|
||||
mTarget.onQuickScrubStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -146,7 +146,7 @@ public class MotionEventQueue {
|
||||
if (event.getActionMasked() == ACTION_VIRTUAL) {
|
||||
switch (event.getAction()) {
|
||||
case ACTION_QUICK_SCRUB_START:
|
||||
mConsumer.updateTouchTracking(INTERACTION_QUICK_SCRUB);
|
||||
mConsumer.onQuickScrubStart();
|
||||
break;
|
||||
case ACTION_QUICK_SCRUB_PROGRESS:
|
||||
mConsumer.onQuickScrubProgress(event.getX());
|
||||
@@ -162,7 +162,7 @@ public class MotionEventQueue {
|
||||
break;
|
||||
case ACTION_SHOW_OVERVIEW_FROM_ALT_TAB:
|
||||
mConsumer.onShowOverviewFromAltTab();
|
||||
mConsumer.updateTouchTracking(INTERACTION_QUICK_SCRUB);
|
||||
mConsumer.onQuickScrubStart();
|
||||
break;
|
||||
case ACTION_QUICK_STEP:
|
||||
mConsumer.onQuickStep(event);
|
||||
|
||||
@@ -79,6 +79,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
private final Choreographer mBackgroundThreadChoreographer;
|
||||
private final OverviewCallbacks mOverviewCallbacks;
|
||||
private final TaskOverlayFactory mTaskOverlayFactory;
|
||||
private final TouchInteractionLog mTouchInteractionLog;
|
||||
|
||||
private final boolean mIsDeferredDownTarget;
|
||||
private final PointF mDownPos = new PointF();
|
||||
@@ -100,7 +101,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
RecentsModel recentsModel, Intent homeIntent, ActivityControlHelper activityControl,
|
||||
MainThreadExecutor mainThreadExecutor, Choreographer backgroundThreadChoreographer,
|
||||
@HitTarget int downHitTarget, OverviewCallbacks overviewCallbacks,
|
||||
TaskOverlayFactory taskOverlayFactory, VelocityTracker velocityTracker) {
|
||||
TaskOverlayFactory taskOverlayFactory, VelocityTracker velocityTracker,
|
||||
TouchInteractionLog touchInteractionLog) {
|
||||
super(base);
|
||||
|
||||
mRunningTask = runningTaskInfo;
|
||||
@@ -113,6 +115,8 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
mIsDeferredDownTarget = activityControl.deferStartingActivity(downHitTarget);
|
||||
mOverviewCallbacks = overviewCallbacks;
|
||||
mTaskOverlayFactory = taskOverlayFactory;
|
||||
mTouchInteractionLog = touchInteractionLog;
|
||||
mTouchInteractionLog.setTouchConsumer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,6 +129,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
if (mVelocityTracker == null) {
|
||||
return;
|
||||
}
|
||||
mTouchInteractionLog.addMotionEvent(ev);
|
||||
switch (ev.getActionMasked()) {
|
||||
case ACTION_DOWN: {
|
||||
TraceHelper.beginSection("TouchInt");
|
||||
@@ -215,10 +220,13 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
}
|
||||
|
||||
private void startTouchTrackingForWindowAnimation(long touchTimeMs) {
|
||||
mTouchInteractionLog.startRecentsAnimation();
|
||||
|
||||
// Create the shared handler
|
||||
RecentsAnimationState animationState = new RecentsAnimationState();
|
||||
final WindowTransformSwipeHandler handler = new WindowTransformSwipeHandler(
|
||||
animationState.id, mRunningTask, this, touchTimeMs, mActivityControlHelper);
|
||||
animationState.id, mRunningTask, this, touchTimeMs, mActivityControlHelper,
|
||||
mTouchInteractionLog);
|
||||
|
||||
// Preload the plan
|
||||
mRecentsModel.loadTasks(mRunningTask.id, null);
|
||||
@@ -315,7 +323,13 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTouchTracking(int interactionType) {
|
||||
public Choreographer getIntrimChoreographer(MotionEventQueue queue) {
|
||||
mEventQueue = queue;
|
||||
return mBackgroundThreadChoreographer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuickScrubStart() {
|
||||
if (!mPassedInitialSlop && mIsDeferredDownTarget && mInteractionHandler == null) {
|
||||
// If we deferred starting the window animation on touch down, then
|
||||
// start tracking now
|
||||
@@ -323,20 +337,16 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
mPassedInitialSlop = true;
|
||||
}
|
||||
|
||||
mTouchInteractionLog.startQuickScrub();
|
||||
if (mInteractionHandler != null) {
|
||||
mInteractionHandler.updateInteractionType(interactionType);
|
||||
mInteractionHandler.onQuickScrubStart();
|
||||
}
|
||||
notifyGestureStarted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Choreographer getIntrimChoreographer(MotionEventQueue queue) {
|
||||
mEventQueue = queue;
|
||||
return mBackgroundThreadChoreographer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuickScrubEnd() {
|
||||
mTouchInteractionLog.endQuickScrub("onQuickScrubEnd");
|
||||
if (mInteractionHandler != null) {
|
||||
mInteractionHandler.onQuickScrubEnd();
|
||||
}
|
||||
@@ -344,6 +354,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
|
||||
@Override
|
||||
public void onQuickScrubProgress(float progress) {
|
||||
mTouchInteractionLog.setQuickScrubProgress(progress);
|
||||
if (mInteractionHandler != null) {
|
||||
mInteractionHandler.onQuickScrubProgress(progress);
|
||||
}
|
||||
@@ -351,6 +362,7 @@ public class OtherActivityTouchConsumer extends ContextWrapper implements TouchC
|
||||
|
||||
@Override
|
||||
public void onQuickStep(MotionEvent ev) {
|
||||
mTouchInteractionLog.startQuickStep();
|
||||
if (mIsDeferredDownTarget) {
|
||||
// Deferred gesture, start the animation and gesture tracking once we pass the actual
|
||||
// touch slop
|
||||
|
||||
@@ -69,6 +69,7 @@ public class QuickScrubController implements OnAlarmListener {
|
||||
private boolean mFinishedTransitionToQuickScrub;
|
||||
private Runnable mOnFinishedTransitionToQuickScrubRunnable;
|
||||
private ActivityControlHelper mActivityControlHelper;
|
||||
private TouchInteractionLog mTouchInteractionLog;
|
||||
|
||||
public QuickScrubController(BaseActivity activity, RecentsView recentsView) {
|
||||
mActivity = activity;
|
||||
@@ -79,13 +80,15 @@ public class QuickScrubController implements OnAlarmListener {
|
||||
}
|
||||
}
|
||||
|
||||
public void onQuickScrubStart(boolean startingFromHome, ActivityControlHelper controlHelper) {
|
||||
public void onQuickScrubStart(boolean startingFromHome, ActivityControlHelper controlHelper,
|
||||
TouchInteractionLog touchInteractionLog) {
|
||||
prepareQuickScrub(TAG);
|
||||
mInQuickScrub = true;
|
||||
mStartedFromHome = startingFromHome;
|
||||
mQuickScrubSection = 0;
|
||||
mFinishedTransitionToQuickScrub = false;
|
||||
mActivityControlHelper = controlHelper;
|
||||
mTouchInteractionLog = touchInteractionLog;
|
||||
|
||||
snapToNextTaskIfAvailable();
|
||||
mActivity.getUserEventDispatcher().resetActionDurationMillis();
|
||||
@@ -101,7 +104,9 @@ public class QuickScrubController implements OnAlarmListener {
|
||||
TaskView taskView = mRecentsView.getTaskViewAt(page);
|
||||
if (taskView != null) {
|
||||
mWaitingForTaskLaunch = true;
|
||||
mTouchInteractionLog.launchTaskStart();
|
||||
taskView.launchTask(true, (result) -> {
|
||||
mTouchInteractionLog.launchTaskEnd(result);
|
||||
if (!result) {
|
||||
taskView.notifyTaskLaunchFailed(TAG);
|
||||
breakOutOfQuickScrub();
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface TouchConsumer extends Consumer<MotionEvent> {
|
||||
|
||||
default void reset() { }
|
||||
|
||||
default void updateTouchTracking(@InteractionType int interactionType) { }
|
||||
default void onQuickScrubStart() { }
|
||||
|
||||
default void onQuickScrubEnd() { }
|
||||
|
||||
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* Copyright (C) 2017 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 android.view.MotionEvent;
|
||||
import java.io.PrintWriter;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* Keeps track of debugging logs for a particular quickstep/scrub gesture.
|
||||
*/
|
||||
public class TouchInteractionLog {
|
||||
|
||||
// The number of gestures to log
|
||||
private static final int MAX_NUM_LOG_GESTURES = 5;
|
||||
|
||||
private final Calendar mCalendar = Calendar.getInstance();
|
||||
private final SimpleDateFormat mDateFormat = new SimpleDateFormat("MMM dd - kk:mm:ss:SSS");
|
||||
private final LinkedList<ArrayList<String>> mGestureLogs = new LinkedList<>();
|
||||
|
||||
public void prepareForNewGesture() {
|
||||
mGestureLogs.add(new ArrayList<>());
|
||||
while (mGestureLogs.size() > MAX_NUM_LOG_GESTURES) {
|
||||
mGestureLogs.pop();
|
||||
}
|
||||
getCurrentLog().add("[" + mDateFormat.format(mCalendar.getTime()) + "]");
|
||||
}
|
||||
|
||||
public void setTouchConsumer(TouchConsumer consumer) {
|
||||
getCurrentLog().add("tc=" + consumer.getClass().getSimpleName());
|
||||
}
|
||||
|
||||
public void addMotionEvent(MotionEvent event) {
|
||||
getCurrentLog().add("ev=" + event.getActionMasked());
|
||||
}
|
||||
|
||||
public void startQuickStep() {
|
||||
getCurrentLog().add("qstStart");
|
||||
}
|
||||
|
||||
public void startQuickScrub() {
|
||||
getCurrentLog().add("qsStart");
|
||||
}
|
||||
|
||||
public void setQuickScrubProgress(float progress) {
|
||||
getCurrentLog().add("qsP=" + progress);
|
||||
}
|
||||
|
||||
public void endQuickScrub(String reason) {
|
||||
getCurrentLog().add("qsEnd=" + reason);
|
||||
}
|
||||
|
||||
public void startRecentsAnimation() {
|
||||
getCurrentLog().add("raStart");
|
||||
}
|
||||
|
||||
public void startRecentsAnimationCallback(int numTargets) {
|
||||
getCurrentLog().add("raStartCb=" + numTargets);
|
||||
}
|
||||
|
||||
public void cancelRecentsAnimation() {
|
||||
getCurrentLog().add("raCancel");
|
||||
}
|
||||
|
||||
public void finishRecentsAnimation(boolean toHome) {
|
||||
getCurrentLog().add("raFinish=" + toHome);
|
||||
}
|
||||
|
||||
public void launchTaskStart() {
|
||||
getCurrentLog().add("launchStart");
|
||||
}
|
||||
|
||||
public void launchTaskEnd(boolean result) {
|
||||
getCurrentLog().add("launchEnd=" + result);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
pw.println("TouchInteractionLog {");
|
||||
for (ArrayList<String> gesture : mGestureLogs) {
|
||||
pw.print(" ");
|
||||
for (String log : gesture) {
|
||||
pw.print(log + " ");
|
||||
}
|
||||
pw.println();
|
||||
}
|
||||
pw.println("}");
|
||||
}
|
||||
|
||||
private ArrayList<String> getCurrentLog() {
|
||||
return mGestureLogs.getLast();
|
||||
}
|
||||
}
|
||||
@@ -52,6 +52,8 @@ import com.android.systemui.shared.recents.ISystemUiProxy;
|
||||
import com.android.systemui.shared.system.ActivityManagerWrapper;
|
||||
import com.android.systemui.shared.system.ChoreographerCompat;
|
||||
import com.android.systemui.shared.system.NavigationBarCompat.HitTarget;
|
||||
import java.io.FileDescriptor;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* Service connected by system-UI for handling touch interaction.
|
||||
@@ -81,6 +83,8 @@ public class TouchInteractionService extends Service {
|
||||
|
||||
@Override
|
||||
public void onPreMotionEvent(@HitTarget int downHitTarget) {
|
||||
mTouchInteractionLog.prepareForNewGesture();
|
||||
|
||||
TraceHelper.beginSection("SysUiBinder");
|
||||
setupTouchConsumer(downHitTarget);
|
||||
TraceHelper.partitionSection("SysUiBinder", "Down target " + downHitTarget);
|
||||
@@ -179,6 +183,7 @@ public class TouchInteractionService extends Service {
|
||||
private OverviewInteractionState mOverviewInteractionState;
|
||||
private OverviewCallbacks mOverviewCallbacks;
|
||||
private TaskOverlayFactory mTaskOverlayFactory;
|
||||
private TouchInteractionLog mTouchInteractionLog;
|
||||
|
||||
private Choreographer mMainThreadChoreographer;
|
||||
private Choreographer mBackgroundThreadChoreographer;
|
||||
@@ -196,6 +201,7 @@ public class TouchInteractionService extends Service {
|
||||
mOverviewInteractionState = OverviewInteractionState.INSTANCE.get(this);
|
||||
mOverviewCallbacks = OverviewCallbacks.get(this);
|
||||
mTaskOverlayFactory = TaskOverlayFactory.get(this);
|
||||
mTouchInteractionLog = new TouchInteractionLog();
|
||||
|
||||
sConnected = true;
|
||||
|
||||
@@ -240,7 +246,7 @@ public class TouchInteractionService extends Service {
|
||||
} else if (forceToLauncher ||
|
||||
runningTaskInfo.topActivity.equals(mOverviewCommandHelper.overviewComponent)) {
|
||||
return OverviewTouchConsumer.newInstance(
|
||||
mOverviewCommandHelper.getActivityControlHelper(), false);
|
||||
mOverviewCommandHelper.getActivityControlHelper(), false, mTouchInteractionLog);
|
||||
} else {
|
||||
if (tracker == null) {
|
||||
tracker = VelocityTracker.obtain();
|
||||
@@ -249,7 +255,7 @@ public class TouchInteractionService extends Service {
|
||||
mOverviewCommandHelper.overviewIntent,
|
||||
mOverviewCommandHelper.getActivityControlHelper(), mMainThreadExecutor,
|
||||
mBackgroundThreadChoreographer, downHitTarget, mOverviewCallbacks,
|
||||
mTaskOverlayFactory, tracker);
|
||||
mTaskOverlayFactory, tracker, mTouchInteractionLog);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -262,6 +268,11 @@ public class TouchInteractionService extends Service {
|
||||
mBackgroundThreadChoreographer = ChoreographerCompat.getSfInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
mTouchInteractionLog.dump(pw);
|
||||
}
|
||||
|
||||
public static class OverviewTouchConsumer<T extends BaseDraggingActivity>
|
||||
implements TouchConsumer {
|
||||
|
||||
@@ -272,6 +283,7 @@ public class TouchInteractionService extends Service {
|
||||
private final PointF mDownPos = new PointF();
|
||||
private final int mTouchSlop;
|
||||
private final QuickScrubController mQuickScrubController;
|
||||
private final TouchInteractionLog mTouchInteractionLog;
|
||||
|
||||
private final boolean mStartingInActivityBounds;
|
||||
|
||||
@@ -283,7 +295,7 @@ public class TouchInteractionService extends Service {
|
||||
private boolean mEndPending = false;
|
||||
|
||||
OverviewTouchConsumer(ActivityControlHelper<T> activityHelper, T activity,
|
||||
boolean startingInActivityBounds) {
|
||||
boolean startingInActivityBounds, TouchInteractionLog touchInteractionLog) {
|
||||
mActivityHelper = activityHelper;
|
||||
mActivity = activity;
|
||||
mTarget = activity.getDragLayer();
|
||||
@@ -292,6 +304,8 @@ public class TouchInteractionService extends Service {
|
||||
|
||||
mQuickScrubController = mActivity.<RecentsView>getOverviewPanel()
|
||||
.getQuickScrubController();
|
||||
mTouchInteractionLog = touchInteractionLog;
|
||||
mTouchInteractionLog.setTouchConsumer(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -299,6 +313,7 @@ public class TouchInteractionService extends Service {
|
||||
if (mInvalidated) {
|
||||
return;
|
||||
}
|
||||
mTouchInteractionLog.addMotionEvent(ev);
|
||||
int action = ev.getActionMasked();
|
||||
if (action == ACTION_DOWN) {
|
||||
if (mStartingInActivityBounds) {
|
||||
@@ -372,44 +387,48 @@ public class TouchInteractionService extends Service {
|
||||
OverviewCallbacks.get(mActivity).closeAllWindows();
|
||||
ActivityManagerWrapper.getInstance()
|
||||
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
|
||||
mTouchInteractionLog.startQuickStep();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTouchTracking(int interactionType) {
|
||||
public void onQuickScrubStart() {
|
||||
if (mInvalidated) {
|
||||
return;
|
||||
}
|
||||
if (interactionType == INTERACTION_QUICK_SCRUB) {
|
||||
mTouchInteractionLog.startQuickScrub();
|
||||
if (!mQuickScrubController.prepareQuickScrub(TAG)) {
|
||||
mInvalidated = true;
|
||||
mTouchInteractionLog.endQuickScrub("onQuickScrubStart");
|
||||
return;
|
||||
}
|
||||
OverviewCallbacks.get(mActivity).closeAllWindows();
|
||||
ActivityManagerWrapper.getInstance()
|
||||
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
|
||||
|
||||
mStartPending = true;
|
||||
Runnable action = () -> {
|
||||
if (!mQuickScrubController.prepareQuickScrub(TAG)) {
|
||||
mInvalidated = true;
|
||||
mTouchInteractionLog.endQuickScrub("onQuickScrubStart");
|
||||
return;
|
||||
}
|
||||
OverviewCallbacks.get(mActivity).closeAllWindows();
|
||||
ActivityManagerWrapper.getInstance()
|
||||
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
|
||||
mActivityHelper.onQuickInteractionStart(mActivity, null, true,
|
||||
mTouchInteractionLog);
|
||||
mQuickScrubController.onQuickScrubProgress(mLastProgress);
|
||||
mStartPending = false;
|
||||
|
||||
mStartPending = true;
|
||||
Runnable action = () -> {
|
||||
if (!mQuickScrubController.prepareQuickScrub(TAG)) {
|
||||
mInvalidated = true;
|
||||
return;
|
||||
}
|
||||
mActivityHelper.onQuickInteractionStart(mActivity, null, true);
|
||||
mQuickScrubController.onQuickScrubProgress(mLastProgress);
|
||||
mStartPending = false;
|
||||
if (mEndPending) {
|
||||
mQuickScrubController.onQuickScrubEnd();
|
||||
mEndPending = false;
|
||||
}
|
||||
};
|
||||
|
||||
if (mEndPending) {
|
||||
mQuickScrubController.onQuickScrubEnd();
|
||||
mEndPending = false;
|
||||
}
|
||||
};
|
||||
|
||||
mActivityHelper.executeOnWindowAvailable(mActivity, action);
|
||||
}
|
||||
mActivityHelper.executeOnWindowAvailable(mActivity, action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQuickScrubEnd() {
|
||||
mTouchInteractionLog.endQuickScrub("onQuickScrubEnd");
|
||||
if (mInvalidated) {
|
||||
return;
|
||||
}
|
||||
@@ -422,6 +441,7 @@ public class TouchInteractionService extends Service {
|
||||
|
||||
@Override
|
||||
public void onQuickScrubProgress(float progress) {
|
||||
mTouchInteractionLog.setQuickScrubProgress(progress);
|
||||
mLastProgress = progress;
|
||||
if (mInvalidated || mStartPending) {
|
||||
return;
|
||||
@@ -429,13 +449,14 @@ public class TouchInteractionService extends Service {
|
||||
mQuickScrubController.onQuickScrubProgress(progress);
|
||||
}
|
||||
|
||||
public static TouchConsumer newInstance(
|
||||
ActivityControlHelper activityHelper, boolean startingInActivityBounds) {
|
||||
public static TouchConsumer newInstance(ActivityControlHelper activityHelper,
|
||||
boolean startingInActivityBounds, TouchInteractionLog touchInteractionLog) {
|
||||
BaseDraggingActivity activity = activityHelper.getCreatedActivity();
|
||||
if (activity == null) {
|
||||
return TouchConsumer.NO_OP;
|
||||
}
|
||||
return new OverviewTouchConsumer(activityHelper, activity, startingInActivityBounds);
|
||||
return new OverviewTouchConsumer(activityHelper, activity, startingInActivityBounds,
|
||||
touchInteractionLog);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -198,6 +198,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
private final Context mContext;
|
||||
private final ActivityControlHelper<T> mActivityControlHelper;
|
||||
private final ActivityInitListener mActivityInitListener;
|
||||
private final TouchInteractionLog mTouchInteractionLog;
|
||||
|
||||
private final int mRunningTaskId;
|
||||
private final RunningTaskInfo mRunningTaskInfo;
|
||||
@@ -239,7 +240,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
private Bundle mAssistData;
|
||||
|
||||
WindowTransformSwipeHandler(int id, RunningTaskInfo runningTaskInfo, Context context,
|
||||
long touchTimeMs, ActivityControlHelper<T> controller) {
|
||||
long touchTimeMs, ActivityControlHelper<T> controller,
|
||||
TouchInteractionLog touchInteractionLog) {
|
||||
this.id = id;
|
||||
mContext = context;
|
||||
mRunningTaskInfo = runningTaskInfo;
|
||||
@@ -248,6 +250,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
mActivityControlHelper = controller;
|
||||
mActivityInitListener = mActivityControlHelper
|
||||
.createActivityInitListener(this::onActivityInit);
|
||||
mTouchInteractionLog = touchInteractionLog;
|
||||
|
||||
initStateCallbacks();
|
||||
}
|
||||
@@ -319,7 +322,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
this::notifyTransitionCancelled);
|
||||
|
||||
mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_QUICK_SCRUB_START
|
||||
| STATE_APP_CONTROLLER_RECEIVED, this::onQuickScrubStart);
|
||||
| STATE_APP_CONTROLLER_RECEIVED, this::onQuickScrubStartUi);
|
||||
mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_QUICK_SCRUB_START
|
||||
| STATE_SCALED_CONTROLLER_RECENTS, this::onFinishedTransitionToQuickScrub);
|
||||
mStateCallback.addCallback(STATE_LAUNCHER_STARTED | STATE_CURRENT_TASK_FINISHED
|
||||
@@ -503,25 +506,6 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
.getHighResThumbnailLoader().setVisible(true);
|
||||
}
|
||||
|
||||
public void updateInteractionType(@InteractionType int interactionType) {
|
||||
if (mInteractionType != INTERACTION_NORMAL) {
|
||||
throw new IllegalArgumentException(
|
||||
"Can't change interaction type from " + mInteractionType);
|
||||
}
|
||||
if (interactionType != INTERACTION_QUICK_SCRUB) {
|
||||
throw new IllegalArgumentException(
|
||||
"Can't change interaction type to " + interactionType);
|
||||
}
|
||||
mInteractionType = interactionType;
|
||||
mRecentsAnimationWrapper.runOnInit(this::shiftAnimationDestinationForQuickscrub);
|
||||
|
||||
setStateOnUiThread(STATE_QUICK_SCRUB_START | STATE_GESTURE_COMPLETED);
|
||||
|
||||
// Start the window animation without waiting for launcher.
|
||||
animateToProgress(mCurrentShift.value, 1f, QUICK_SCRUB_FROM_APP_START_DURATION, LINEAR,
|
||||
true /* goingToHome */);
|
||||
}
|
||||
|
||||
private void shiftAnimationDestinationForQuickscrub() {
|
||||
TransformedRect tempRect = new TransformedRect();
|
||||
mActivityControlHelper
|
||||
@@ -669,6 +653,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
initTransitionEndpoints(dp);
|
||||
|
||||
mRecentsAnimationWrapper.setController(controller, targets);
|
||||
mTouchInteractionLog.startRecentsAnimationCallback(targets.apps.length);
|
||||
setStateOnUiThread(STATE_APP_CONTROLLER_RECEIVED);
|
||||
|
||||
mPassedOverviewThreshold = false;
|
||||
@@ -678,6 +663,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
mRecentsAnimationWrapper.setController(null, null);
|
||||
mActivityInitListener.unregister();
|
||||
setStateOnUiThread(STATE_GESTURE_CANCELLED | STATE_HANDLER_INVALIDATED);
|
||||
mTouchInteractionLog.cancelRecentsAnimation();
|
||||
}
|
||||
|
||||
public void onGestureStarted() {
|
||||
@@ -729,7 +715,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
// Hide the task view, if not already hidden
|
||||
setTargetAlphaProvider(WindowTransformSwipeHandler::getHiddenTargetAlpha);
|
||||
|
||||
return OverviewTouchConsumer.newInstance(mActivityControlHelper, true);
|
||||
return OverviewTouchConsumer.newInstance(mActivityControlHelper, true,
|
||||
mTouchInteractionLog);
|
||||
}
|
||||
|
||||
private void handleNormalGestureEnd(float endVelocity, boolean isFling) {
|
||||
@@ -854,6 +841,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
@UiThread
|
||||
private void resumeLastTask() {
|
||||
mRecentsAnimationWrapper.finish(false /* toHome */, null);
|
||||
mTouchInteractionLog.finishRecentsAnimation(false);
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -950,6 +938,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
mRecentsAnimationWrapper.finish(true /* toHome */,
|
||||
() -> setStateOnUiThread(STATE_CURRENT_TASK_FINISHED));
|
||||
}
|
||||
mTouchInteractionLog.finishRecentsAnimation(true);
|
||||
}
|
||||
|
||||
private void setupLauncherUiAfterSwipeUpAnimation() {
|
||||
@@ -969,7 +958,22 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
reset();
|
||||
}
|
||||
|
||||
private void onQuickScrubStart() {
|
||||
public void onQuickScrubStart() {
|
||||
if (mInteractionType != INTERACTION_NORMAL) {
|
||||
throw new IllegalArgumentException(
|
||||
"Can't change interaction type from " + mInteractionType);
|
||||
}
|
||||
mInteractionType = INTERACTION_QUICK_SCRUB;
|
||||
mRecentsAnimationWrapper.runOnInit(this::shiftAnimationDestinationForQuickscrub);
|
||||
|
||||
setStateOnUiThread(STATE_QUICK_SCRUB_START | STATE_GESTURE_COMPLETED);
|
||||
|
||||
// Start the window animation without waiting for launcher.
|
||||
animateToProgress(mCurrentShift.value, 1f, QUICK_SCRUB_FROM_APP_START_DURATION, LINEAR,
|
||||
true /* goingToHome */);
|
||||
}
|
||||
|
||||
private void onQuickScrubStartUi() {
|
||||
if (!mQuickScrubController.prepareQuickScrub(TAG)) {
|
||||
mQuickScrubBlocked = true;
|
||||
setStateOnUiThread(STATE_RESUME_LAST_TASK | STATE_HANDLER_INVALIDATED);
|
||||
@@ -980,7 +984,8 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
|
||||
mLauncherTransitionController = null;
|
||||
}
|
||||
|
||||
mActivityControlHelper.onQuickInteractionStart(mActivity, mRunningTaskInfo, false);
|
||||
mActivityControlHelper.onQuickInteractionStart(mActivity, mRunningTaskInfo, false,
|
||||
mTouchInteractionLog);
|
||||
|
||||
// Inform the last progress in case we skipped before.
|
||||
mQuickScrubController.onQuickScrubProgress(mCurrentQuickScrubProgress);
|
||||
|
||||
Reference in New Issue
Block a user