Handle widgets added with tap-to-add in AppEventProducer

Widgets added with tap-to-add do not emit an ITEM_DROP_COMPELTED event,
so this change updates AppEventProducer to check for
WIDGET_ADD_BUTTON_TAP event so that it can emit an ACTION_PIN
event for these widgets as well.

Also moves the stats logging for tap to add to after
Launcher.addPendingItem is called, so that the PendingAddItem's container
is set to CONTAINER_DESKTOP.

Bug: 323886237
Test: manual, add widget and confirm event is produced through logging,
 and widget no longer appears in suggestions
Flag: ACONFIG com.android.launcher3.enable_widget_tap_to_add STAGING
Change-Id: Iaf46a408d05f61864a79f87b23160364b6513323
This commit is contained in:
Willie Koomson committed 2024-03-20 22:07:02 +00:00
1 parent 5afb093a58
commit 2471805414
2 files changed
+7 -2

No files matched your search

@@ -164,11 +164,11 @@ public abstract class BaseWidgetSheet extends AbstractSlideInView<BaseActivity>
* Click handler for tap to add button.
*/
public void addWidget(PendingAddItemInfo info) {
mActivityContext.getStatsLogManager().logger().withItemInfo(info).log(
StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP);
handleClose(true);
Launcher.getLauncher(mActivityContext).getAccessibilityDelegate()
.addToWorkspace(info, /*accessibility=*/ false, /*finishCallback=*/ null);
mActivityContext.getStatsLogManager().logger().withItemInfo(info).log(
StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP);
}
@Override