Loading protos/launcher_log.proto +11 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ enum ItemType { SHORTCUT = 2; WIDGET = 3; FOLDER_ICON = 4; DEEPSHORTCUT = 5; } // Used to define what type of container a Target would represent. Loading @@ -74,6 +75,7 @@ enum ContainerType { OVERVIEW = 6; PREDICTION = 7; SEARCHRESULT = 8; DEEPSHORTCUTS = 9; } // Used to define what type of control a Target would represent. Loading Loading @@ -106,8 +108,16 @@ message Action { FLING = 4; PINCH = 5; } enum Direction { NONE = 0; UP = 1; DOWN = 2; LEFT = 3; RIGHT = 4; } optional Type type = 1; optional Touch touch = 2; optional Direction dir = 3; } // Loading src/com/android/launcher3/Launcher.java +5 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,7 @@ import com.android.launcher3.model.WidgetsModel; import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.shortcuts.DeepShortcutsContainer; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.MultiHashMap; import com.android.launcher3.util.PackageManagerHelper; Loading Loading @@ -2590,6 +2591,8 @@ public class Launcher extends Activity protected void onClickAllAppsButton(View v) { if (LOGD) Log.d(TAG, "onClickAllAppsButton"); if (!isAppsViewVisible()) { mUserEventDispatcher.logActionOnControl(LauncherLogProto.Action.TAP, LauncherLogProto.ALL_APPS_BUTTON); showAppsView(true /* animated */, false /* resetListToTop */, true /* updatePredictedApps */, false /* focusSearchBar */); } Loading @@ -2598,6 +2601,8 @@ public class Launcher extends Activity protected void onLongClickAllAppsButton(View v) { if (LOGD) Log.d(TAG, "onLongClickAllAppsButton"); if (!isAppsViewVisible()) { mUserEventDispatcher.logActionOnControl(LauncherLogProto.Action.LONGPRESS, LauncherLogProto.ALL_APPS_BUTTON); showAppsView(true /* animated */, false /* resetListToTop */, true /* updatePredictedApps */, true /* focusSearchBar */); } Loading src/com/android/launcher3/allapps/AllAppsTransitionController.java +9 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.launcher3.PagedView; import com.android.launcher3.R; import com.android.launcher3.Workspace; import com.android.launcher3.Workspace.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.TouchController; /** Loading Loading @@ -210,6 +211,10 @@ public class AllAppsTransitionController implements TouchController, VerticalPul calculateDuration(velocity, mAppsView.getTranslationY()); if (!mLauncher.isAllAppsVisible()) { mLauncher.getUserEventDispatcher().logActionOnContainer( LauncherLogProto.Action.FLING, LauncherLogProto.Action.UP, LauncherLogProto.HOTSEAT); mLauncher.showAppsView(true, true, false, false); } else { animateToAllApps(mCurrentAnimation, mAnimationDuration, true); Loading @@ -234,6 +239,10 @@ public class AllAppsTransitionController implements TouchController, VerticalPul } else { calculateDuration(velocity, Math.abs(mAppsView.getTranslationY())); if (!mLauncher.isAllAppsVisible()) { mLauncher.getUserEventDispatcher().logActionOnContainer( LauncherLogProto.Action.SWIPE, LauncherLogProto.Action.UP, LauncherLogProto.HOTSEAT); mLauncher.showAppsView(true, true, false, false); } else { animateToAllApps(mCurrentAnimation, mAnimationDuration, true); Loading src/com/android/launcher3/logging/LoggerUtils.java +30 −9 Original line number Diff line number Diff line package com.android.launcher3.logging; import android.os.Bundle; import android.util.Log; import com.android.launcher3.LauncherSettings; import com.android.launcher3.ShortcutInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; /** * Debugging helper methods. * toString() cannot be overriden inside auto generated {@link LauncherLogProto}. Loading @@ -24,12 +18,17 @@ public class LoggerUtils { case Action.LONGPRESS: return "LONGPRESS"; case Action.DRAGDROP: return "DRAGDROP"; case Action.PINCH: return "PINCH"; case Action.SWIPE: return "SWIPE"; case Action.FLING: return "FLING"; default: return "UNKNOWN"; } } public static String getTargetStr(Target t) { String typeStr; String typeStr = ""; if (t == null){ return typeStr; } switch (t.type) { case Target.ITEM: return getItemStr(t); Loading @@ -44,6 +43,9 @@ public class LoggerUtils { private static String getItemStr(Target t) { String typeStr = ""; if (t == null){ return typeStr; } switch(t.itemType){ case LauncherLogProto.APP_ICON: typeStr = "ICON"; break; case LauncherLogProto.SHORTCUT: typeStr = "SHORTCUT"; break; Loading @@ -58,6 +60,9 @@ public class LoggerUtils { } private static String getControlStr(Target t) { if (t == null){ return ""; } switch(t.controlType) { case LauncherLogProto.ALL_APPS_BUTTON: return "ALL_APPS_BUTTON"; case LauncherLogProto.WIDGETS_BUTTON: return "WIDGETS_BUTTON"; Loading @@ -72,8 +77,10 @@ public class LoggerUtils { } private static String getContainerStr(LauncherLogProto.Target t) { String str; Log.d(TAG, "t.containerType" + t.containerType); String str = ""; if (t == null) { return str; } switch (t.containerType) { case LauncherLogProto.WORKSPACE: str = "WORKSPACE"; Loading Loading @@ -122,4 +129,18 @@ public class LoggerUtils { event.action.type = actionType; return event; } public static LauncherLogProto.LauncherEvent initLauncherEvent( int actionType, int childTargetType){ LauncherLogProto.LauncherEvent event = new LauncherLogProto.LauncherEvent(); event.srcTarget = new LauncherLogProto.Target[1]; event.srcTarget[0] = new LauncherLogProto.Target(); event.srcTarget[0].type = childTargetType; event.action = new LauncherLogProto.Action(); event.action.type = actionType; return event; } } src/com/android/launcher3/logging/UserEventDispatcher.java +23 −12 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ import java.util.Locale; public class UserEventDispatcher { private static final boolean DEBUG_LOGGING = false; private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5; /** * Implemented by containers to provide a launch source for a given child. */ Loading @@ -46,6 +46,7 @@ public class UserEventDispatcher { /** * Copies data from the source to the destination proto. * * @param v source of the data * @param info source of the data * @param target dest of the data Loading Loading @@ -126,12 +127,23 @@ public class UserEventDispatcher { dispatchUserEvent(createLauncherEvent(v, intent), intent); } public void logTap(View v) { // TODO public void logActionOnControl(int action, int controlType) { LauncherEvent event = LoggerUtils.initLauncherEvent(Action.TOUCH, Target.CONTROL); event.action.touch = action; event.srcTarget[0].controlType = controlType; event.elapsedContainerMillis = System.currentTimeMillis() - mElapsedContainerMillis; event.elapsedSessionMillis = System.currentTimeMillis() - mElapsedSessionMillis; dispatchUserEvent(event, null); } public void logLongPress() { // TODO public void logActionOnContainer(int action, int dir, int containerType) { LauncherEvent event = LoggerUtils.initLauncherEvent(Action.TOUCH, Target.CONTAINER); event.action.touch = action; event.action.dir = dir; event.srcTarget[0].containerType = containerType; event.elapsedContainerMillis = System.currentTimeMillis() - mElapsedContainerMillis; event.elapsedSessionMillis = System.currentTimeMillis() - mElapsedSessionMillis; dispatchUserEvent(event, null); } public void logDragNDrop() { Loading @@ -152,7 +164,6 @@ public class UserEventDispatcher { public final void resetElapsedSessionMillis() { mElapsedSessionMillis = System.currentTimeMillis(); mElapsedContainerMillis = System.currentTimeMillis(); } public final void resetActionDurationMillis() { Loading @@ -164,8 +175,8 @@ public class UserEventDispatcher { Log.d("UserEvent", 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[0]), LoggerUtils.getTargetStr(ev.srcTarget[1]), LoggerUtils.getTargetStr(ev.srcTarget != null ? ev.srcTarget[0] : null), LoggerUtils.getTargetStr(ev.srcTarget.length > 1 ? ev.srcTarget[1] : null), ev.elapsedContainerMillis, ev.elapsedSessionMillis)); } Loading Loading
protos/launcher_log.proto +11 −1 Original line number Diff line number Diff line Loading @@ -61,6 +61,7 @@ enum ItemType { SHORTCUT = 2; WIDGET = 3; FOLDER_ICON = 4; DEEPSHORTCUT = 5; } // Used to define what type of container a Target would represent. Loading @@ -74,6 +75,7 @@ enum ContainerType { OVERVIEW = 6; PREDICTION = 7; SEARCHRESULT = 8; DEEPSHORTCUTS = 9; } // Used to define what type of control a Target would represent. Loading Loading @@ -106,8 +108,16 @@ message Action { FLING = 4; PINCH = 5; } enum Direction { NONE = 0; UP = 1; DOWN = 2; LEFT = 3; RIGHT = 4; } optional Type type = 1; optional Touch touch = 2; optional Direction dir = 3; } // Loading
src/com/android/launcher3/Launcher.java +5 −0 Original line number Diff line number Diff line Loading @@ -117,6 +117,7 @@ import com.android.launcher3.model.WidgetsModel; import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.shortcuts.DeepShortcutsContainer; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.ComponentKey; import com.android.launcher3.util.MultiHashMap; import com.android.launcher3.util.PackageManagerHelper; Loading Loading @@ -2590,6 +2591,8 @@ public class Launcher extends Activity protected void onClickAllAppsButton(View v) { if (LOGD) Log.d(TAG, "onClickAllAppsButton"); if (!isAppsViewVisible()) { mUserEventDispatcher.logActionOnControl(LauncherLogProto.Action.TAP, LauncherLogProto.ALL_APPS_BUTTON); showAppsView(true /* animated */, false /* resetListToTop */, true /* updatePredictedApps */, false /* focusSearchBar */); } Loading @@ -2598,6 +2601,8 @@ public class Launcher extends Activity protected void onLongClickAllAppsButton(View v) { if (LOGD) Log.d(TAG, "onLongClickAllAppsButton"); if (!isAppsViewVisible()) { mUserEventDispatcher.logActionOnControl(LauncherLogProto.Action.LONGPRESS, LauncherLogProto.ALL_APPS_BUTTON); showAppsView(true /* animated */, false /* resetListToTop */, true /* updatePredictedApps */, true /* focusSearchBar */); } Loading
src/com/android/launcher3/allapps/AllAppsTransitionController.java +9 −0 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import com.android.launcher3.PagedView; import com.android.launcher3.R; import com.android.launcher3.Workspace; import com.android.launcher3.Workspace.Direction; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.TouchController; /** Loading Loading @@ -210,6 +211,10 @@ public class AllAppsTransitionController implements TouchController, VerticalPul calculateDuration(velocity, mAppsView.getTranslationY()); if (!mLauncher.isAllAppsVisible()) { mLauncher.getUserEventDispatcher().logActionOnContainer( LauncherLogProto.Action.FLING, LauncherLogProto.Action.UP, LauncherLogProto.HOTSEAT); mLauncher.showAppsView(true, true, false, false); } else { animateToAllApps(mCurrentAnimation, mAnimationDuration, true); Loading @@ -234,6 +239,10 @@ public class AllAppsTransitionController implements TouchController, VerticalPul } else { calculateDuration(velocity, Math.abs(mAppsView.getTranslationY())); if (!mLauncher.isAllAppsVisible()) { mLauncher.getUserEventDispatcher().logActionOnContainer( LauncherLogProto.Action.SWIPE, LauncherLogProto.Action.UP, LauncherLogProto.HOTSEAT); mLauncher.showAppsView(true, true, false, false); } else { animateToAllApps(mCurrentAnimation, mAnimationDuration, true); Loading
src/com/android/launcher3/logging/LoggerUtils.java +30 −9 Original line number Diff line number Diff line package com.android.launcher3.logging; import android.os.Bundle; import android.util.Log; import com.android.launcher3.LauncherSettings; import com.android.launcher3.ShortcutInfo; import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; /** * Debugging helper methods. * toString() cannot be overriden inside auto generated {@link LauncherLogProto}. Loading @@ -24,12 +18,17 @@ public class LoggerUtils { case Action.LONGPRESS: return "LONGPRESS"; case Action.DRAGDROP: return "DRAGDROP"; case Action.PINCH: return "PINCH"; case Action.SWIPE: return "SWIPE"; case Action.FLING: return "FLING"; default: return "UNKNOWN"; } } public static String getTargetStr(Target t) { String typeStr; String typeStr = ""; if (t == null){ return typeStr; } switch (t.type) { case Target.ITEM: return getItemStr(t); Loading @@ -44,6 +43,9 @@ public class LoggerUtils { private static String getItemStr(Target t) { String typeStr = ""; if (t == null){ return typeStr; } switch(t.itemType){ case LauncherLogProto.APP_ICON: typeStr = "ICON"; break; case LauncherLogProto.SHORTCUT: typeStr = "SHORTCUT"; break; Loading @@ -58,6 +60,9 @@ public class LoggerUtils { } private static String getControlStr(Target t) { if (t == null){ return ""; } switch(t.controlType) { case LauncherLogProto.ALL_APPS_BUTTON: return "ALL_APPS_BUTTON"; case LauncherLogProto.WIDGETS_BUTTON: return "WIDGETS_BUTTON"; Loading @@ -72,8 +77,10 @@ public class LoggerUtils { } private static String getContainerStr(LauncherLogProto.Target t) { String str; Log.d(TAG, "t.containerType" + t.containerType); String str = ""; if (t == null) { return str; } switch (t.containerType) { case LauncherLogProto.WORKSPACE: str = "WORKSPACE"; Loading Loading @@ -122,4 +129,18 @@ public class LoggerUtils { event.action.type = actionType; return event; } public static LauncherLogProto.LauncherEvent initLauncherEvent( int actionType, int childTargetType){ LauncherLogProto.LauncherEvent event = new LauncherLogProto.LauncherEvent(); event.srcTarget = new LauncherLogProto.Target[1]; event.srcTarget[0] = new LauncherLogProto.Target(); event.srcTarget[0].type = childTargetType; event.action = new LauncherLogProto.Action(); event.action.type = actionType; return event; } }
src/com/android/launcher3/logging/UserEventDispatcher.java +23 −12 Original line number Diff line number Diff line Loading @@ -37,8 +37,8 @@ import java.util.Locale; public class UserEventDispatcher { private static final boolean DEBUG_LOGGING = false; private final static int MAXIMUM_VIEW_HIERARCHY_LEVEL = 5; /** * Implemented by containers to provide a launch source for a given child. */ Loading @@ -46,6 +46,7 @@ public class UserEventDispatcher { /** * Copies data from the source to the destination proto. * * @param v source of the data * @param info source of the data * @param target dest of the data Loading Loading @@ -126,12 +127,23 @@ public class UserEventDispatcher { dispatchUserEvent(createLauncherEvent(v, intent), intent); } public void logTap(View v) { // TODO public void logActionOnControl(int action, int controlType) { LauncherEvent event = LoggerUtils.initLauncherEvent(Action.TOUCH, Target.CONTROL); event.action.touch = action; event.srcTarget[0].controlType = controlType; event.elapsedContainerMillis = System.currentTimeMillis() - mElapsedContainerMillis; event.elapsedSessionMillis = System.currentTimeMillis() - mElapsedSessionMillis; dispatchUserEvent(event, null); } public void logLongPress() { // TODO public void logActionOnContainer(int action, int dir, int containerType) { LauncherEvent event = LoggerUtils.initLauncherEvent(Action.TOUCH, Target.CONTAINER); event.action.touch = action; event.action.dir = dir; event.srcTarget[0].containerType = containerType; event.elapsedContainerMillis = System.currentTimeMillis() - mElapsedContainerMillis; event.elapsedSessionMillis = System.currentTimeMillis() - mElapsedSessionMillis; dispatchUserEvent(event, null); } public void logDragNDrop() { Loading @@ -152,7 +164,6 @@ public class UserEventDispatcher { public final void resetElapsedSessionMillis() { mElapsedSessionMillis = System.currentTimeMillis(); mElapsedContainerMillis = System.currentTimeMillis(); } public final void resetActionDurationMillis() { Loading @@ -164,8 +175,8 @@ public class UserEventDispatcher { Log.d("UserEvent", 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[0]), LoggerUtils.getTargetStr(ev.srcTarget[1]), LoggerUtils.getTargetStr(ev.srcTarget != null ? ev.srcTarget[0] : null), LoggerUtils.getTargetStr(ev.srcTarget.length > 1 ? ev.srcTarget[1] : null), ev.elapsedContainerMillis, ev.elapsedSessionMillis)); } Loading