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;
AllAppsContainer all_apps_container = 4;
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 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 {
UNKNOWN = 0;
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_WIDGETS_TRAY = -105;
// Represents search results view.
public static final int CONTAINER_SEARCH_RESULTS = -106;
public static final String containerToString(int container) {
switch (container) {
@ -163,6 +165,7 @@ public class LauncherSettings {
case CONTAINER_PREDICTION: return "prediction";
case CONTAINER_ALL_APPS: return "all_apps";
case CONTAINER_WIDGETS_TRAY: return "widgets_tray";
case CONTAINER_SEARCH_RESULTS: return "search_result";
default: return String.valueOf(container);
}
}

View File

@ -418,10 +418,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED,
dragObject.logInstanceId,
dragObject.originalDragInfo.buildProto(
dragObject.dragSource instanceof Folder
? ((Folder) dragObject.dragSource).mInfo
: null)
dragObject.dragSource instanceof Folder
? dragObject.originalDragInfo
.buildProto(((Folder) dragObject.dragSource).mInfo)
: 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_HOTSEAT;
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.ITEM_TYPE_APPLICATION;
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_SHORTCUT;
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.CONTAINER_NOT_SET;
import android.content.ComponentName;
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.AllAppsContainer;
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 java.util.Optional;
@ -240,8 +245,7 @@ public class ItemInfo {
* Returns if an Item is a predicted item
*/
public boolean isPredictedItem() {
return container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION
|| container == LauncherSettings.Favorites.CONTAINER_PREDICTION;
return container == CONTAINER_HOTSEAT_PREDICTION || container == CONTAINER_PREDICTION;
}
/**
@ -311,8 +315,11 @@ public class ItemInfo {
break;
}
itemBuilder.setContainerInfo(ContainerInfo.newBuilder().setFolder(folderBuilder));
} else if (getContainerInfo().getContainerCase().getNumber() > 0) {
itemBuilder.setContainerInfo(getContainerInfo());
} else {
ContainerInfo containerInfo = getContainerInfo();
if (!containerInfo.getContainerCase().equals(CONTAINER_NOT_SET)) {
itemBuilder.setContainerInfo(containerInfo);
}
}
return itemBuilder.build();
}
@ -328,16 +335,16 @@ public class ItemInfo {
case CONTAINER_HOTSEAT:
case CONTAINER_HOTSEAT_PREDICTION:
return ContainerInfo.newBuilder()
.setHotseat(LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId))
.build();
.setHotseat(LauncherAtom.HotseatContainer.newBuilder().setIndex(screenId))
.build();
case CONTAINER_DESKTOP:
return ContainerInfo.newBuilder()
.setWorkspace(
LauncherAtom.WorkspaceContainer.newBuilder()
.setGridX(cellX)
.setGridY(cellY)
.setPageIndex(screenId))
.build();
.setWorkspace(
LauncherAtom.WorkspaceContainer.newBuilder()
.setGridX(cellX)
.setGridY(cellY)
.setPageIndex(screenId))
.build();
case CONTAINER_ALL_APPS:
return ContainerInfo.newBuilder()
.setAllAppsContainer(
@ -348,11 +355,21 @@ public class ItemInfo {
.setWidgetsContainer(
LauncherAtom.WidgetsContainer.getDefaultInstance())
.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();
}
/** Returns shallow copy of the object. */
/**
* Returns shallow copy of the object.
*/
public ItemInfo makeShallowCopy() {
ItemInfo itemInfo = new ItemInfo();
itemInfo.copyFrom(this);