Fill the log container as hotseat or workspace based on position.

Test: manual
Bug: 137953006

Swipe from workspace:
07-30 15:15:44.031  9779  9779 D UserEvent: action:FLING direction=UP direction=UP
07-30 15:15:44.031  9779  9779 D UserEvent:  Source child:WORKSPACE id=0 span(951,1313)	parent:WORKSPACE id=0
07-30 15:15:44.031  9779  9779 D UserEvent:  Destination child:ALLAPPS
07-30 15:15:44.031  9779  9779 D UserEvent:  Elapsed container 826 ms, session 9361 ms, action 0 ms

Swipe from hotseat:
07-30 15:15:46.010  9779  9779 D UserEvent: action:FLING direction=UP direction=UP
07-30 15:15:46.010  9779  9779 D UserEvent:  Source child:HOTSEAT id=0 span(786,1908)	parent:WORKSPACE id=0
07-30 15:15:46.010  9779  9779 D UserEvent:  Destination child:ALLAPPS
07-30 15:15:46.010  9779  9779 D UserEvent:  Elapsed container 1139 ms, session 11339 ms, action 0 ms

Change-Id: I959528889fda778efc569bb59e7f44d3bd5b81bc
This commit is contained in:
Becky Qiu 2019-07-30 15:08:50 -07:00
parent 783717c0c6
commit 84fa94e2fc
7 changed files with 25 additions and 15 deletions

View File

@ -64,7 +64,7 @@ public final class LandscapeStatesTouchController extends PortraitStatesTouchCon
} }
@Override @Override
protected int getLogContainerTypeForNormalState() { protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.WORKSPACE; return LauncherLogProto.ContainerType.WORKSPACE;
} }
} }

View File

@ -75,7 +75,7 @@ public class OverviewToAllAppsTouchController extends PortraitStatesTouchControl
} }
@Override @Override
protected int getLogContainerTypeForNormalState() { protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.WORKSPACE; return LauncherLogProto.ContainerType.WORKSPACE;
} }
} }

View File

@ -154,7 +154,7 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll
} }
@Override @Override
protected int getLogContainerTypeForNormalState() { protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.NAVBAR; return LauncherLogProto.ContainerType.NAVBAR;
} }

View File

@ -46,7 +46,7 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro
} }
@Override @Override
protected int getLogContainerTypeForNormalState() { protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.NAVBAR; return LauncherLogProto.ContainerType.NAVBAR;
} }

View File

@ -147,8 +147,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
} }
@Override @Override
protected int getLogContainerTypeForNormalState() { protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return ContainerType.HOTSEAT; return isTouchOverHotseat(mLauncher, ev) ? ContainerType.HOTSEAT : ContainerType.WORKSPACE;
} }
private AnimatorSetBuilder getNormalToOverviewAnimation() { private AnimatorSetBuilder getNormalToOverviewAnimation() {

View File

@ -69,6 +69,7 @@ public abstract class AbstractStateChangeTouchController
protected final SwipeDetector.Direction mSwipeDirection; protected final SwipeDetector.Direction mSwipeDirection;
private boolean mNoIntercept; private boolean mNoIntercept;
private boolean mIsLogContainerSet;
protected int mStartContainerType; protected int mStartContainerType;
protected LauncherState mStartState; protected LauncherState mStartState;
@ -180,7 +181,7 @@ public abstract class AbstractStateChangeTouchController
/** /**
* Returns the container that the touch started from when leaving NORMAL state. * Returns the container that the touch started from when leaving NORMAL state.
*/ */
protected abstract int getLogContainerTypeForNormalState(); protected abstract int getLogContainerTypeForNormalState(MotionEvent ev);
private boolean reinitCurrentAnimation(boolean reachedToState, boolean isDragTowardPositive) { private boolean reinitCurrentAnimation(boolean reachedToState, boolean isDragTowardPositive) {
LauncherState newFromState = mFromState == null ? mLauncher.getStateManager().getState() LauncherState newFromState = mFromState == null ? mLauncher.getStateManager().getState()
@ -231,13 +232,7 @@ public abstract class AbstractStateChangeTouchController
@Override @Override
public void onDragStart(boolean start) { public void onDragStart(boolean start) {
mStartState = mLauncher.getStateManager().getState(); mStartState = mLauncher.getStateManager().getState();
if (mStartState == ALL_APPS) { mIsLogContainerSet = false;
mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS;
} else if (mStartState == NORMAL) {
mStartContainerType = getLogContainerTypeForNormalState();
} else if (mStartState == OVERVIEW){
mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER;
}
if (mCurrentAnimation == null) { if (mCurrentAnimation == null) {
mFromState = mStartState; mFromState = mStartState;
mToState = null; mToState = null;
@ -285,6 +280,21 @@ public abstract class AbstractStateChangeTouchController
return true; return true;
} }
@Override
public boolean onDrag(float displacement, MotionEvent ev) {
if (!mIsLogContainerSet) {
if (mStartState == ALL_APPS) {
mStartContainerType = LauncherLogProto.ContainerType.ALLAPPS;
} else if (mStartState == NORMAL) {
mStartContainerType = getLogContainerTypeForNormalState(ev);
} else if (mStartState == OVERVIEW) {
mStartContainerType = LauncherLogProto.ContainerType.TASKSWITCHER;
}
mIsLogContainerSet = true;
}
return onDrag(displacement);
}
protected void updateProgress(float fraction) { protected void updateProgress(float fraction) {
mCurrentAnimation.setPlayFraction(fraction); mCurrentAnimation.setPlayFraction(fraction);
if (mAtomicComponentsController != null) { if (mAtomicComponentsController != null) {

View File

@ -57,7 +57,7 @@ public class AllAppsSwipeController extends AbstractStateChangeTouchController {
} }
@Override @Override
protected int getLogContainerTypeForNormalState() { protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return mLauncher.getDragLayer().isEventOverView(mLauncher.getHotseat(), mTouchDownEvent) ? return mLauncher.getDragLayer().isEventOverView(mLauncher.getHotseat(), mTouchDownEvent) ?
ContainerType.HOTSEAT : ContainerType.WORKSPACE; ContainerType.HOTSEAT : ContainerType.WORKSPACE;
} }