Fixes duplicate "TAP" launcher event when new smart folder is created by drag and drop event.

Bug:147305113

Change-Id: I5d26df6a594b1d222e0db2e40c039c6661146d3a
This commit is contained in:
Thiru Ramasamy 2020-01-08 11:28:04 -08:00
parent 993aef828a
commit 652385d2ea
1 changed files with 14 additions and 2 deletions

View File

@ -423,7 +423,7 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
mFolderName.setHint(suggestName[0]);
mFolderName.setText(suggestName[0]);
mInfo.title = suggestName[0];
animateOpen();
animateOpen(mInfo.contents, 0, true);
mFolderName.showKeyboard();
mFolderName.displayCompletions(
Arrays.asList(suggestName).subList(1, suggestName.length));
@ -519,6 +519,15 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
* is played.
*/
private void animateOpen(List<WorkspaceItemInfo> items, int pageNo) {
animateOpen(items, pageNo, false);
}
/**
* Opens the user folder described by the specified tag. The opening of the folder
* is animated relative to the specified View. If the View is null, no animation
* is played.
*/
private void animateOpen(List<WorkspaceItemInfo> items, int pageNo, boolean skipUserEventLog) {
Folder openFolder = getOpen(mLauncher);
if (openFolder != null && openFolder != this) {
// Close any open folder before opening a folder.
@ -565,10 +574,13 @@ public class Folder extends AbstractFloatingView implements ClipPathView, DragSo
mState = STATE_OPEN;
announceAccessibilityChanges();
mLauncher.getUserEventDispatcher().logActionOnItem(
if (!skipUserEventLog) {
mLauncher.getUserEventDispatcher().logActionOnItem(
Touch.TAP,
Direction.NONE,
ItemType.FOLDER_ICON, mInfo.cellX, mInfo.cellY);
}
mContent.setFocusOnFirstChild();
}