Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43879a72 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Handle widgets added with tap-to-add in AppEventProducer" into main

parents 017af39a 24718054
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCH
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SYSTEM_SHORTCUT_DONT_SUGGEST_APP_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_SWIPE_DOWN;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_TASK_LAUNCH_TAP;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGET_ADD_BUTTON_TAP;
import static com.android.launcher3.model.PredictionHelper.isTrackedForHotseatPrediction;
import static com.android.launcher3.model.PredictionHelper.isTrackedForWidgetPrediction;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
@@ -184,6 +185,10 @@ public class AppEventProducer implements StatsLogConsumer {
            sendEvent(target, atomInfo, ACTION_LAUNCH, CONTAINER_PREDICTION);
        } else if (event == LAUNCHER_DISMISS_PREDICTION_UNDO) {
            sendEvent(atomInfo, ACTION_UNDISMISS, CONTAINER_HOTSEAT_PREDICTION);
        } else if (event == LAUNCHER_WIDGET_ADD_BUTTON_TAP) {
            if (isTrackedForWidgetPrediction(atomInfo)) {
                sendEvent(atomInfo, ACTION_PIN, CONTAINER_WIDGETS_PREDICTION);
            }
        }
    }

+2 −2
Original line number Diff line number Diff line
@@ -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