diff --git a/protos/launcher_log.proto b/protos/launcher_log.proto index 179f21d804..cd404d6d5f 100644 --- a/protos/launcher_log.proto +++ b/protos/launcher_log.proto @@ -55,6 +55,7 @@ message Target { optional int32 span_y = 14 [default = 1];// Used for ItemType.WIDGET optional int32 predictedRank = 15; optional TargetExtension extension = 16; + optional TipType tip_type = 17; } // Used to define what type of item a Target would represent. @@ -88,6 +89,7 @@ enum ContainerType { NAVBAR = 11; TASKSWITCHER = 12; // Recents UI Container (QuickStep) APP = 13; // Foreground activity is another app (QuickStep) + TIP = 14; // Onboarding texts (QuickStep) } // Used to define what type of control a Target would represent. @@ -109,14 +111,24 @@ enum ControlType { CANCEL_TARGET = 14; } +enum TipType { + DEFAULT_NONE = 0; + BOUNCE = 1; + SWIPE_UP_TEXT = 2; + QUICK_SCRUB_TEXT = 3; + PREDICTION_TEXT = 4; +} + // Used to define the action component of the LauncherEvent. message Action { enum Type { TOUCH = 0; AUTOMATED = 1; COMMAND = 2; + TIP = 3; // SOFT_KEYBOARD, HARD_KEYBOARD, ASSIST } + enum Touch { TAP = 0; LONGPRESS = 1; @@ -125,7 +137,8 @@ message Action { FLING = 4; PINCH = 5; } - enum Direction { + + enum Direction { NONE = 0; UP = 1; DOWN = 2; diff --git a/quickstep/libs/sysui_shared.jar b/quickstep/libs/sysui_shared.jar index b343cc2058..95bb8bbed8 100644 Binary files a/quickstep/libs/sysui_shared.jar and b/quickstep/libs/sysui_shared.jar differ diff --git a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java index c1462460b2..81a73fc653 100644 --- a/quickstep/src/com/android/quickstep/OverviewCommandHelper.java +++ b/quickstep/src/com/android/quickstep/OverviewCommandHelper.java @@ -48,8 +48,10 @@ import android.view.ViewConfiguration; import com.android.launcher3.AbstractFloatingView; import com.android.launcher3.BaseDraggingActivity; +import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.MainThreadExecutor; import com.android.launcher3.anim.AnimationSuccessListener; +import com.android.launcher3.logging.UserEventDispatcher; import com.android.quickstep.ActivityControlHelper.ActivityInitListener; import com.android.quickstep.ActivityControlHelper.AnimationFactory; import com.android.quickstep.ActivityControlHelper.FallbackActivityControllerHelper; @@ -189,6 +191,17 @@ public class OverviewCommandHelper { mMainThreadExecutor.execute(new ShowRecentsCommand()); } + public void onTip(int actionType, int viewType) { + mMainThreadExecutor.execute(new Runnable() { + @Override + public void run() { + UserEventDispatcher.newInstance(mContext, + new InvariantDeviceProfile(mContext).getDeviceProfile(mContext)) + .logActionTip(actionType, viewType); + } + }); + } + public ActivityControlHelper getActivityControlHelper() { return mActivityControlHelper; } diff --git a/quickstep/src/com/android/quickstep/TouchInteractionService.java b/quickstep/src/com/android/quickstep/TouchInteractionService.java index 7496b47827..bd05b6d7bf 100644 --- a/quickstep/src/com/android/quickstep/TouchInteractionService.java +++ b/quickstep/src/com/android/quickstep/TouchInteractionService.java @@ -147,6 +147,11 @@ public class TouchInteractionService extends Service { TraceHelper.endSection("SysUiBinder", "onQuickStep"); } + + @Override + public void onTip(int actionType, int viewType) { + mOverviewCommandHelper.onTip(actionType, viewType); + } }; private final TouchConsumer mNoOpTouchConsumer = (ev) -> {}; diff --git a/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java b/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java index d4cdd3556b..04153cc99e 100644 --- a/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java +++ b/quickstep/src/com/android/quickstep/logging/UserEventDispatcherExtension.java @@ -15,15 +15,32 @@ */ package com.android.quickstep.logging; +import android.util.Log; + +import static com.android.launcher3.logging.LoggerUtils.newAction; +import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; +import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent; +import static com.android.launcher3.userevent.nano.LauncherLogProto.ControlType.CANCEL_TARGET; +import static com.android.systemui.shared.system.LauncherEventUtil.VISIBLE; +import static com.android.systemui.shared.system.LauncherEventUtil.DISMISS; +import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_QUICK_SCRUB_ONBOARDING_TIP; +import static com.android.systemui.shared.system.LauncherEventUtil.RECENTS_SWIPE_UP_ONBOARDING_TIP; + import com.android.launcher3.logging.UserEventDispatcher; +import com.android.launcher3.model.nano.LauncherDumpProto; +import com.android.launcher3.userevent.nano.LauncherLogExtensions; import com.android.launcher3.userevent.nano.LauncherLogProto; +import com.android.systemui.shared.system.LauncherEventUtil; import com.android.systemui.shared.system.MetricsLoggerCompat; /** - * This class handles AOSP MetricsLogger function calls. + * This class handles AOSP MetricsLogger function calls and logging around + * quickstep interactions. */ public class UserEventDispatcherExtension extends UserEventDispatcher { + private static final String TAG = "UserEventDispatcher"; + public void logStateChangeAction(int action, int dir, int srcChildTargetType, int srcParentContainerType, int dstContainerType, int pageIndex) { @@ -32,4 +49,37 @@ public class UserEventDispatcherExtension extends UserEventDispatcher { super.logStateChangeAction(action, dir, srcChildTargetType, srcParentContainerType, dstContainerType, pageIndex); } + + public void logActionTip(int actionType, int viewType) { + LauncherLogProto.Action action = new LauncherLogProto.Action(); + LauncherLogProto.Target target = new LauncherLogProto.Target(); + switch(actionType) { + case VISIBLE: + action.type = LauncherLogProto.Action.Type.TIP; + target.type = LauncherLogProto.Target.Type.CONTAINER; + target.containerType = LauncherLogProto.ContainerType.TIP; + break; + case DISMISS: + action.type = LauncherLogProto.Action.Type.TOUCH; + action.touch = LauncherLogProto.Action.Touch.TAP; + target.type = LauncherLogProto.Target.Type.CONTROL; + target.controlType = CANCEL_TARGET; + break; + default: + Log.e(TAG, "Unexpected action type = " + actionType); + } + + switch(viewType) { + case RECENTS_QUICK_SCRUB_ONBOARDING_TIP: + target.tipType = LauncherLogProto.TipType.QUICK_SCRUB_TEXT; + break; + case RECENTS_SWIPE_UP_ONBOARDING_TIP: + target.tipType = LauncherLogProto.TipType.SWIPE_UP_TEXT; + break; + default: + Log.e(TAG, "Unexpected viewType = " + viewType); + } + LauncherLogProto.LauncherEvent event = newLauncherEvent(action, target); + dispatchUserEvent(event, null); + } } diff --git a/src/com/android/launcher3/allapps/DiscoveryBounce.java b/src/com/android/launcher3/allapps/DiscoveryBounce.java index e8c5f15df9..deaf8d3c1d 100644 --- a/src/com/android/launcher3/allapps/DiscoveryBounce.java +++ b/src/com/android/launcher3/allapps/DiscoveryBounce.java @@ -18,6 +18,8 @@ package com.android.launcher3.allapps; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.LauncherState.OVERVIEW; +import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.HOTSEAT; +import static com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType.PREDICTION; import android.animation.Animator; import android.animation.AnimatorInflater; @@ -127,6 +129,7 @@ public class DiscoveryBounce extends AbstractFloatingView { AnimatorInflater.loadAnimator(launcher, R.animator.discovery_bounce)); view.mIsOpen = true; launcher.getDragLayer().addView(view); + launcher.getUserEventDispatcher().logActionBounceTip(HOTSEAT); } public static void showForOverviewIfNeeded(Launcher launcher) { @@ -173,5 +176,6 @@ public class DiscoveryBounce extends AbstractFloatingView { DiscoveryBounce view = new DiscoveryBounce(launcher, animator); view.mIsOpen = true; launcher.getDragLayer().addView(view); + launcher.getUserEventDispatcher().logActionBounceTip(PREDICTION); } } diff --git a/src/com/android/launcher3/logging/LoggerUtils.java b/src/com/android/launcher3/logging/LoggerUtils.java index 9d97cb9c0f..442691f0dd 100644 --- a/src/com/android/launcher3/logging/LoggerUtils.java +++ b/src/com/android/launcher3/logging/LoggerUtils.java @@ -31,6 +31,7 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; import com.android.launcher3.userevent.nano.LauncherLogProto.ItemType; import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; +import com.android.launcher3.userevent.nano.LauncherLogProto.TipType; import com.android.launcher3.util.InstantAppResolver; import java.lang.reflect.Field; @@ -76,7 +77,7 @@ public class LoggerUtils { } return str; case Action.Type.COMMAND: return getFieldName(action.command, Action.Command.class); - default: return UNKNOWN; + default: return getFieldName(action.type, Action.Type.class); } } @@ -84,23 +85,32 @@ public class LoggerUtils { if (t == null){ return ""; } + String str = ""; switch (t.type) { case Target.Type.ITEM: - return getItemStr(t); + str = getItemStr(t); + break; case Target.Type.CONTROL: - return getFieldName(t.controlType, ControlType.class); + str = getFieldName(t.controlType, ControlType.class); + break; case Target.Type.CONTAINER: - String str = getFieldName(t.containerType, ContainerType.class); + str = getFieldName(t.containerType, ContainerType.class); if (t.containerType == ContainerType.WORKSPACE || t.containerType == ContainerType.HOTSEAT) { str += " id=" + t.pageIndex; } else if (t.containerType == ContainerType.FOLDER) { str += " grid(" + t.gridX + "," + t.gridY+ ")"; } - return str; + break; default: - return "UNKNOWN TARGET TYPE"; + str += "UNKNOWN TARGET TYPE"; } + + if (t.tipType != TipType.DEFAULT_NONE) { + str += " " + getFieldName(t.tipType, TipType.class); + } + + return str; } private static String getItemStr(Target t) { @@ -186,6 +196,12 @@ public class LoggerUtils { return t; } + public static Target newControlTarget(int controlType) { + Target t = newTarget(Target.Type.CONTROL); + t.controlType = controlType; + return t; + } + public static Target newContainerTarget(int containerType) { Target t = newTarget(Target.Type.CONTAINER); t.containerType = containerType; diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index 2c1eb32872..07e1315aa4 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -16,8 +16,10 @@ package com.android.launcher3.logging; +import static com.android.launcher3.logging.LoggerUtils.newAction; import static com.android.launcher3.logging.LoggerUtils.newCommandAction; import static com.android.launcher3.logging.LoggerUtils.newContainerTarget; +import static com.android.launcher3.logging.LoggerUtils.newControlTarget; import static com.android.launcher3.logging.LoggerUtils.newDropTarget; import static com.android.launcher3.logging.LoggerUtils.newItemTarget; import static com.android.launcher3.logging.LoggerUtils.newLauncherEvent; @@ -163,6 +165,8 @@ public class UserEventDispatcher { dispatchUserEvent(event, intent); } + public void logActionTip(int actionType, int viewType) { } + public void logTaskLaunchOrDismiss(int action, int direction, ComponentKey componentKey) { LauncherEvent event = newLauncherEvent(newTouchAction(action), // TAP or SWIPE or FLING newTarget(Target.Type.ITEM)); @@ -243,6 +247,15 @@ public class UserEventDispatcher { logActionOnControl(action, controlType, controlInContainer, -1); } + public void logActionOnControl(int action, int controlType, int parentContainer, + int grandParentContainer){ + LauncherEvent event = newLauncherEvent(newTouchAction(action), + newControlTarget(controlType), + newContainerTarget(parentContainer), + newContainerTarget(grandParentContainer)); + dispatchUserEvent(event, null); + } + public void logActionOnControl(int action, int controlType, @Nullable View controlInContainer, int parentContainerType) { final LauncherEvent event = (controlInContainer == null && parentContainerType < 0) @@ -269,6 +282,13 @@ public class UserEventDispatcher { dispatchUserEvent(event, null); } + public void logActionBounceTip(int containerType) { + LauncherEvent event = newLauncherEvent(newAction(Action.Type.TIP), + newContainerTarget(containerType)); + event.srcTarget[0].tipType = LauncherLogProto.TipType.BOUNCE; + dispatchUserEvent(event, null); + } + public void logActionOnContainer(int action, int dir, int containerType) { logActionOnContainer(action, dir, containerType, 0); } @@ -393,7 +413,7 @@ public class UserEventDispatcher { if (!IS_VERBOSE) { return; } - String log = "action:" + LoggerUtils.getActionStr(ev.action); + String log = "\n\naction:" + LoggerUtils.getActionStr(ev.action); if (ev.srcTarget != null && ev.srcTarget.length > 0) { log += "\n Source " + getTargetsStr(ev.srcTarget); }