Implements LAUNCHER_ITEM_DROP_FOLDER_CREATED event.

When item is dropped on a existing item resulting in new folder creation, triggers LAUNCHER_ITEM_DROP_FOLDER_CREATED event with details of the destination package.
This change also introduces new FolderIcon item to launcher_atom.proto to represent folder icon.

Screencast and sample logs: https://docs.google.com/document/d/1CBP2yTcXdFhPdNG5ZmWFKSgd8mDbMevY-akVlUXPLDo/edit#bookmark=id.tmbucd1f44qp

Bug: 152978018

Change-Id: Ib4d343ba9075aa8853652f128457c4638541ec59
This commit is contained in:
thiruram
2020-05-04 17:49:37 -07:00
parent d13dd3bc44
commit 5a01f0ec51
9 changed files with 96 additions and 35 deletions

View File

@@ -416,8 +416,12 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
mLauncher.getStateManager().goToState(SPRING_LOADED);
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DRAG_STARTED,
dragObject.mLogInstanceId,
dragObject.originalDragInfo.buildProto(null));
dragObject.logInstanceId,
dragObject.originalDragInfo.buildProto(
dragObject.dragSource instanceof Folder
? ((Folder) dragObject.dragSource).mInfo
: null)
);
}
public void deferRemoveExtraEmptyScreen() {
@@ -1645,7 +1649,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
Rect folderLocation = new Rect();
float scale = mLauncher.getDragLayer().getDescendantRectRelativeToSelf(v, folderLocation);
target.removeView(v);
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DROP_FOLDER_CREATED,
d.logInstanceId,
destInfo.buildProto(null));
FolderIcon fi = mLauncher.addFolder(target, container, screenId, targetCell[0],
targetCell[1]);
destInfo.cellX = -1;
@@ -1683,6 +1690,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
if (dropOverView instanceof FolderIcon) {
FolderIcon fi = (FolderIcon) dropOverView;
if (fi.acceptDrop(d.dragInfo)) {
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
d.logInstanceId,
fi.mInfo.buildProto(null));
fi.onDrop(d, false /* itemReturnedOnFailedDrop */);
// if the drag started here, we need to remove it from the workspace
@@ -1885,15 +1896,15 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
mLauncher.getStateManager().goToState(
NORMAL, SPRING_LOADED_EXIT_DELAY, onCompleteRunnable);
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
d.logInstanceId,
d.dragInfo.buildProto(null));
}
if (d.stateAnnouncer != null && !droppedOnOriginalCell) {
d.stateAnnouncer.completeAction(R.string.item_moved);
}
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
d.mLogInstanceId,
d.dragInfo.buildProto(null));
}
public void onNoCellFound(View dropTargetLayout) {
@@ -2515,6 +2526,10 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
resetTransitionTransform();
}
}
mStatsLogManager.log(
LauncherEvent.LAUNCHER_ITEM_DROP_COMPLETED,
d.logInstanceId,
d.dragInfo.buildProto(null));
}
public Bitmap createWidgetBitmap(ItemInfo widgetInfo, View layout) {