Merge "Instrumenting swiping up to all apps for jank" into sc-dev

This commit is contained in:
Vadim Tryshev authored and Android (Google) Code Review committed 2021-02-23 18:32:23 +00:00
commit 06df8d7262
2 files changed
+51 -1

No files matched your search

@@ -49,6 +49,7 @@ import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
import com.android.systemui.shared.system.InteractionJankMonitorWrapper;
/**
* Touch controller for handling various state transitions in portrait UI.
@@ -319,4 +320,44 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
return baseInterpolator.getInterpolation(v);
}
}
@Override
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
switch (ev.getAction()) {
case MotionEvent.ACTION_DOWN:
InteractionJankMonitorWrapper.begin(
mLauncher.getRootView(), InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
break;
case MotionEvent.ACTION_CANCEL:
case MotionEvent.ACTION_UP:
InteractionJankMonitorWrapper.cancel(
InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
break;
}
return super.onControllerInterceptTouchEvent(ev);
}
@Override
protected void onReinitToState(LauncherState newToState) {
super.onReinitToState(newToState);
if (newToState != ALL_APPS) {
InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
}
}
@Override
protected void onReachedFinalState(LauncherState toState) {
super.onReinitToState(toState);
if (toState == ALL_APPS) {
InteractionJankMonitorWrapper.end(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
}
}
@Override
protected void clearState() {
super.clearState();
InteractionJankMonitorWrapper.cancel(InteractionJankMonitorWrapper.CUJ_OPEN_ALL_APPS);
}
}
@@ -124,7 +124,7 @@ public abstract class AbstractStateChangeTouchController
protected abstract boolean canInterceptTouch(MotionEvent ev);
@Override
public final boolean onControllerInterceptTouchEvent(MotionEvent ev) {
public boolean onControllerInterceptTouchEvent(MotionEvent ev) {
if (ev.getAction() == MotionEvent.ACTION_DOWN) {
mNoIntercept = !canInterceptTouch(ev);
if (mNoIntercept) {
@@ -193,6 +193,8 @@ public abstract class AbstractStateChangeTouchController
: reachedToState ? mToState : mFromState;
LauncherState newToState = getTargetState(newFromState, isDragTowardPositive);
onReinitToState(newToState);
if (newFromState == mFromState && newToState == mToState || (newFromState == newToState)) {
return false;
}
@@ -231,6 +233,12 @@ public abstract class AbstractStateChangeTouchController
return true;
}
protected void onReinitToState(LauncherState newToState) {
}
protected void onReachedFinalState(LauncherState newToState) {
}
protected boolean goingBetweenNormalAndOverview(LauncherState fromState,
LauncherState toState) {
return (fromState == NORMAL || fromState == OVERVIEW)
@@ -527,6 +535,7 @@ public abstract class AbstractStateChangeTouchController
mAtomicComponentsController.getAnimationPlayer().end();
mAtomicComponentsController = null;
}
onReachedFinalState(mToState);
clearState();
boolean shouldGoToTargetState = mGoingBetweenStates || (mToState != targetState);
if (shouldGoToTargetState) {