Add logging for shortcuts opening.

- Log as long press with child type DEEPSHORTCUTS container
- Parent type can be one of WORKSPACE, HOTSEAT, FOLDER,
  ALLAPPS, PREDICTION, or SEARCHRESULT.

Bug: 30537079
Change-Id: Ie62e4889ee06c845f959ca998781787a7fdaf00e
This commit is contained in:
Tony Wickham 2016-08-01 16:42:19 -07:00
parent 0843675e93
commit 55c6691e3a
5 changed files with 52 additions and 8 deletions

View File

@ -29,10 +29,10 @@ import com.android.launcher3.BubbleTextView;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.logging.UserEventDispatcher.LaunchSourceProvider;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
import java.util.List;
/**
@ -208,8 +208,12 @@ public class AllAppsRecyclerView extends BaseRecyclerView
@Override
public void fillInLaunchSourceData(View v, ItemInfo info, Target target, Target targetParent) {
targetParent.containerType = getContainerType(v);
}
public int getContainerType(View v) {
if (mApps.hasFilter()) {
targetParent.containerType = LauncherLogProto.SEARCHRESULT;
return LauncherLogProto.SEARCHRESULT;
} else {
if (v instanceof BubbleTextView) {
BubbleTextView icon = (BubbleTextView) v;
@ -218,13 +222,11 @@ public class AllAppsRecyclerView extends BaseRecyclerView
List<AlphabeticalAppsList.AdapterItem> items = mApps.getAdapterItems();
AlphabeticalAppsList.AdapterItem item = items.get(position);
if (item.viewType == AllAppsGridAdapter.VIEW_TYPE_PREDICTION_ICON) {
targetParent.containerType = LauncherLogProto.PREDICTION;
return;
return LauncherLogProto.PREDICTION;
}
}
}
targetParent.containerType = LauncherLogProto.ALLAPPS;
return LauncherLogProto.ALLAPPS;
}
}

View File

@ -585,6 +585,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void run() {
mContent.setLayerType(LAYER_TYPE_NONE, null);
mFooter.setLayerType(LAYER_TYPE_NONE, null);
mLauncher.getUserEventDispatcher().resetElapsedContainerMillis();
}
};
}

View File

@ -50,6 +50,7 @@ public class LoggerUtils {
case LauncherLogProto.APP_ICON: typeStr = "ICON"; break;
case LauncherLogProto.SHORTCUT: typeStr = "SHORTCUT"; break;
case LauncherLogProto.WIDGET: typeStr = "WIDGET"; break;
case LauncherLogProto.DEEPSHORTCUT: typeStr = "DEEPSHORTCUT"; break;
default: typeStr = "UNKNOWN";
}
@ -106,6 +107,9 @@ public class LoggerUtils {
case LauncherLogProto.SEARCHRESULT:
str = "SEARCHRESULT";
break;
case LauncherLogProto.DEEPSHORTCUTS:
str = "DEEPSHORTCUTS";
break;
default:
str = "UNKNOWN";
}

View File

@ -23,6 +23,7 @@ import android.view.View;
import android.view.ViewParent;
import com.android.launcher3.ItemInfo;
import com.android.launcher3.userevent.nano.LauncherLogProto;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent;
import com.android.launcher3.userevent.nano.LauncherLogProto.Target;
@ -146,6 +147,17 @@ public class UserEventDispatcher {
dispatchUserEvent(event, null);
}
public void logDeepShortcutsOpen(int containerType) {
LauncherEvent event = LoggerUtils.initLauncherEvent(
Action.TOUCH, Target.ITEM, Target.CONTAINER);
event.action.touch = Action.LONGPRESS;
event.srcTarget[0].itemType = LauncherLogProto.DEEPSHORTCUT;
event.srcTarget[1].containerType = containerType;
event.elapsedContainerMillis = System.currentTimeMillis() - mElapsedContainerMillis;
event.elapsedSessionMillis = System.currentTimeMillis() - mElapsedSessionMillis;
dispatchUserEvent(event, null);
}
public void logDragNDrop() {
// TODO
}
@ -172,7 +184,7 @@ public class UserEventDispatcher {
public void dispatchUserEvent(LauncherEvent ev, Intent intent) {
if (DEBUG_LOGGING) {
Log.d("UserEvent", String.format(Locale.US,
Log.d(TAG, String.format(Locale.US,
"action:%s\nchild:%s\nparent:%s\nelapsed container %d ms session %d ms",
LoggerUtils.getActionStr(ev.action),
LoggerUtils.getTargetStr(ev.srcTarget != null ? ev.srcTarget[0] : null),

View File

@ -27,13 +27,13 @@ import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.ShapeDrawable;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.Gravity;
import android.view.HapticFeedbackConstants;
import android.view.LayoutInflater;
@ -53,6 +53,7 @@ import com.android.launcher3.Launcher;
import com.android.launcher3.LauncherAnimUtils;
import com.android.launcher3.LauncherAppState;
import com.android.launcher3.LauncherModel;
import com.android.launcher3.LauncherSettings;
import com.android.launcher3.LauncherViewPropertyAnimator;
import com.android.launcher3.LogAccelerateInterpolator;
import com.android.launcher3.R;
@ -60,10 +61,12 @@ import com.android.launcher3.ShortcutInfo;
import com.android.launcher3.Utilities;
import com.android.launcher3.Workspace;
import com.android.launcher3.accessibility.ShortcutMenuAccessibilityDelegate;
import com.android.launcher3.allapps.AllAppsRecyclerView;
import com.android.launcher3.compat.UserHandleCompat;
import com.android.launcher3.dragndrop.DragController;
import com.android.launcher3.dragndrop.DragLayer;
import com.android.launcher3.dragndrop.DragView;
import com.android.launcher3.folder.Folder;
import com.android.launcher3.graphics.TriangleShape;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@ -734,11 +737,33 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
container.populateAndShow(icon, ids);
icon.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS,
HapticFeedbackConstants.FLAG_IGNORE_VIEW_SETTING);
logOpen(launcher, icon);
return container;
}
return null;
}
private static void logOpen(Launcher launcher, View icon) {
ItemInfo info = (ItemInfo) icon.getTag();
long iconContainer = info.container;
Folder openFolder = launcher.getWorkspace().getOpenFolder();
int containerType;
if (iconContainer == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
containerType = LauncherLogProto.WORKSPACE;
} else if (iconContainer == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
containerType = LauncherLogProto.HOTSEAT;
} else if (openFolder != null && iconContainer == openFolder.getInfo().id) {
containerType = LauncherLogProto.FOLDER;
} else if (icon.getParent() instanceof AllAppsRecyclerView) {
containerType = ((AllAppsRecyclerView) icon.getParent()).getContainerType(icon);
} else {
// This should not happen.
Log.w(TAG, "Couldn't determine parent of shortcut container");
containerType = LauncherLogProto.DEFAULT_CONTAINERTYPE;
}
launcher.getUserEventDispatcher().logDeepShortcutsOpen(containerType);
}
/**
* Extension of {@link ShortcutInfo} which does not badge the icons.
*/