Refactor logging to capture Target hierarchy

Instead of creating a fixed number of targets, we now pass an ArrayList
of targets to. Any class implementing
LogContainerProviders#fillInLogContainerData can setup it's own target
and add it to the ArrayList, It can also pass the ArrayList to other
LogContainerProvider to capture full Target hierarchy.

Bug: 147305863
Change-Id: I0063c692120fb9e1cff2d8902c5da972d0623418
This commit is contained in:
Samuel Fufa
2020-02-27 16:59:19 -08:00
parent 9099dfcfb7
commit a579ddc9c8
18 changed files with 241 additions and 197 deletions

View File

@@ -24,6 +24,7 @@ import static com.android.launcher3.LauncherState.OVERVIEW;
import static com.android.launcher3.LauncherState.SPRING_LOADED;
import static com.android.launcher3.config.FeatureFlags.ADAPTIVE_ICON_WINDOW_ANIM;
import static com.android.launcher3.dragndrop.DragLayer.ALPHA_INDEX_OVERLAY;
import static com.android.launcher3.logging.LoggerUtils.newContainerTarget;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
@@ -3309,17 +3310,21 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
}
@Override
public void fillInLogContainerData(View v, ItemInfo info, Target target, Target targetParent) {
target.gridX = info.cellX;
target.gridY = info.cellY;
target.pageIndex = getCurrentPage();
targetParent.containerType = ContainerType.WORKSPACE;
if (info.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT) {
target.rank = info.rank;
targetParent.containerType = ContainerType.HOTSEAT;
} else if (info.container >= 0) {
targetParent.containerType = ContainerType.FOLDER;
public void fillInLogContainerData(ItemInfo childInfo, Target child,
ArrayList<Target> parents) {
if (childInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT
|| childInfo.container == LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION) {
getHotseat().fillInLogContainerData(childInfo, child, parents);
return;
} else if (childInfo.container >= 0) {
FolderIcon icon = (FolderIcon) getHomescreenIconByItemId(childInfo.container);
icon.getFolder().fillInLogContainerData(childInfo, child, parents);
return;
}
child.gridX = childInfo.cellX;
child.gridY = childInfo.cellY;
child.pageIndex = getCurrentPage();
parents.add(newContainerTarget(ContainerType.WORKSPACE));
}
/**