mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-05 02:16:49 +00:00
[AA+] Log app launches from AA+ search result container.
This change will update westworld logs for app launches from AA+ search result. Updates log's container info from AllAppsContainer -> AllAppsPlusSearchResultContainer. Bug: 178562918 Change-Id: I9ffca27fea42951a57640ef36717c04ff0251506
This commit is contained in:
@@ -49,6 +49,9 @@ 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;
|
||||
import com.android.launcher3.model.data.ItemInfoWithIcon;
|
||||
import com.android.launcher3.model.data.PackageItemInfo;
|
||||
@@ -142,8 +145,14 @@ public class SearchResultIcon extends BubbleTextView implements
|
||||
|
||||
SearchActionItemInfo itemInfo = new SearchActionItemInfo(searchAction.getIcon(),
|
||||
searchTarget.getPackageName(), searchTarget.getUserHandle(),
|
||||
searchAction.getTitle()
|
||||
);
|
||||
searchAction.getTitle()) {
|
||||
// Workaround to log ItemInfo with DeviceSearchResultContainer without
|
||||
// updating ItemInfo.container field.
|
||||
@Override
|
||||
protected ContainerInfo getContainerInfo() {
|
||||
return buildDeviceSearchResultContainer();
|
||||
}
|
||||
};
|
||||
itemInfo.setIntent(searchAction.getIntent());
|
||||
itemInfo.setPendingIntent(searchAction.getPendingIntent());
|
||||
|
||||
@@ -243,7 +252,15 @@ public class SearchResultIcon extends BubbleTextView implements
|
||||
|
||||
private void prepareUsingApp(ComponentName componentName, UserHandle userHandle) {
|
||||
AllAppsStore appsStore = mLauncher.getAppsView().getAppsStore();
|
||||
AppInfo appInfo = appsStore.getApp(new ComponentKey(componentName, userHandle));
|
||||
AppInfo appInfo = new AppInfo(
|
||||
appsStore.getApp(new ComponentKey(componentName, userHandle))) {
|
||||
// Workaround to log ItemInfo with DeviceSearchResultContainer without
|
||||
// updating ItemInfo.container field.
|
||||
@Override
|
||||
protected ContainerInfo getContainerInfo() {
|
||||
return buildDeviceSearchResultContainer();
|
||||
}
|
||||
};
|
||||
|
||||
if (appInfo == null) {
|
||||
setVisibility(GONE);
|
||||
@@ -253,9 +270,15 @@ public class SearchResultIcon extends BubbleTextView implements
|
||||
notifyItemInfoChanged(appInfo);
|
||||
}
|
||||
|
||||
|
||||
private void prepareUsingShortcutInfo(ShortcutInfo shortcutInfo) {
|
||||
WorkspaceItemInfo workspaceItemInfo = new WorkspaceItemInfo(shortcutInfo, getContext());
|
||||
WorkspaceItemInfo workspaceItemInfo = new WorkspaceItemInfo(shortcutInfo, getContext()) {
|
||||
// Workaround to log ItemInfo with DeviceSearchResultContainer without
|
||||
// updating ItemInfo.container field.
|
||||
@Override
|
||||
protected ContainerInfo getContainerInfo() {
|
||||
return buildDeviceSearchResultContainer();
|
||||
}
|
||||
};
|
||||
notifyItemInfoChanged(workspaceItemInfo);
|
||||
LauncherAppState launcherAppState = LauncherAppState.getInstance(getContext());
|
||||
MODEL_EXECUTOR.execute(() -> {
|
||||
@@ -293,4 +316,14 @@ public class SearchResultIcon extends BubbleTextView implements
|
||||
mOnItemInfoChanged = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static ContainerInfo buildDeviceSearchResultContainer() {
|
||||
return ContainerInfo.newBuilder().setExtendedContainers(
|
||||
ExtendedContainers
|
||||
.newBuilder()
|
||||
.setDeviceSearchResultContainer(
|
||||
DeviceSearchResultContainer
|
||||
.newBuilder()))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.android.quickstep.logging;
|
||||
|
||||
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.EXTENDED_CONTAINERS;
|
||||
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.FOLDER;
|
||||
import static com.android.launcher3.logger.LauncherAtom.ContainerInfo.ContainerCase.SEARCH_RESULT_CONTAINER;
|
||||
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WORKSPACE_SNAPSHOT;
|
||||
@@ -72,6 +73,7 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
private static final int DEFAULT_PAGE_INDEX = -2;
|
||||
private static final int FOLDER_HIERARCHY_OFFSET = 100;
|
||||
private static final int SEARCH_RESULT_HIERARCHY_OFFSET = 200;
|
||||
private static final int EXTENDED_CONTAINERS_HIERARCHY_OFFSET = 300;
|
||||
|
||||
public static final CopyOnWriteArrayList<StatsLogConsumer> LOGS_CONSUMER =
|
||||
new CopyOnWriteArrayList<>();
|
||||
@@ -397,6 +399,9 @@ public class StatsLogCompatManager extends StatsLogManager {
|
||||
} else if (info.getContainerInfo().getContainerCase() == SEARCH_RESULT_CONTAINER) {
|
||||
return info.getContainerInfo().getSearchResultContainer().getParentContainerCase()
|
||||
.getNumber() + SEARCH_RESULT_HIERARCHY_OFFSET;
|
||||
} else if (info.getContainerInfo().getContainerCase() == EXTENDED_CONTAINERS) {
|
||||
return info.getContainerInfo().getExtendedContainers().getContainerCase().getNumber()
|
||||
+ EXTENDED_CONTAINERS_HIERARCHY_OFFSET;
|
||||
} else {
|
||||
return info.getContainerInfo().getContainerCase().getNumber();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user