Good riddance UserEventDispatcher

Bug: 165675920
Bug: 161381246

TL;DR;;
- nano -> lite proto
- add all the missing logs to WW
- pin item related logging fix
- Removed logging for assistant

sgrep "com.android.launcher3.userevent.nano." | cut -f1 -d: | xargs sed -i -e 's/userevent\.nano\./userevent\./g'

Change-Id: Ie2a49fdd891cacbd7ef40a1dc9e41ff0574c7517
This commit is contained in:
Hyunyoung Song
2020-09-15 00:34:10 -07:00
parent 380d603f83
commit 95786e077d
66 changed files with 232 additions and 1566 deletions
@@ -16,11 +16,8 @@
package com.android.launcher3.appprediction;
import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.icons.GraphicsUtils.setColorAlphaBound;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import static com.android.launcher3.logging.LoggerUtils.newTarget;
import android.annotation.TargetApi;
import android.content.Context;
@@ -43,7 +40,6 @@ import com.android.launcher3.DeviceProfile;
import com.android.launcher3.DeviceProfile.OnDeviceProfileChangeListener;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.allapps.AllAppsSectionDecorator;
import com.android.launcher3.allapps.FloatingHeaderRow;
@@ -53,13 +49,11 @@ import com.android.launcher3.anim.PropertySetter;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.keyboard.FocusIndicatorHelper;
import com.android.launcher3.keyboard.FocusIndicatorHelper.SimpleFocusIndicatorHelper;
import com.android.launcher3.logging.StatsLogUtils.LogContainerProvider;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.touch.ItemClickHandler;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.Themes;
import com.android.quickstep.AnimatedFloat;
@@ -68,7 +62,7 @@ import java.util.List;
@TargetApi(Build.VERSION_CODES.P)
public class PredictionRowView extends LinearLayout implements
LogContainerProvider, OnDeviceProfileChangeListener, FloatingHeaderRow {
OnDeviceProfileChangeListener, FloatingHeaderRow {
private static final IntProperty<PredictionRowView> TEXT_ALPHA =
new IntProperty<PredictionRowView>("textAlpha") {
@@ -271,29 +265,6 @@ public class PredictionRowView extends LinearLayout implements
mParent.onHeightUpdated();
}
@Override
public void fillInLogContainerData(ItemInfo childInfo, LauncherLogProto.Target child,
ArrayList<LauncherLogProto.Target> parents) {
for (int i = 0; i < mPredictedApps.size(); i++) {
ItemInfoWithIcon appInfo = mPredictedApps.get(i);
if (appInfo == childInfo) {
child.predictedRank = i;
break;
}
}
parents.add(newContainerTarget(LauncherLogProto.ContainerType.PREDICTION));
// include where the prediction is coming this used to be Launcher#modifyUserEvent
LauncherLogProto.Target parent = newTarget(LauncherLogProto.Target.Type.CONTAINER);
LauncherState state = mLauncher.getStateManager().getState();
if (state == LauncherState.ALL_APPS) {
parent.containerType = LauncherLogProto.ContainerType.ALLAPPS;
} else if (state == OVERVIEW) {
parent.containerType = LauncherLogProto.ContainerType.TASKSWITCHER;
}
parents.add(parent);
}
public void setTextAlpha(int textAlpha) {
mIconLastSetTextAlpha = textAlpha;
if (getAlpha() < 1 && textAlpha > 0) {
@@ -55,7 +55,6 @@ import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.touch.ItemLongClickListener;
import com.android.launcher3.uioverrides.PredictedAppIcon;
import com.android.launcher3.uioverrides.QuickstepLauncher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.OnboardingPrefs;
import com.android.launcher3.views.ArrowTipView;
import com.android.launcher3.views.Snackbar;
@@ -16,6 +16,7 @@
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_ALLAPPS;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
import android.content.Context;
@@ -23,7 +24,6 @@ import android.content.Context;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.allapps.AllAppsContainerView;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
/**
* Definition for AllApps state
@@ -40,7 +40,7 @@ public class AllAppsState extends LauncherState {
};
public AllAppsState(int id) {
super(id, ContainerType.ALLAPPS, STATE_FLAGS);
super(id, LAUNCHER_STATE_ALLAPPS, STATE_FLAGS);
}
@Override
@@ -15,12 +15,13 @@
*/
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import android.content.Context;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.allapps.AllAppsTransitionController;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
@@ -33,7 +34,7 @@ public class BackgroundAppState extends OverviewState {
| FLAG_WORKSPACE_INACCESSIBLE | FLAG_NON_INTERACTIVE | FLAG_CLOSE_POPUPS;
public BackgroundAppState(int id) {
this(id, LauncherLogProto.ContainerType.TASKSWITCHER);
this(id, LAUNCHER_STATE_BACKGROUND);
}
protected BackgroundAppState(int id, int logContainer) {
@@ -15,13 +15,14 @@
*/
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import android.content.Context;
import android.graphics.Rect;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.views.RecentsView;
/**
@@ -34,7 +35,7 @@ public class OverviewModalTaskState extends OverviewState {
FLAG_DISABLE_RESTORE | FLAG_OVERVIEW_UI | FLAG_WORKSPACE_INACCESSIBLE;
public OverviewModalTaskState(int id) {
super(id, ContainerType.OVERVIEW, STATE_FLAGS);
super(id, LAUNCHER_STATE_OVERVIEW, STATE_FLAGS);
}
@Override
@@ -16,6 +16,7 @@
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import static com.android.quickstep.SysUINavigationMode.Mode.NO_BUTTON;
import static com.android.quickstep.SysUINavigationMode.hideShelfInTwoButtonLandscape;
import static com.android.quickstep.SysUINavigationMode.removeShelfFromOverview;
@@ -29,7 +30,6 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.views.RecentsView;
@@ -51,7 +51,7 @@ public class OverviewState extends LauncherState {
}
protected OverviewState(int id, int stateFlags) {
this(id, ContainerType.TASKSWITCHER, stateFlags);
this(id, LAUNCHER_STATE_OVERVIEW, stateFlags);
}
protected OverviewState(int id, int logContainer, int stateFlags) {
@@ -15,8 +15,9 @@
*/
package com.android.launcher3.uioverrides.states;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import com.android.launcher3.Launcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
/**
* State to indicate we are about to launch a recent task. Note that this state is only used when
@@ -26,7 +27,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto;
public class QuickSwitchState extends BackgroundAppState {
public QuickSwitchState(int id) {
super(id, LauncherLogProto.ContainerType.APP);
super(id, LAUNCHER_STATE_BACKGROUND);
}
@Override
@@ -12,8 +12,6 @@ import com.android.launcher3.LauncherState;
import com.android.launcher3.states.StateAnimationConfig.AnimationFlags;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.quickstep.SystemUiProxy;
/**
@@ -45,11 +43,6 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro
return draggingFromNav ? OVERVIEW : NORMAL;
}
@Override
protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.NAVBAR;
}
@Override
protected float getShiftRange() {
return mLauncher.getDragLayer().getWidth();
@@ -65,13 +58,8 @@ public class LandscapeEdgeSwipeController extends AbstractStateChangeTouchContro
}
@Override
protected int getDirectionForLog() {
return mLauncher.getDeviceProfile().isSeascape() ? Direction.RIGHT : Direction.LEFT;
}
@Override
protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) {
super.onSwipeInteractionCompleted(targetState, logAction);
protected void onSwipeInteractionCompleted(LauncherState targetState) {
super.onSwipeInteractionCompleted(targetState);
if (mStartState == NORMAL && targetState == OVERVIEW) {
SystemUiProxy.INSTANCE.get(mLauncher).onOverviewShown(true, TAG);
}
@@ -45,12 +45,9 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.compat.AccessibilityManagerCompat;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.graphics.OverviewScrim;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.util.AnimatorControllerWithResistance;
import com.android.quickstep.util.AssistantUtilities;
@@ -211,7 +208,6 @@ public class NavBarToHomeTouchController implements TouchController,
@Override
public void onDragEnd(float velocity) {
boolean fling = mSwipeDetector.isFling(velocity);
final int logAction = fling ? Touch.FLING : Touch.SWIPE;
float progress = mCurrentAnimation.getProgressFraction();
float interpolatedProgress = PULLBACK_INTERPOLATOR.getInterpolation(progress);
boolean success = interpolatedProgress >= SUCCESS_TRANSITION_PROGRESS
@@ -230,7 +226,7 @@ public class NavBarToHomeTouchController implements TouchController,
() -> onSwipeInteractionCompleted(mEndState));
}
if (mStartState != mEndState) {
// TODO: add to WW log
logHomeGesture();
}
AbstractFloatingView topOpenView = AbstractFloatingView.getTopOpenView(mLauncher);
if (topOpenView != null) {
@@ -255,17 +251,10 @@ public class NavBarToHomeTouchController implements TouchController,
AccessibilityManagerCompat.sendStateEventToTest(mLauncher, targetState.ordinal);
}
private void logStateChange(int startContainerType, int logAction) {
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
LauncherLogProto.Action.Direction.UP,
mSwipeDetector.getDownX(), mSwipeDetector.getDownY(),
LauncherLogProto.ContainerType.NAVBAR,
startContainerType,
mEndState.containerType,
mLauncher.getWorkspace().getCurrentPage());
private void logHomeGesture() {
mLauncher.getStatsLogManager().logger()
.withSrcState(StatsLogManager.containerTypeToAtomState(mStartState.containerType))
.withDstState(StatsLogManager.containerTypeToAtomState(mEndState.containerType))
.withSrcState(mStartState.statsLogOrdinal)
.withDstState(mEndState.statsLogOrdinal)
.log(LAUNCHER_HOME_GESTURE);
}
}
@@ -49,7 +49,6 @@ import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.graphics.OverviewScrim;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.VibratorWrapper;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.util.AnimatorControllerWithResistance;
@@ -207,7 +206,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
private void maybeSwipeInteractionToOverviewComplete() {
if (mReachedOverview && mDetector.isSettlingState()) {
onSwipeInteractionCompleted(OVERVIEW, Touch.SWIPE);
onSwipeInteractionCompleted(OVERVIEW);
}
}
@@ -251,7 +250,7 @@ public class NoButtonNavbarToOverviewTouchController extends PortraitStatesTouch
private void goToOverviewOrHomeOnDragEnd(float velocity) {
boolean goToHomeInsteadOfOverview = !mMotionPauseDetector.isPaused();
if (goToHomeInsteadOfOverview) {
new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL, Touch.FLING))
new OverviewToHomeAnim(mLauncher, ()-> onSwipeInteractionCompleted(NORMAL))
.animateWithVelocity(velocity);
}
if (mReachedOverview) {
@@ -57,13 +57,9 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.graphics.OverviewScrim;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.touch.BaseSwipeDetector;
import com.android.launcher3.touch.BothAxesSwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
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.launcher3.util.VibratorWrapper;
import com.android.quickstep.AnimatedFloat;
@@ -287,7 +283,6 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
boolean horizontalFling = mSwipeDetector.isFling(velocity.x);
boolean verticalFling = mSwipeDetector.isFling(velocity.y);
boolean noFling = !horizontalFling && !verticalFling;
int logAction = noFling ? Touch.SWIPE : Touch.FLING;
if (mMotionPauseDetector.isPaused() && noFling) {
cancelAnimations();
@@ -298,7 +293,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
overviewAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onAnimationToStateCompleted(OVERVIEW, logAction);
onAnimationToStateCompleted(OVERVIEW);
}
});
overviewAnim.start();
@@ -393,7 +388,7 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
}
nonOverviewAnim.setDuration(Math.max(xDuration, yDuration));
mNonOverviewAnim.setEndAction(() -> onAnimationToStateCompleted(targetState, logAction));
mNonOverviewAnim.setEndAction(() -> onAnimationToStateCompleted(targetState));
cancelAnimations();
xOverviewAnim.start();
@@ -401,27 +396,17 @@ public class NoButtonQuickSwitchTouchController implements TouchController,
nonOverviewAnim.start();
}
private void onAnimationToStateCompleted(LauncherState targetState, int logAction) {
mLauncher.getUserEventDispatcher().logStateChangeAction(logAction,
getDirectionForLog(), mSwipeDetector.getDownX(), mSwipeDetector.getDownY(),
LauncherLogProto.ContainerType.NAVBAR,
mStartState.containerType,
targetState.containerType,
mLauncher.getWorkspace().getCurrentPage());
private void onAnimationToStateCompleted(LauncherState targetState) {
mLauncher.getStatsLogManager().logger()
.withSrcState(LAUNCHER_STATE_HOME)
.withDstState(StatsLogManager.containerTypeToAtomState(targetState.containerType))
.log(getLauncherAtomEvent(mStartState.containerType, targetState.containerType,
.withDstState(targetState.statsLogOrdinal)
.log(getLauncherAtomEvent(mStartState.statsLogOrdinal, targetState.statsLogOrdinal,
targetState.ordinal > mStartState.ordinal
? LAUNCHER_UNKNOWN_SWIPEUP
: LAUNCHER_UNKNOWN_SWIPEDOWN));
mLauncher.getStateManager().goToState(targetState, false, this::clearState);
}
private int getDirectionForLog() {
return Utilities.isRtl(mLauncher.getResources()) ? Direction.LEFT : Direction.RIGHT;
}
private void cancelAnimations() {
if (mNonOverviewAnim != null) {
mNonOverviewAnim.getAnimationPlayer().cancel();
@@ -25,7 +25,6 @@ import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.Utilities;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.views.RecentsView;
@@ -73,9 +72,4 @@ public class OverviewToAllAppsTouchController extends PortraitStatesTouchControl
}
return fromState;
}
@Override
protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.WORKSPACE;
}
}
@@ -48,8 +48,6 @@ import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.uioverrides.states.OverviewState;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TouchInteractionService;
import com.android.quickstep.util.LayoutUtils;
@@ -172,11 +170,6 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
return fromState;
}
@Override
protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return isTouchOverHotseat(mLauncher, ev) ? ContainerType.HOTSEAT : ContainerType.WORKSPACE;
}
private StateAnimationConfig getNormalToOverviewAnimation() {
mAllAppsInterpolatorWrapper.baseInterpolator = LINEAR;
@@ -285,7 +278,7 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
private void cancelPendingAnim() {
if (mPendingAnimation != null) {
mPendingAnimation.finish(false, Touch.SWIPE);
mPendingAnimation.finish(false);
mPendingAnimation = null;
}
}
@@ -320,8 +313,8 @@ public class PortraitStatesTouchController extends AbstractStateChangeTouchContr
}
@Override
protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) {
super.onSwipeInteractionCompleted(targetState, logAction);
protected void onSwipeInteractionCompleted(LauncherState targetState) {
super.onSwipeInteractionCompleted(targetState);
if (mStartState == NORMAL && targetState == OVERVIEW) {
SystemUiProxy.INSTANCE.get(mLauncher).onOverviewShown(true, TAG);
}
@@ -21,6 +21,7 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.DEACCEL_2;
import static com.android.launcher3.anim.Interpolators.INSTANT;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_ALL_APPS_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_FADE;
import static com.android.launcher3.states.StateAnimationConfig.ANIM_OVERVIEW_SCALE;
@@ -41,8 +42,6 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.states.StateAnimationConfig;
import com.android.launcher3.touch.AbstractStateChangeTouchController;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.quickstep.SysUINavigationMode;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.SystemUiProxy;
@@ -92,14 +91,14 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll
@Override
public void onDragStart(boolean start, float startDisplacement) {
super.onDragStart(start, startDisplacement);
mStartContainerType = LauncherLogProto.ContainerType.NAVBAR;
mStartContainerType = LAUNCHER_STATE_BACKGROUND;
ActivityManagerWrapper.getInstance()
.closeSystemWindows(CLOSE_SYSTEM_WINDOWS_REASON_RECENTS);
}
@Override
protected void onSwipeInteractionCompleted(LauncherState targetState, int logAction) {
super.onSwipeInteractionCompleted(targetState, logAction);
protected void onSwipeInteractionCompleted(LauncherState targetState) {
super.onSwipeInteractionCompleted(targetState);
}
@Override
@@ -153,14 +152,4 @@ public class QuickSwitchTouchController extends AbstractStateChangeTouchControll
protected float getShiftRange() {
return mLauncher.getDeviceProfile().widthPx / 2f;
}
@Override
protected int getLogContainerTypeForNormalState(MotionEvent ev) {
return LauncherLogProto.ContainerType.NAVBAR;
}
@Override
protected int getDirectionForLog() {
return Utilities.isRtl(mLauncher.getResources()) ? Direction.LEFT : Direction.RIGHT;
}
}
@@ -15,10 +15,12 @@
*/
package com.android.launcher3.uioverrides.touchcontrollers;
import static android.view.MotionEvent.ACTION_CANCEL;
import static android.view.MotionEvent.ACTION_DOWN;
import static android.view.MotionEvent.ACTION_MOVE;
import static android.view.MotionEvent.ACTION_UP;
import static android.view.MotionEvent.ACTION_CANCEL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN;
import android.graphics.PointF;
import android.util.SparseArray;
@@ -31,12 +33,9 @@ import com.android.launcher3.AbstractFloatingView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherState;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.SystemUiProxy;
import java.io.PrintWriter;
/**
@@ -133,9 +132,8 @@ public class StatusBarTouchController implements TouchController {
int action = ev.getAction();
if (action == ACTION_UP || action == ACTION_CANCEL) {
dispatchTouchEvent(ev);
mLauncher.getUserEventDispatcher().logActionOnContainer(action == ACTION_UP ?
Touch.FLING : Touch.SWIPE, Direction.DOWN, ContainerType.WORKSPACE,
mLauncher.getWorkspace().getCurrentPage());
mLauncher.getStatsLogManager().logger()
.log(LAUNCHER_SWIPE_DOWN_WORKSPACE_NOTISHADE_OPEN);
setWindowSlippery(false);
return true;
}
@@ -36,7 +36,6 @@ import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.touch.BaseSwipeDetector;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.SingleAxisSwipeDetector;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.FlingBlockCheck;
import com.android.launcher3.util.TouchController;
import com.android.launcher3.views.BaseDragLayer;
@@ -203,7 +202,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
mCurrentAnimation.setPlayFraction(0);
}
if (mPendingAnimation != null) {
mPendingAnimation.finish(false, Touch.SWIPE);
mPendingAnimation.finish(false);
mPendingAnimation = null;
}
@@ -285,7 +284,6 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
public void onDragEnd(float velocity) {
boolean fling = mDetector.isFling(velocity);
final boolean goingToEnd;
final int logAction;
boolean blockedFling = fling && mFlingBlockCheck.isBlocked();
if (blockedFling) {
fling = false;
@@ -294,11 +292,9 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
float progress = mCurrentAnimation.getProgressFraction();
float interpolatedProgress = mCurrentAnimation.getInterpolatedProgress();
if (fling) {
logAction = Touch.FLING;
boolean goingUp = orientationHandler.isGoingUp(velocity, mIsRtl);
goingToEnd = goingUp == mCurrentAnimationIsGoingUp;
} else {
logAction = Touch.SWIPE;
goingToEnd = interpolatedProgress > SUCCESS_TRANSITION_PROGRESS;
}
long animationDuration = BaseSwipeDetector.calculateDuration(
@@ -307,14 +303,14 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
animationDuration *= LauncherAnimUtils.blockedFlingDurationFactor(velocity);
}
mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd, logAction));
mCurrentAnimation.setEndAction(() -> onCurrentAnimationEnd(goingToEnd));
mCurrentAnimation.startWithVelocity(mActivity, goingToEnd,
velocity, mEndDisplacement, animationDuration);
}
private void onCurrentAnimationEnd(boolean wasSuccess, int logAction) {
private void onCurrentAnimationEnd(boolean wasSuccess) {
if (mPendingAnimation != null) {
mPendingAnimation.finish(wasSuccess, logAction);
mPendingAnimation.finish(wasSuccess);
mPendingAnimation = null;
}
clearState();
@@ -326,7 +322,7 @@ public abstract class TaskViewTouchController<T extends BaseDraggingActivity>
mTaskBeingDragged = null;
mCurrentAnimation = null;
if (mPendingAnimation != null) {
mPendingAnimation.finish(false, Touch.SWIPE);
mPendingAnimation.finish(false);
mPendingAnimation = null;
}
}
@@ -75,12 +75,8 @@ import com.android.launcher3.anim.AnimationSuccessListener;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.StatsLogManager;
import com.android.launcher3.logging.StatsLogManager.StatsLogger;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.launcher3.util.TraceHelper;
import com.android.launcher3.util.VibratorWrapper;
import com.android.launcher3.util.WindowBounds;
@@ -219,8 +215,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
private boolean mPassedOverviewThreshold;
private boolean mGestureStarted;
private int mLogAction = Touch.SWIPE;
private int mLogDirection = Direction.UP;
private boolean mLogDirectionUpOrLeft = true;
private PointF mDownPos;
private boolean mIsLikelyToStartNewTask;
@@ -745,7 +740,6 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
public void onGestureCancelled() {
updateDisplacement(0);
mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED);
mLogAction = Touch.SWIPE_NOOP;
handleNormalGestureEnd(0, false, new PointF(), true /* isCancel */);
}
@@ -761,13 +755,11 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
boolean isFling = mGestureStarted && !mIsMotionPaused
&& Math.abs(endVelocity) > flingThreshold;
mStateCallback.setStateOnUiThread(STATE_GESTURE_COMPLETED);
mLogAction = isFling ? Touch.FLING : Touch.SWIPE;
boolean isVelocityVertical = Math.abs(velocity.y) > Math.abs(velocity.x);
if (isVelocityVertical) {
mLogDirection = velocity.y < 0 ? Direction.UP : Direction.DOWN;
mLogDirectionUpOrLeft = velocity.y < 0;
} else {
mLogDirection = velocity.x < 0 ? Direction.LEFT : Direction.RIGHT;
mLogDirectionUpOrLeft = velocity.x < 0;
}
mDownPos = downPos;
handleNormalGestureEnd(endVelocity, isFling, velocity, false /* isCancel */);
@@ -979,8 +971,7 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
break;
case LAST_TASK:
case NEW_TASK:
event = (mLogDirection == Direction.LEFT)
? LAUNCHER_QUICKSWITCH_LEFT
event = mLogDirectionUpOrLeft ? LAUNCHER_QUICKSWITCH_LEFT
: LAUNCHER_QUICKSWITCH_RIGHT;
break;
default:
@@ -988,12 +979,10 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
}
StatsLogger logger = StatsLogManager.newInstance(mContext).logger()
.withSrcState(LAUNCHER_STATE_BACKGROUND)
.withDstState(StatsLogManager.containerTypeToAtomState(endTarget.containerType));
.withDstState(endTarget.containerType);
if (targetTask != null) {
logger.withItemInfo(targetTask.getItemInfo());
}
logger.log(event);
DeviceProfile dp = mDp;
if (dp == null || mDownPos == null) {
@@ -1003,12 +992,8 @@ public abstract class AbsSwipeUpHandler<T extends StatefulActivity<?>, Q extends
int pageIndex = endTarget == LAST_TASK
? LOG_NO_OP_PAGE_INDEX
: mRecentsView.getNextPage();
UserEventDispatcher.newInstance(mContext).logStateChangeAction(
mLogAction, mLogDirection,
(int) mDownPos.x, (int) mDownPos.y,
ContainerType.NAVBAR, ContainerType.APP,
endTarget.containerType,
pageIndex);
// TODO: set correct container using the pageIndex
logger.log(event);
}
/** Animates to the given progress, where 0 is the current app and 1 is overview. */
@@ -152,11 +152,6 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
public abstract void onExitOverview(RotationTouchHelper deviceState,
Runnable exitRunnable);
/**
* Used for containerType in {@link com.android.launcher3.logging.UserEventDispatcher}
*/
public abstract int getContainerType();
public abstract boolean isInLiveTileMode();
public abstract void onLaunchTaskFailed();
@@ -28,7 +28,6 @@ import androidx.annotation.Nullable;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.fallback.RecentsState;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.AnimatorControllerWithResistance;
@@ -144,15 +143,6 @@ public final class FallbackActivityInterface extends
// no-op, fake landscape not supported for 3P
}
@Override
public int getContainerType() {
RecentsActivity activity = getCreatedActivity();
boolean visible = activity != null && activity.isStarted() && activity.hasWindowFocus();
return visible
? LauncherLogProto.ContainerType.OTHER_LAUNCHER_APP
: LauncherLogProto.ContainerType.APP;
}
@Override
public boolean isInLiveTileMode() {
return false;
@@ -15,6 +15,9 @@
*/
package com.android.quickstep;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_OVERVIEW;
import static com.android.quickstep.MultiStateCallback.DEBUG_STATES;
import android.annotation.TargetApi;
@@ -23,7 +26,6 @@ import android.content.Intent;
import android.os.Build;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.util.ActiveGestureLog;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.RemoteAnimationTargetCompat;
@@ -44,13 +46,13 @@ public class GestureState implements RecentsAnimationCallbacks.RecentsAnimationL
* Defines the end targets of a gesture and the associated state.
*/
public enum GestureEndTarget {
HOME(true, ContainerType.WORKSPACE, false),
HOME(true, LAUNCHER_STATE_HOME, false),
RECENTS(true, ContainerType.TASKSWITCHER, true),
RECENTS(true, LAUNCHER_STATE_OVERVIEW, true),
NEW_TASK(false, ContainerType.APP, true),
NEW_TASK(false, LAUNCHER_STATE_BACKGROUND, true),
LAST_TASK(false, ContainerType.APP, true);
LAST_TASK(false, LAUNCHER_STATE_BACKGROUND, true);
GestureEndTarget(boolean isLauncher, int containerType,
boolean recentsAttachedToAppWindow) {
@@ -44,7 +44,6 @@ import com.android.launcher3.statehandlers.DepthController.ClampedDepthProperty;
import com.android.launcher3.statemanager.StateManager;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.SysUINavigationMode.Mode;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.AnimatorControllerWithResistance;
@@ -208,10 +207,6 @@ public final class LauncherActivityInterface extends
return false;
}
launcher.getUserEventDispatcher().logActionCommand(
LauncherLogProto.Action.Command.RECENTS_BUTTON,
getContainerType(),
LauncherLogProto.ContainerType.TASKSWITCHER);
launcher.getStateManager().goToState(OVERVIEW,
launcher.getStateManager().shouldAnimateStateChange(), onCompleteCallback);
return true;
@@ -252,13 +247,6 @@ public final class LauncherActivityInterface extends
return true;
}
@Override
public int getContainerType() {
final Launcher launcher = getVisibleLauncher();
return launcher != null ? launcher.getStateManager().getState().containerType
: LauncherLogProto.ContainerType.APP;
}
@Override
public boolean isInLiveTileMode() {
Launcher launcher = getCreatedActivity();
@@ -30,7 +30,6 @@ import android.view.ViewConfiguration;
import androidx.annotation.BinderThread;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.quickstep.util.ActivityInitListener;
import com.android.quickstep.util.RemoteAnimationProvider;
import com.android.quickstep.views.RecentsView;
@@ -150,7 +149,6 @@ public class OverviewCommandHelper {
private final AppToOverviewAnimationProvider<T> mAnimationProvider;
private final long mToggleClickedTime = SystemClock.uptimeMillis();
private boolean mUserEventLogged;
private ActivityInitListener mListener;
public RecentsActivityCommand() {
@@ -212,13 +210,6 @@ public class OverviewCommandHelper {
private boolean onActivityReady(Boolean wasVisible) {
final T activity = mActivityInterface.getCreatedActivity();
if (!mUserEventLogged) {
activity.getUserEventDispatcher().logActionCommand(
LauncherLogProto.Action.Command.RECENTS_BUTTON,
mActivityInterface.getContainerType(),
LauncherLogProto.ContainerType.TASKSWITCHER);
mUserEventLogged = true;
}
return mAnimationProvider.onActivityReady(activity, wasVisible);
}
@@ -118,7 +118,6 @@ public final class RecentsActivity extends StatefulActivity<RecentsState> {
* etc.)
*/
protected void onHandleConfigChanged() {
mUserEventDispatcher = null;
initDeviceProfile();
AbstractFloatingView.closeOpenViews(this, true,
@@ -21,7 +21,6 @@ import static android.view.Display.DEFAULT_DISPLAY;
import static com.android.launcher3.config.FeatureFlags.ENABLE_OVERVIEW_SELECTIONS;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP;
import android.app.Activity;
import android.app.ActivityOptions;
@@ -39,7 +38,6 @@ import com.android.launcher3.logging.StatsLogManager.LauncherEvent;
import com.android.launcher3.model.WellbeingModel;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.popup.SystemShortcut.AppInfo;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.util.Executors;
import com.android.launcher3.util.InstantAppResolver;
import com.android.quickstep.views.RecentsView;
@@ -228,8 +226,6 @@ public interface TaskShortcutFactory {
@Override
protected boolean onActivityStarted(BaseDraggingActivity activity) {
activity.getUserEventDispatcher().logActionOnControl(TAP,
LauncherLogProto.ControlType.SPLIT_SCREEN_TARGET);
return true;
}
};
@@ -25,12 +25,6 @@ import static android.view.MotionEvent.ACTION_POINTER_UP;
import static android.view.MotionEvent.ACTION_UP;
import static com.android.launcher3.Utilities.squaredHypot;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPLEFT;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction.UPRIGHT;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.FLING;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.SWIPE_NOOP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.NAVBAR;
import android.animation.ValueAnimator;
import android.content.Context;
@@ -47,7 +41,6 @@ import android.view.ViewConfiguration;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.quickstep.BaseActivityInterface;
import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
@@ -80,7 +73,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
private float mTimeFraction;
private long mDragTime;
private float mLastProgress;
private int mDirection;
private BaseActivityInterface mActivityInterface;
private final float mDragDistThreshold;
@@ -197,8 +189,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
if (mState != STATE_DELEGATE_ACTIVE && !mLaunchedAssistant) {
ValueAnimator animator = ValueAnimator.ofFloat(mLastProgress, 0)
.setDuration(RETRACT_ANIMATION_DURATION_MS);
UserEventDispatcher.newInstance(mContext).logActionOnContainer(
SWIPE_NOOP, mDirection, NAVBAR);
animator.addUpdateListener(valueAnimator -> {
float progress = (float) valueAnimator.getAnimatedValue();
SystemUiProxy.INSTANCE.get(mContext).onAssistantProgress(progress);
@@ -223,7 +213,7 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
mLastProgress = Math.min(mDistance * 1f / mDragDistThreshold, 1) * mTimeFraction;
if (mDistance >= mDragDistThreshold && mTimeFraction >= 1) {
SystemUiProxy.INSTANCE.get(mContext).onAssistantGestureCompletion(0);
startAssistantInternal(SWIPE);
startAssistantInternal();
Bundle args = new Bundle();
args.putInt(OPA_BUNDLE_TRIGGER, OPA_BUNDLE_TRIGGER_DIAG_SWIPE_GESTURE);
@@ -236,10 +226,7 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
}
}
private void startAssistantInternal(int gestureType) {
UserEventDispatcher.newInstance(mContext)
.logActionOnContainer(gestureType, mDirection, NAVBAR);
private void startAssistantInternal() {
BaseDraggingActivity launcherActivity = mActivityInterface.getCreatedActivity();
if (launcherActivity != null) {
launcherActivity.getRootView().performHapticFeedback(
@@ -253,7 +240,6 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
*/
private boolean isValidAssistantGestureAngle(float deltaX, float deltaY) {
float angle = (float) Math.toDegrees(Math.atan2(deltaY, deltaX));
mDirection = angle > 90 ? UPLEFT : UPRIGHT;
// normalize so that angle is measured clockwise from horizontal in the bottom right corner
// and counterclockwise from horizontal in the bottom left corner
@@ -272,7 +258,7 @@ public class AssistantInputConsumer extends DelegateInputConsumer {
mLastProgress = 1;
SystemUiProxy.INSTANCE.get(mContext).onAssistantGestureCompletion(
(float) Math.sqrt(velocityX * velocityX + velocityY * velocityY));
startAssistantInternal(FLING);
startAssistantInternal();
Bundle args = new Bundle();
args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_GESTURE);
@@ -15,6 +15,7 @@
*/
package com.android.quickstep.inputconsumers;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_BACKGROUND;
import static com.android.launcher3.logging.StatsLogManager.LAUNCHER_STATE_HOME;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_HOME_GESTURE;
@@ -27,9 +28,6 @@ import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.quickstep.GestureState;
import com.android.quickstep.InputConsumer;
import com.android.quickstep.RecentsAnimationDeviceState;
@@ -82,17 +80,12 @@ public class OverviewWithoutFocusInputConsumer implements InputConsumer,
mContext.startActivity(mGestureState.getHomeIntent());
ActiveGestureLog.INSTANCE.addLog("startQuickstep");
BaseActivity activity = BaseDraggingActivity.fromContext(mContext);
int pageIndex = -1; // This number doesn't reflect workspace page index.
// It only indicates that launcher client screen was shown.
int containerType = (mGestureState != null && mGestureState.getEndTarget() != null)
int state = (mGestureState != null && mGestureState.getEndTarget() != null)
? mGestureState.getEndTarget().containerType
: LauncherLogProto.ContainerType.WORKSPACE;
activity.getUserEventDispatcher().logActionOnContainer(
wasFling ? Touch.FLING : Touch.SWIPE, Direction.UP, containerType, pageIndex);
activity.getUserEventDispatcher().setPreviousHomeGesture(true);
: LAUNCHER_STATE_HOME;
activity.getStatsLogManager().logger()
.withSrcState(LAUNCHER_STATE_HOME)
.withDstState(LAUNCHER_STATE_HOME)
.withSrcState(LAUNCHER_STATE_BACKGROUND)
.withDstState(state)
.withContainerInfo(LauncherAtom.ContainerInfo.newBuilder()
.setWorkspace(
LauncherAtom.WorkspaceContainer.newBuilder()
@@ -23,7 +23,6 @@ import static android.view.Surface.ROTATION_180;
import static android.view.Surface.ROTATION_270;
import static android.view.Surface.ROTATION_90;
import static com.android.launcher3.logging.LoggerUtils.extractObjectNameAndAddress;
import static com.android.launcher3.states.RotationHelper.ALLOW_ROTATION_PREFERENCE_KEY;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.quickstep.SysUINavigationMode.Mode.TWO_BUTTONS;
@@ -72,6 +71,7 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
private static final String TAG = "RecentsOrientedState";
private static final boolean DEBUG = false;
private static final String DELIMITER_DOT = "\\.";
private ContentObserver mSystemAutoRotateObserver = new ContentObserver(new Handler()) {
@Override
@@ -534,4 +534,13 @@ public final class RecentsOrientedState implements SharedPreferences.OnSharedPre
? idp.landscapeProfile
: idp.portraitProfile;
}
/**
* String conversion for only the helpful parts of {@link Object#toString()} method
* @param stringToExtract "foo.bar.baz.MyObject@1234"
* @return "MyObject@1234"
*/
private static String extractObjectNameAndAddress(String stringToExtract) {
return stringToExtract.substring(stringToExtract.lastIndexOf(DELIMITER_DOT));
}
}
@@ -42,7 +42,6 @@ import androidx.annotation.StringRes;
import com.android.launcher3.BaseActivity;
import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.systemui.shared.recents.model.Task;
import java.time.Duration;
@@ -217,8 +216,8 @@ public final class DigitalWellBeingToast {
view, 0, 0,
view.getWidth(), view.getHeight());
activity.startActivity(intent, options.toBundle());
activity.getUserEventDispatcher().logActionOnControl(LauncherLogProto.Action.Touch.TAP,
LauncherLogProto.ControlType.APP_USAGE_SETTINGS, view);
// TODO: add WW logging on the app usage settings click.
} catch (ActivityNotFoundException e) {
Log.e(TAG, "Failed to open app usage settings for task "
+ mTask.getTopComponent().getPackageName(), e);
@@ -35,12 +35,11 @@ import static com.android.launcher3.anim.Interpolators.ACCEL_2;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
import static com.android.launcher3.config.FeatureFlags.ENABLE_QUICKSTEP_LIVE_TILE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_CLEAR_ALL;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_DISMISS_SWIPE_UP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
import static com.android.launcher3.statehandlers.DepthController.DEPTH;
import static com.android.launcher3.uioverrides.touchcontrollers.TaskViewTouchController.SUCCESS_TRANSITION_PROGRESS;
import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP;
import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CLEAR_ALL_BUTTON;
import static com.android.launcher3.util.Executors.UI_HELPER_EXECUTOR;
import static com.android.launcher3.util.SystemUiController.UI_STATE_OVERVIEW;
import static com.android.quickstep.TaskUtils.checkCurrentOrManagedUserId;
@@ -108,7 +107,6 @@ import com.android.launcher3.statehandlers.DepthController;
import com.android.launcher3.statemanager.StatefulActivity;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.touch.PagedOrientationHandler.CurveProperties;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.DynamicResource;
import com.android.launcher3.util.MultiValueAlpha;
@@ -1463,7 +1461,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
public PendingAnimation createTaskDismissAnimation(TaskView taskView, boolean animateTaskView,
boolean shouldRemoveTask, long duration) {
if (mPendingAnimation != null) {
mPendingAnimation.finish(false, Touch.SWIPE);
mPendingAnimation.finish(false);
}
PendingAnimation anim = new PendingAnimation(duration);
@@ -1625,7 +1623,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
protected void runDismissAnimation(PendingAnimation pendingAnim) {
AnimatorPlaybackController controller = pendingAnim.createPlaybackController();
controller.dispatchOnStart();
controller.setEndAction(() -> pendingAnim.finish(true, Touch.SWIPE));
controller.setEndAction(() -> pendingAnim.finish(true));
controller.getAnimationPlayer().setInterpolator(FAST_OUT_SLOW_IN);
controller.start();
}
@@ -1638,7 +1636,7 @@ public abstract class RecentsView<T extends StatefulActivity> extends PagedView
@SuppressWarnings("unused")
private void dismissAllTasks(View view) {
runDismissAnimation(createAllTasksDismissAnimation(DISMISS_TASK_DURATION));
mActivity.getUserEventDispatcher().logActionOnControl(TAP, CLEAR_ALL_BUTTON);
mActivity.getStatsLogManager().logger().log(LAUNCHER_TASK_CLEAR_ALL);
}
private void dismissCurrentTask() {
@@ -73,15 +73,11 @@ import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.anim.PendingAnimation;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.ComponentKey;
import com.android.launcher3.util.TransformingTouchDelegate;
import com.android.launcher3.util.ViewPool.Reusable;
@@ -368,7 +364,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
this, RECENTS_LAUNCH_DURATION, TOUCH_RESPONSE_INTERPOLATOR);
AnimatorPlaybackController currentAnimation = pendingAnimation.createPlaybackController();
currentAnimation.setEndAction(() -> {
pendingAnimation.finish(true, Touch.SWIPE);
pendingAnimation.finish(true);
launchTask(false);
});
return currentAnimation;
@@ -483,15 +479,13 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
}
}
private boolean showTaskMenu(int action) {
private boolean showTaskMenu() {
if (!getRecentsView().isClearAllHidden()) {
getRecentsView().snapToPage(getRecentsView().indexOfChild(this));
} else {
mMenuView = TaskMenuView.showForTask(this);
mActivity.getStatsLogManager().logger().withItemInfo(getItemInfo())
.log(LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS);
UserEventDispatcher.newInstance(getContext()).logActionOnItem(action, Direction.NONE,
LauncherLogProto.ItemType.TASK_ICON);
if (mMenuView != null) {
mMenuView.addOnAttachStateChangeListener(mTaskMenuStateListener);
}
@@ -502,10 +496,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
private void setIcon(Drawable icon) {
if (icon != null) {
mIconView.setDrawable(icon);
mIconView.setOnClickListener(v -> showTaskMenu(Touch.TAP));
mIconView.setOnClickListener(v -> showTaskMenu());
mIconView.setOnLongClickListener(v -> {
requestDisallowInterceptTouchEvent(true);
return showTaskMenu(Touch.LONGPRESS);
return showTaskMenu();
});
} else {
mIconView.setDrawable(null);