Adds WW logging for QSB search results & all-apps predicted row.

SearchResultContainer represents apps rows displayed within QSB search results for both default scenario(without search term) and actual search result(with search term).

SearchResultContainer is used for both homescreen QSB and all-apps QSB.

Follow up CLs will add searchOrigin and queryLength in SearchResultContainer

Bug: 152978018
Change-Id: Id5f96490686c4141e3e6b2516907ac0505a777e6
This commit is contained in:
thiruram 2020-05-19 09:31:38 -07:00
parent db8c1381d3
commit 62c7b5c8f7
4 changed files with 48 additions and 17 deletions

View File

@ -49,15 +49,26 @@ message ContainerInfo {
FolderContainer folder = 3; FolderContainer folder = 3;
AllAppsContainer all_apps_container = 4; AllAppsContainer all_apps_container = 4;
WidgetsContainer widgets_container = 5; WidgetsContainer widgets_container = 5;
PredictionContainer prediction_container = 6;
SearchResultContainer search_result_container = 7;
} }
} }
// Represents the apps list sorted alphabetically inside the all-apps view.
message AllAppsContainer { message AllAppsContainer {
} }
message WidgetsContainer { message WidgetsContainer {
} }
// Represents the predicted apps row(top row) in the all-apps view.
message PredictionContainer {
}
// Represents the apps container within search results.
message SearchResultContainer {
}
enum Origin { enum Origin {
UNKNOWN = 0; UNKNOWN = 0;
DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat DEFAULT_LAYOUT = 1; // icon automatically placed in workspace, folder, hotseat

View File

@ -155,6 +155,8 @@ public class LauncherSettings {
public static final int CONTAINER_ALL_APPS = -104; public static final int CONTAINER_ALL_APPS = -104;
public static final int CONTAINER_WIDGETS_TRAY = -105; public static final int CONTAINER_WIDGETS_TRAY = -105;
// Represents search results view.
public static final int CONTAINER_SEARCH_RESULTS = -106;
public static final String containerToString(int container) { public static final String containerToString(int container) {
switch (container) { switch (container) {
@ -163,6 +165,7 @@ public class LauncherSettings {
case CONTAINER_PREDICTION: return "prediction"; case CONTAINER_PREDICTION: return "prediction";
case CONTAINER_ALL_APPS: return "all_apps"; case CONTAINER_ALL_APPS: return "all_apps";
case CONTAINER_WIDGETS_TRAY: return "widgets_tray"; case CONTAINER_WIDGETS_TRAY: return "widgets_tray";
case CONTAINER_SEARCH_RESULTS: return "search_result";
default: return String.valueOf(container); default: return String.valueOf(container);
} }
} }

View File

@ -418,10 +418,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
mStatsLogManager.log( mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED, LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED,
dragObject.logInstanceId, dragObject.logInstanceId,
dragObject.originalDragInfo.buildProto( dragObject.dragSource instanceof Folder
dragObject.dragSource instanceof Folder ? dragObject.originalDragInfo
? ((Folder) dragObject.dragSource).mInfo .buildProto(((Folder) dragObject.dragSource).mInfo)
: null) : dragObject.originalDragInfo.buildProto()
); );
} }

View File

@ -20,11 +20,14 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_ALL_APP
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_DESKTOP;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_PREDICTION;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SEARCH_RESULTS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY; import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPLICATION;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT;
import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT; import static com.android.launcher3.LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT;
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.CONTAINER_NOT_SET;
import android.content.ComponentName; import android.content.ComponentName;
import android.content.ContentValues; import android.content.ContentValues;
@ -40,6 +43,8 @@ import com.android.launcher3.Workspace;
import com.android.launcher3.logger.LauncherAtom; import com.android.launcher3.logger.LauncherAtom;
import com.android.launcher3.logger.LauncherAtom.AllAppsContainer; import com.android.launcher3.logger.LauncherAtom.AllAppsContainer;
import com.android.launcher3.logger.LauncherAtom.ContainerInfo; import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import com.android.launcher3.logger.LauncherAtom.PredictionContainer;
import com.android.launcher3.logger.LauncherAtom.SearchResultContainer;
import com.android.launcher3.util.ContentWriter; import com.android.launcher3.util.ContentWriter;
import java.util.Optional; import java.util.Optional;
@ -240,8 +245,7 @@ public class ItemInfo {
* Returns if an Item is a predicted item * Returns if an Item is a predicted item
*/ */
public boolean isPredictedItem() { public boolean isPredictedItem() {
return container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION return container == CONTAINER_HOTSEAT_PREDICTION || container == CONTAINER_PREDICTION;
|| container == LauncherSettings.Favorites.CONTAINER_PREDICTION;
} }
/** /**
@ -311,8 +315,11 @@ public class ItemInfo {
break; break;
} }
itemBuilder.setContainerInfo(ContainerInfo.newBuilder().setFolder(folderBuilder)); itemBuilder.setContainerInfo(ContainerInfo.newBuilder().setFolder(folderBuilder));
} else if (getContainerInfo().getContainerCase().getNumber() > 0) { } else {
itemBuilder.setContainerInfo(getContainerInfo()); ContainerInfo containerInfo = getContainerInfo();
if (!containerInfo.getContainerCase().equals(CONTAINER_NOT_SET)) {
itemBuilder.setContainerInfo(containerInfo);
}
} }
return itemBuilder.build(); return itemBuilder.build();
} }
@ -328,16 +335,16 @@ public class ItemInfo {
case CONTAINER_HOTSEAT: case CONTAINER_HOTSEAT:
case CONTAINER_HOTSEAT_PREDICTION: case CONTAINER_HOTSEAT_PREDICTION:
return ContainerInfo.newBuilder() return ContainerInfo.newBuilder()
.setHotseat(LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId)) .setHotseat(LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId))
.build(); .build();
case CONTAINER_DESKTOP: case CONTAINER_DESKTOP:
return ContainerInfo.newBuilder() return ContainerInfo.newBuilder()
.setWorkspace( .setWorkspace(
LauncherAtom.WorkspaceContainer.newBuilder() LauncherAtom.WorkspaceContainer.newBuilder()
.setGridX(cellX) .setGridX(cellX)
.setGridY(cellY) .setGridY(cellY)
.setPageIndex(screenId)) .setPageIndex(screenId))
.build(); .build();
case CONTAINER_ALL_APPS: case CONTAINER_ALL_APPS:
return ContainerInfo.newBuilder() return ContainerInfo.newBuilder()
.setAllAppsContainer( .setAllAppsContainer(
@ -348,11 +355,21 @@ public class ItemInfo {
.setWidgetsContainer( .setWidgetsContainer(
LauncherAtom.WidgetsContainer.getDefaultInstance()) LauncherAtom.WidgetsContainer.getDefaultInstance())
.build(); .build();
case CONTAINER_PREDICTION:
return ContainerInfo.newBuilder()
.setPredictionContainer(PredictionContainer.getDefaultInstance())
.build();
case CONTAINER_SEARCH_RESULTS:
return ContainerInfo.newBuilder()
.setSearchResultContainer(SearchResultContainer.getDefaultInstance())
.build();
} }
return ContainerInfo.getDefaultInstance(); return ContainerInfo.getDefaultInstance();
} }
/** Returns shallow copy of the object. */ /**
* Returns shallow copy of the object.
*/
public ItemInfo makeShallowCopy() { public ItemInfo makeShallowCopy() {
ItemInfo itemInfo = new ItemInfo(); ItemInfo itemInfo = new ItemInfo();
itemInfo.copyFrom(this); itemInfo.copyFrom(this);