Add logging for Onboarding

Bug: 73784423

* Discovery bounce, homescreen, hotseat
UserEvent: action:TIP
UserEvent:  Source child:HOTSEAT id=0 BOUNCE

* Discovery bounce, overview, prediction
UserEvent: action:TIP
UserEvent:  Source child:PREDICTION BOUNCE

* Swipe up from navbar text (visibility, cancel target)
UserEvent: action:TIP
UserEvent:  Source child:TIP SWIPE_UP_TEXT

UserEvent: action:TAP
UserEvent:  Source child:CANCEL_TARGET SWIPE_UP_TEXT

* Quickscrub text (visibility, cancel target)
UserEvent: action:TIP
UserEvent:  Source child:TIP QUICK_SCRUB_TEXT

UserEvent: action:TAP
UserEvent:  Source child:CANCEL_TARGET QUICK_SCRUB_TEXT

* Prediction apps text (visibility, cancel target)
UserEvent: action:TAP
UserEvent:  Source child:TIP PREDICTION_TEXT

UserEvent: action:TAP
UserEvent:  Source child:CANCEL_TARGET PREDICTION_TEXT

Change-Id: I94710b5ed3d00e3599985b154eb660af4a958288
This commit is contained in:
Hyunyoung Song 2018-05-09 16:18:58 -07:00
parent c14adabe99
commit 018eec6899
8 changed files with 130 additions and 9 deletions

View File

@ -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;

Binary file not shown.

View File

@ -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;
}

View File

@ -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) -> {};

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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);
}