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

@@ -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);