From b812b3ff608a95a57cc6c122b822e0b8c2adfbb7 Mon Sep 17 00:00:00 2001 From: thiruram Date: Tue, 2 Jun 2020 15:40:25 -0700 Subject: [PATCH] Log tapping on split screen & free form icons within task menu. Bug: 157770913 Sample Log: https://docs.google.com/document/d/1FXi_jY1B63aMSjNyomAmoN1nSTtVbvculNGX7TKdRRw/edit#bookmark=id.4hmzxwn1efy Change-Id: Id98dccb9452af7be20f636410d886dc8aeaa6bd1 --- .../quickstep/TaskShortcutFactory.java | 26 ++++++++++++------- .../com/android/quickstep/views/TaskView.java | 4 +-- .../launcher3/logging/StatsLogManager.java | 12 ++++++--- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java index 021d39dd6e..cdaa6555a0 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/TaskShortcutFactory.java @@ -18,6 +18,8 @@ package com.android.quickstep; import static android.view.Display.DEFAULT_DISPLAY; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP; import static com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch.TAP; import android.app.Activity; @@ -35,6 +37,7 @@ import android.view.View; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.DeviceProfile; import com.android.launcher3.R; +import com.android.launcher3.logging.StatsLogManager.LauncherEvent; import com.android.launcher3.model.WellbeingModel; import com.android.launcher3.model.data.WorkspaceItemInfo; import com.android.launcher3.popup.SystemShortcut; @@ -83,10 +86,12 @@ public interface TaskShortcutFactory { private final int mIconRes; private final int mTextRes; + private final LauncherEvent mLauncherEvent; - MultiWindowFactory(int iconRes, int textRes) { + MultiWindowFactory(int iconRes, int textRes, LauncherEvent launcherEvent) { mIconRes = iconRes; mTextRes = textRes; + mLauncherEvent = launcherEvent; } protected abstract boolean isAvailable(BaseDraggingActivity activity, int displayId); @@ -102,7 +107,8 @@ public interface TaskShortcutFactory { if (!isAvailable(activity, task.key.displayId)) { return null; } - return new MultiWindowSystemShortcut(mIconRes, mTextRes, activity, taskView, this); + return new MultiWindowSystemShortcut(mIconRes, mTextRes, activity, taskView, this, + mLauncherEvent); } } @@ -114,11 +120,12 @@ public interface TaskShortcutFactory { private final TaskThumbnailView mThumbnailView; private final TaskView mTaskView; private final MultiWindowFactory mFactory; + private final LauncherEvent mLauncherEvent; - public MultiWindowSystemShortcut(int iconRes, int textRes, - BaseDraggingActivity activity, TaskView taskView, MultiWindowFactory factory) { + public MultiWindowSystemShortcut(int iconRes, int textRes, BaseDraggingActivity activity, + TaskView taskView, MultiWindowFactory factory, LauncherEvent launcherEvent) { super(iconRes, textRes, activity, dummyInfo(taskView)); - + mLauncherEvent = launcherEvent; mHandler = new Handler(Looper.getMainLooper()); mTaskView = taskView; mRecentsView = activity.getOverviewPanel(); @@ -203,12 +210,13 @@ public interface TaskShortcutFactory { WindowManagerWrapper.getInstance().overridePendingAppTransitionMultiThumbFuture( future, animStartedListener, mHandler, true /* scaleUp */, taskKey.displayId); + mTarget.getStatsLogManager().log(mLauncherEvent, mTaskView.buildProto()); } } } - TaskShortcutFactory SPLIT_SCREEN = new MultiWindowFactory( - R.drawable.ic_split_screen, R.string.recent_task_option_split_screen) { + TaskShortcutFactory SPLIT_SCREEN = new MultiWindowFactory(R.drawable.ic_split_screen, + R.string.recent_task_option_split_screen, LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP) { @Override protected boolean isAvailable(BaseDraggingActivity activity, int displayId) { @@ -241,8 +249,8 @@ public interface TaskShortcutFactory { } }; - TaskShortcutFactory FREE_FORM = new MultiWindowFactory( - R.drawable.ic_split_screen, R.string.recent_task_option_freeform) { + TaskShortcutFactory FREE_FORM = new MultiWindowFactory(R.drawable.ic_split_screen, + R.string.recent_task_option_freeform, LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP) { @Override protected boolean isAvailable(BaseDraggingActivity activity, int displayId) { diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java index 3a8fcf7664..af9d7f76bc 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/TaskView.java @@ -223,8 +223,8 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable { setOutlineProvider(mOutlineProvider); } - /* Builds proto for logging */ - protected LauncherAtom.ItemInfo buildProto() { + /** Builds proto for logging */ + public LauncherAtom.ItemInfo buildProto() { ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(getTask().key); LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder(); itemBuilder.setIsWork(componentKey.user != Process.myUserHandle()); diff --git a/src/com/android/launcher3/logging/StatsLogManager.java b/src/com/android/launcher3/logging/StatsLogManager.java index 9d94df4c22..85013d7216 100644 --- a/src/com/android/launcher3/logging/StatsLogManager.java +++ b/src/com/android/launcher3/logging/StatsLogManager.java @@ -96,6 +96,10 @@ public class StatsLogManager implements ResourceBasedOverride { + "the icon onto 'Uninstall' button in the target bar") LAUNCHER_ITEM_UNINSTALL_CANCELLED(470), + @UiEvent(doc = "User tapped or long pressed on the task icon(aka package icon) " + + "from overview to open task menu.") + LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(517), + @UiEvent(doc = "User opened package specific widgets list by tapping on widgets system " + "shortcut within longpress popup window.") LAUNCHER_SYSTEM_SHORTCUT_WIDGETS_TAP(514), @@ -104,9 +108,11 @@ public class StatsLogManager implements ResourceBasedOverride { + "within longpress popup window.") LAUNCHER_SYSTEM_SHORTCUT_APP_INFO_TAP(515), - @UiEvent(doc = "User tapped or long pressed on the task icon(aka package icon) " - + "from overview to open task menu.") - LAUNCHER_TASK_ICON_TAP_OR_LONGPRESS(517); + @UiEvent(doc = "User tapped on split screen icon on a task menu.") + LAUNCHER_SYSTEM_SHORTCUT_SPLIT_SCREEN_TAP(518), + + @UiEvent(doc = "User tapped on free form icon on a task menu.") + LAUNCHER_SYSTEM_SHORTCUT_FREE_FORM_TAP(519); // ADD MORE private final int mId;