[AA+] Fixes wrong container for LAUNCHER_ITEM_DROP_COMPLETED log event. am: 73821a9c6d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/13501152

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: If935801dfc999849955a3214f89cc0223f285f89
This commit is contained in:
thiruram authored and Automerger Merge Worker committed 2021-02-08 22:08:56 +00:00
commit aa668c5ea3
4 files changed
+38 -25

No files matched your search

@@ -15,6 +15,7 @@
*/
package com.android.launcher3.search;
import static com.android.launcher3.LauncherSettings.Favorites.EXTENDED_CONTAINERS;
import static com.android.launcher3.model.data.SearchActionItemInfo.FLAG_BADGE_WITH_PACKAGE;
import static com.android.launcher3.model.data.SearchActionItemInfo.FLAG_PRIMARY_ICON_FROM_TITLE;
import static com.android.launcher3.search.SearchTargetUtil.BUNDLE_EXTRA_PRIMARY_ICON_FROM_TITLE;
@@ -49,7 +50,6 @@ import com.android.launcher3.allapps.AllAppsStore;
import com.android.launcher3.icons.BitmapInfo;
import com.android.launcher3.icons.BitmapRenderer;
import com.android.launcher3.icons.LauncherIcons;
import com.android.launcher3.logger.LauncherAtom.ContainerInfo;
import com.android.launcher3.logger.LauncherAtomExtensions.DeviceSearchResultContainer;
import com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers;
import com.android.launcher3.model.data.AppInfo;
@@ -147,11 +147,10 @@ public class SearchResultIcon extends BubbleTextView implements
SearchActionItemInfo itemInfo = new SearchActionItemInfo(searchAction.getIcon(),
searchTarget.getPackageName(), searchTarget.getUserHandle(),
searchAction.getTitle()) {
// Workaround to log ItemInfo with DeviceSearchResultContainer without
// updating ItemInfo.container field.
@Override
public ContainerInfo getContainerInfo() {
return buildDeviceSearchResultContainer();
protected ExtendedContainers getExtendedContainer() {
return ExtendedContainers.newBuilder()
.setDeviceSearchResultContainer(buildDeviceSearchResultContainer()).build();
}
};
itemInfo.setIntent(searchAction.getIntent());
@@ -255,14 +254,13 @@ public class SearchResultIcon extends BubbleTextView implements
AllAppsStore appsStore = mLauncher.getAppsView().getAppsStore();
AppInfo appInfo = new AppInfo(
appsStore.getApp(new ComponentKey(componentName, userHandle))) {
// Workaround to log ItemInfo with DeviceSearchResultContainer without
// updating ItemInfo.container field.
@Override
public ContainerInfo getContainerInfo() {
return buildDeviceSearchResultContainer();
protected ExtendedContainers getExtendedContainer() {
return ExtendedContainers.newBuilder()
.setDeviceSearchResultContainer(buildDeviceSearchResultContainer()).build();
}
};
appInfo.container = EXTENDED_CONTAINERS;
if (appInfo == null) {
setVisibility(GONE);
return;
@@ -273,13 +271,13 @@ public class SearchResultIcon extends BubbleTextView implements
private void prepareUsingShortcutInfo(ShortcutInfo shortcutInfo) {
WorkspaceItemInfo workspaceItemInfo = new WorkspaceItemInfo(shortcutInfo, getContext()) {
// Workaround to log ItemInfo with DeviceSearchResultContainer without
// updating ItemInfo.container field.
@Override
public ContainerInfo getContainerInfo() {
return buildDeviceSearchResultContainer();
protected ExtendedContainers getExtendedContainer() {
return ExtendedContainers.newBuilder()
.setDeviceSearchResultContainer(buildDeviceSearchResultContainer()).build();
}
};
workspaceItemInfo.container = EXTENDED_CONTAINERS;
notifyItemInfoChanged(workspaceItemInfo);
LauncherAppState launcherAppState = LauncherAppState.getInstance(getContext());
MODEL_EXECUTOR.execute(() -> {
@@ -318,15 +316,10 @@ public class SearchResultIcon extends BubbleTextView implements
}
}
private ContainerInfo buildDeviceSearchResultContainer() {
return ContainerInfo.newBuilder().setExtendedContainers(
ExtendedContainers
.newBuilder()
.setDeviceSearchResultContainer(
mSearchSessionTracker.getQueryLength()
.map(queryLength -> DeviceSearchResultContainer.newBuilder()
.setQueryLength(queryLength))
.orElse(DeviceSearchResultContainer.newBuilder())))
.build();
private DeviceSearchResultContainer buildDeviceSearchResultContainer() {
return mSearchSessionTracker.getQueryLength()
.map(queryLength -> DeviceSearchResultContainer.newBuilder()
.setQueryLength(queryLength))
.orElse(DeviceSearchResultContainer.newBuilder()).build();
}
}
@@ -171,6 +171,9 @@ public class LauncherSettings {
public static final int CONTAINER_SETTINGS = -108;
public static final int CONTAINER_TASKSWITCHER = -109;
// Represents any of the extended containers implemented in non-AOSP variants.
public static final int EXTENDED_CONTAINERS = -200;
public static final String containerToString(int container) {
switch (container) {
case CONTAINER_DESKTOP: return "desktop";
@@ -26,6 +26,7 @@ import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SETTING
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_SHORTCUTS;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_TASKSWITCHER;
import static com.android.launcher3.LauncherSettings.Favorites.CONTAINER_WIDGETS_TRAY;
import static com.android.launcher3.LauncherSettings.Favorites.EXTENDED_CONTAINERS;
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;
@@ -54,6 +55,7 @@ import com.android.launcher3.logger.LauncherAtom.SettingsContainer;
import com.android.launcher3.logger.LauncherAtom.Shortcut;
import com.android.launcher3.logger.LauncherAtom.ShortcutsContainer;
import com.android.launcher3.logger.LauncherAtom.TaskSwitcherContainer;
import com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers;
import com.android.launcher3.model.ModelWriter;
import com.android.launcher3.util.ContentWriter;
@@ -403,11 +405,22 @@ public class ItemInfo {
return ContainerInfo.newBuilder()
.setTaskSwitcherContainer(TaskSwitcherContainer.getDefaultInstance())
.build();
case EXTENDED_CONTAINERS:
return ContainerInfo.newBuilder()
.setExtendedContainers(getExtendedContainer())
.build();
}
return ContainerInfo.getDefaultInstance();
}
/**
* Returns non-AOSP container wrapped by {@link ExtendedContainers} object. Should be overridden
* by build variants.
*/
protected ExtendedContainers getExtendedContainer() {
return ExtendedContainers.getDefaultInstance();
}
/**
* Returns shallow copy of the object.
*/
@@ -15,6 +15,8 @@
*/
package com.android.launcher3.model.data;
import static com.android.launcher3.LauncherSettings.Favorites.EXTENDED_CONTAINERS;
import android.app.PendingIntent;
import android.content.Intent;
import android.graphics.drawable.Icon;
@@ -45,6 +47,7 @@ public class SearchActionItemInfo extends ItemInfoWithIcon {
CharSequence title) {
this.user = user == null ? Process.myUserHandle() : user;
this.title = title;
this.container = EXTENDED_CONTAINERS;
mFallbackPackageName = packageName;
mIcon = icon;
}
@@ -55,6 +58,7 @@ public class SearchActionItemInfo extends ItemInfoWithIcon {
mFallbackPackageName = info.mFallbackPackageName;
mFlags = info.mFlags;
title = info.title;
this.container = EXTENDED_CONTAINERS;
}
/**