From f8f2a6ed0a96fbbdb6667d6694ca843aa4afce06 Mon Sep 17 00:00:00 2001 From: thiruram Date: Fri, 19 Feb 2021 10:09:56 -0800 Subject: [PATCH] [AA+] Log tap on SearchActionItem. Bug: 178562918 Test: Presubmit Change-Id: I42a44de4f3cc02ca331c4f99c107891c4658995d --- protos/launcher_atom.proto | 7 +++++++ .../quickstep/logging/StatsLogCompatManager.java | 4 ++++ .../launcher3/model/data/SearchActionItemInfo.java | 14 ++++++++++++++ .../android/launcher3/touch/ItemClickHandler.java | 2 ++ 4 files changed, 27 insertions(+) diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto index b4c6138671..dc9f8dd3fa 100644 --- a/protos/launcher_atom.proto +++ b/protos/launcher_atom.proto @@ -29,6 +29,7 @@ message ItemInfo { Shortcut shortcut = 3; Widget widget = 4; FolderIcon folder_icon = 9; + SearchActionItem search_action_item = 11; } // When used for launch event, stores the global predictive rank optional int32 rank = 5; @@ -169,6 +170,12 @@ message FolderIcon { optional string label_info = 4; } +// Represents SearchAction with in launcher +message SearchActionItem{ + optional string package_name = 1; + optional string title = 2; +} + ////////////////////////////////////////////// // Containers diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index f9283a4ece..4f211d7f2f 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -327,6 +327,8 @@ public class StatsLogCompatManager extends StatsLogManager { return info.getWidget().getPackageName(); case TASK: return info.getTask().getPackageName(); + case SEARCH_ACTION_ITEM: + return info.getSearchActionItem().getPackageName(); default: return null; } @@ -342,6 +344,8 @@ public class StatsLogCompatManager extends StatsLogManager { return info.getWidget().getComponentName(); case TASK: return info.getTask().getComponentName(); + case SEARCH_ACTION_ITEM: + return info.getSearchActionItem().getTitle(); default: return null; } diff --git a/src/com/android/launcher3/model/data/SearchActionItemInfo.java b/src/com/android/launcher3/model/data/SearchActionItemInfo.java index 25355c9579..6a8ec84c63 100644 --- a/src/com/android/launcher3/model/data/SearchActionItemInfo.java +++ b/src/com/android/launcher3/model/data/SearchActionItemInfo.java @@ -25,6 +25,9 @@ import android.os.UserHandle; import androidx.annotation.Nullable; +import com.android.launcher3.logger.LauncherAtom.ItemInfo; +import com.android.launcher3.logger.LauncherAtom.SearchActionItem; + /** * Represents a SearchAction with in launcher */ @@ -112,4 +115,15 @@ public class SearchActionItemInfo extends ItemInfoWithIcon { public ItemInfoWithIcon clone() { return new SearchActionItemInfo(this); } + + @Override + public ItemInfo buildProto(FolderInfo fInfo) { + return getDefaultItemInfoBuilder() + .setSearchActionItem( + SearchActionItem.newBuilder() + .setTitle(title.toString()) + .setPackageName(mFallbackPackageName)) + .setContainerInfo(getContainerInfo()) + .build(); + } } diff --git a/src/com/android/launcher3/touch/ItemClickHandler.java b/src/com/android/launcher3/touch/ItemClickHandler.java index 2647d6fec4..098d90d8db 100644 --- a/src/com/android/launcher3/touch/ItemClickHandler.java +++ b/src/com/android/launcher3/touch/ItemClickHandler.java @@ -17,6 +17,7 @@ package com.android.launcher3.touch; import static com.android.launcher3.Launcher.REQUEST_BIND_PENDING_APPWIDGET; import static com.android.launcher3.Launcher.REQUEST_RECONFIGURE_APPWIDGET; +import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_APP_LAUNCH_TAP; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_BY_PUBLISHER; import static com.android.launcher3.model.data.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER; @@ -272,6 +273,7 @@ public class ItemClickHandler { Toast.LENGTH_SHORT).show(); } } + launcher.getStatsLogManager().logger().withItemInfo(itemInfo).log(LAUNCHER_APP_LAUNCH_TAP); } private static void startAppShortcutOrInfoActivity(View v, ItemInfo item, Launcher launcher) {