From c6cf493b07fc7234c2a0a164318fd9aeb02e48f3 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Tue, 7 Feb 2017 17:12:36 -0800 Subject: [PATCH] Add basic logs for tap outside action. Change-Id: I6288610b9870c3abe88794c53309b1d76dd2780f --- src/com/android/launcher3/AbstractFloatingView.java | 2 ++ src/com/android/launcher3/Launcher.java | 7 ++++++- src/com/android/launcher3/dragndrop/DragLayer.java | 4 ++++ src/com/android/launcher3/folder/Folder.java | 6 ++++++ .../android/launcher3/logging/UserEventDispatcher.java | 8 ++++++++ .../android/launcher3/popup/PopupContainerWithArrow.java | 5 +++++ 6 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/AbstractFloatingView.java b/src/com/android/launcher3/AbstractFloatingView.java index c834c6bdbf..52a83dcdf2 100644 --- a/src/com/android/launcher3/AbstractFloatingView.java +++ b/src/com/android/launcher3/AbstractFloatingView.java @@ -121,4 +121,6 @@ public abstract class AbstractFloatingView extends LinearLayout { public static AbstractFloatingView getTopOpenView(Launcher launcher) { return getOpenView(launcher, TYPE_FOLDER | TYPE_POPUP_CONTAINER_WITH_ARROW); } + + public abstract int getLogContainerType(); } diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index d963f4379e..826f686d40 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -111,6 +111,7 @@ import com.android.launcher3.pageindicators.PageIndicator; import com.android.launcher3.popup.PopupContainerWithArrow; import com.android.launcher3.shortcuts.DeepShortcutManager; import com.android.launcher3.shortcuts.ShortcutKey; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.ControlType; @@ -2272,7 +2273,11 @@ public class Launcher extends BaseActivity if (v instanceof CellLayout) { if (mWorkspace.isInOverviewMode()) { - mWorkspace.snapToPageFromOverView(mWorkspace.indexOfChild(v)); + int page = mWorkspace.indexOfChild(v); + getUserEventDispatcher().logActionOnContainer(LauncherLogProto.Action.Type.TOUCH, + LauncherLogProto.Action.Direction.NONE, + LauncherLogProto.ContainerType.OVERVIEW, page); + mWorkspace.snapToPageFromOverView(page); showWorkspace(true); } return; diff --git a/src/com/android/launcher3/dragndrop/DragLayer.java b/src/com/android/launcher3/dragndrop/DragLayer.java index 1be40f7e2c..23a2577679 100644 --- a/src/com/android/launcher3/dragndrop/DragLayer.java +++ b/src/com/android/launcher3/dragndrop/DragLayer.java @@ -57,6 +57,8 @@ import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.folder.Folder; import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.keyboard.ViewGroupFocusHelper; +import com.android.launcher3.logging.LoggerUtils; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.util.Thunk; import com.android.launcher3.util.TouchController; @@ -192,6 +194,8 @@ public class DragLayer extends InsettableFrameLayout { return true; } } else { + mLauncher.getUserEventDispatcher().logActionTapOutside( + LoggerUtils.newContainerTarget(topView.getLogContainerType())); topView.close(true); // We let touches on the original icon go through so that users can launch diff --git a/src/com/android/launcher3/folder/Folder.java b/src/com/android/launcher3/folder/Folder.java index 876c3c4de3..eacea4add4 100644 --- a/src/com/android/launcher3/folder/Folder.java +++ b/src/com/android/launcher3/folder/Folder.java @@ -74,6 +74,7 @@ import com.android.launcher3.dragndrop.DragController.DragListener; import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.dragndrop.DragOptions; import com.android.launcher3.pageindicators.PageIndicatorDots; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.Target; import com.android.launcher3.util.CircleRevealOutlineProvider; @@ -1532,4 +1533,9 @@ public class Folder extends AbstractFloatingView implements DragSource, View.OnC public static Folder getOpen(Launcher launcher) { return getOpenView(launcher, TYPE_FOLDER); } + + @Override + public int getLogContainerType() { + return ContainerType.FOLDER; + } } diff --git a/src/com/android/launcher3/logging/UserEventDispatcher.java b/src/com/android/launcher3/logging/UserEventDispatcher.java index b4b62a864e..5f45c6176d 100644 --- a/src/com/android/launcher3/logging/UserEventDispatcher.java +++ b/src/com/android/launcher3/logging/UserEventDispatcher.java @@ -28,6 +28,7 @@ import com.android.launcher3.DropTarget; import com.android.launcher3.ItemInfo; import com.android.launcher3.Utilities; import com.android.launcher3.config.ProviderConfig; +import com.android.launcher3.userevent.nano.LauncherLogProto; import com.android.launcher3.userevent.nano.LauncherLogProto.Action; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.launcher3.userevent.nano.LauncherLogProto.LauncherEvent; @@ -196,6 +197,13 @@ public class UserEventDispatcher { dispatchUserEvent(event, null); } + public void logActionTapOutside(Target target) { + LauncherEvent event = newLauncherEvent(newTouchAction(Action.Type.TOUCH), + target); + event.action.isOutside = true; + dispatchUserEvent(event, null); + } + public void logActionOnContainer(int action, int dir, int containerType) { logActionOnContainer(action, dir, containerType, 0); } diff --git a/src/com/android/launcher3/popup/PopupContainerWithArrow.java b/src/com/android/launcher3/popup/PopupContainerWithArrow.java index b8e2dc8a8c..7fda8b5317 100644 --- a/src/com/android/launcher3/popup/PopupContainerWithArrow.java +++ b/src/com/android/launcher3/popup/PopupContainerWithArrow.java @@ -825,4 +825,9 @@ public class PopupContainerWithArrow extends AbstractFloatingView public static PopupContainerWithArrow getOpen(Launcher launcher) { return getOpenView(launcher, TYPE_POPUP_CONTAINER_WITH_ARROW); } + + @Override + public int getLogContainerType() { + return ContainerType.DEEPSHORTCUTS; + } }