From 0f5c9dbb6f72025b8fe3f1690c4c953b448dc3ea Mon Sep 17 00:00:00 2001 From: "Wesley.CW Wang" Date: Tue, 8 Sep 2020 16:33:11 +0800 Subject: [PATCH] Add intent extra when launching WallpaperPicker from Launcher - Add extra to the intent to help WallpaperPicker log the launch source - design doc: go/log-wppg-launch-source Bug: 154781896 Test: manually Change-Id: Ife774866b06251c01f28f72555c3dcc844fdc051 --- src/com/android/launcher3/Utilities.java | 4 ++++ src/com/android/launcher3/views/OptionsPopupView.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index bf637886b7..681118d882 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -141,6 +141,10 @@ public final class Utilities { public static final String EXTRA_WALLPAPER_OFFSET = "com.android.launcher3.WALLPAPER_OFFSET"; public static final String EXTRA_WALLPAPER_FLAVOR = "com.android.launcher3.WALLPAPER_FLAVOR"; + // An intent extra to indicate the launch source by launcher. + public static final String EXTRA_WALLPAPER_LAUNCH_SOURCE = + "com.android.wallpaper.LAUNCH_SOURCE"; + public static boolean IS_RUNNING_IN_TEST_HARNESS = ActivityManager.isRunningInTestHarness(); diff --git a/src/com/android/launcher3/views/OptionsPopupView.java b/src/com/android/launcher3/views/OptionsPopupView.java index d558781be8..349ba9d5c1 100644 --- a/src/com/android/launcher3/views/OptionsPopupView.java +++ b/src/com/android/launcher3/views/OptionsPopupView.java @@ -16,6 +16,7 @@ package com.android.launcher3.views; import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_FLAVOR; +import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_LAUNCH_SOURCE; import static com.android.launcher3.Utilities.EXTRA_WALLPAPER_OFFSET; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.IGNORE; import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_SETTINGS_BUTTON_TAP_OR_LONGPRESS; @@ -210,7 +211,8 @@ public class OptionsPopupView extends ArrowPopup Intent intent = new Intent(Intent.ACTION_SET_WALLPAPER) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) .putExtra(EXTRA_WALLPAPER_OFFSET, - launcher.getWorkspace().getWallpaperOffsetForCenterPage()); + launcher.getWorkspace().getWallpaperOffsetForCenterPage()) + .putExtra(EXTRA_WALLPAPER_LAUNCH_SOURCE, "app_launched_launcher"); if (!Utilities.existsStyleWallpapers(launcher)) { intent.putExtra(EXTRA_WALLPAPER_FLAVOR, "wallpaper_only"); } else {