mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 08:56:55 +00:00
Quick step/scrub/switch logging
- state transition happening due to Home and back is handled by specifying src target as 'from' container and dst target as the 'to' container - Source and Destination container shows FROM and TO state for SWIPE/FLING - event.isStateChange = true indicates that an action resulted in state transition - Elapsed container millis is the screen time on the source container Bug: 70181187 - logcat printout with setprop log.tag.UserEvent VERBOSE 1) State: WORKSPACE -> ALLAPPS action:FLING direction=UP Source child:HOTSEAT id=0 parent:WORKSPACE id=0 Destination child:ALLAPPS Elapsed container 1225 ms, session 1225 ms, action 0 ms 2) ALLAPPS -> HOMESCREEN action:FLING direction=DOWN Source child:ALLAPPS parent:ALLAPPS Destination child:WORKSPACE id=0 Elapsed container 971 ms, session 2197 ms, action 0 ms 3) HOMESCREEN -> OVERVIEW action:FLING direction=UP Source child:NAVBAR parent:WORKSPACE id=0 Destination child:TASKSWITCHER Elapsed container 4834 ms, session 4834 ms, action 0 ms 4) OVERVIEW-> ALLAPPS action:FLING direction=UP Source child:TASK parent:TASKSWITCHER Destination child:ALLAPPS Elapsed container 2176 ms, session 7010 ms, action 0 ms 5) ALLAPPS->OVERVIEW action:FLING direction=DOWN Source child:ALLAPPS parent:ALLAPPS Destination child:TASKSWITCHER Elapsed container 3683 ms, session 10693 ms, action 0 ms 6) OVERVIEW-> HOMESCREEN action:FLING direction=DOWN Source child:TASK parent:TASKSWITCHER Destination child:WORKSPACE id=0 Elapsed container 2108 ms, session 12801 ms, action 0 ms 7) APPS-> OVERVIEW action:FLING direction=UP Source child:NAVBAR parent:APP Destination child:TASKSWITCHER Elapsed container 104 ms, session 104 ms, action 0 ms 8) Quickscrub: action:DRAGANDDROP Source child: QUICK 9) Quickswitch: action:FLING Source child: QUICK Change-Id: I5898230859ff600f48a2a873a40b670fe4d39a0d
This commit is contained in:
@@ -31,6 +31,10 @@ import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.anim.AnimatorPlaybackController;
|
||||
import com.android.launcher3.dragndrop.DragLayer;
|
||||
import com.android.launcher3.touch.SwipeDetector;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
|
||||
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
|
||||
import com.android.launcher3.util.TouchController;
|
||||
import com.android.quickstep.RecentsView;
|
||||
import com.android.quickstep.TaskView;
|
||||
@@ -70,6 +74,7 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
private float mDisplacementShift;
|
||||
private float mProgressMultiplier;
|
||||
private float mEndDisplacement;
|
||||
private int mStartingTarget;
|
||||
|
||||
private TaskView mTaskBeingDragged;
|
||||
|
||||
@@ -120,7 +125,6 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
// calling the callbacks.
|
||||
final int directionsToDetectScroll;
|
||||
boolean ignoreSlopWhenSettling = false;
|
||||
|
||||
if (mCurrentAnimation != null) {
|
||||
directionsToDetectScroll = SwipeDetector.DIRECTION_BOTH;
|
||||
ignoreSlopWhenSettling = true;
|
||||
@@ -139,12 +143,15 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
// The tile can be dragged down to open the task.
|
||||
mTaskBeingDragged = (TaskView) view;
|
||||
directionsToDetectScroll = SwipeDetector.DIRECTION_BOTH;
|
||||
mStartingTarget = LauncherLogProto.ItemType.TASK;
|
||||
} else if (isEventOverHotseat(ev)) {
|
||||
// The hotseat is being dragged
|
||||
directionsToDetectScroll = SwipeDetector.DIRECTION_POSITIVE;
|
||||
mSwipeDownEnabled = false;
|
||||
mStartingTarget = ContainerType.HOTSEAT;
|
||||
} else {
|
||||
mNoIntercept = true;
|
||||
mStartingTarget = ContainerType.WORKSPACE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -249,8 +256,9 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
@Override
|
||||
public void onDragEnd(float velocity, boolean fling) {
|
||||
final boolean goingToEnd;
|
||||
|
||||
final int logAction;
|
||||
if (fling) {
|
||||
logAction = Touch.FLING;
|
||||
boolean goingUp = velocity < 0;
|
||||
if (!goingUp && !mSwipeDownEnabled) {
|
||||
goingToEnd = false;
|
||||
@@ -269,6 +277,7 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
goingToEnd = true;
|
||||
}
|
||||
} else {
|
||||
logAction = Touch.SWIPE;
|
||||
goingToEnd = mCurrentAnimation.getProgressFraction() > SUCCESS_TRANSITION_PROGRESS;
|
||||
}
|
||||
|
||||
@@ -280,7 +289,7 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
progress + velocity * SINGLE_FRAME_MS / Math.abs(mEndDisplacement), 0f, 1f);
|
||||
|
||||
|
||||
mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd));
|
||||
mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction));
|
||||
|
||||
ValueAnimator anim = mCurrentAnimation.getAnimationPlayer();
|
||||
anim.setFloatValues(nextFrameProgress, goingToEnd ? 1f : 0f);
|
||||
@@ -289,19 +298,28 @@ public class OverviewSwipeController extends AnimatorListenerAdapter
|
||||
anim.start();
|
||||
}
|
||||
|
||||
private void onCurrentAnimationEnd(boolean wasSuccess) {
|
||||
// TODO: Might be a good time to log something.
|
||||
private void onCurrentAnimationEnd(boolean wasSuccess, int logAction) {
|
||||
if (mTaskBeingDragged == null) {
|
||||
LauncherState state = wasSuccess ?
|
||||
(mCurrentAnimationIsGoingUp ? ALL_APPS : NORMAL) : OVERVIEW;
|
||||
mLauncher.getStateManager().goToState(state, false);
|
||||
|
||||
} else if (wasSuccess) {
|
||||
if (mCurrentAnimationIsGoingUp) {
|
||||
mRecentsView.onTaskDismissed(mTaskBeingDragged);
|
||||
} else {
|
||||
mTaskBeingDragged.launchTask(false);
|
||||
mLauncher.getUserEventDispatcher().logTaskLaunch(logAction,
|
||||
Direction.DOWN, mTaskBeingDragged.getTask().getTopComponent());
|
||||
}
|
||||
}
|
||||
if (mTaskBeingDragged == null || (wasSuccess && mCurrentAnimationIsGoingUp)) {
|
||||
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
|
||||
mCurrentAnimationIsGoingUp ? Direction.UP : Direction.DOWN,
|
||||
mStartingTarget, ContainerType.TASKSWITCHER,
|
||||
mLauncher.getStateManager().getState().containerType,
|
||||
mRecentsView.getCurrentPage());
|
||||
}
|
||||
mDetector.finishedScrolling();
|
||||
mTaskBeingDragged = null;
|
||||
mCurrentAnimation = null;
|
||||
|
||||
Reference in New Issue
Block a user