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

Commit 1c08e5ca authored by George Lin's avatar George Lin Committed by Android (Google) Code Review
Browse files

Merge "Adding launch source info in the wallpaper picker intent (1/3)" into main

parents 78c32b14 5406db9d
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -41,19 +41,20 @@ public class WallpaperSuggestionActivity extends StyleSuggestionActivityBase imp
    private static final String WALLPAPER_FOCUS = "focus_wallpaper";
    private static final String WALLPAPER_ONLY = "wallpaper_only";
    private static final String LAUNCHED_SUW = "app_launched_suw";

    private String mWallpaperLaunchExtra;
    private static final String LAUNCH_SOURCE_SETTINGS_SEARCH = "app_launched_settings_search";

    @Override
    protected void addExtras(Intent intent) {
        String wallpaperLaunchExtra =
                getResources().getString(R.string.config_wallpaper_picker_launch_extra);;
        if (WizardManagerHelper.isAnySetupWizard(intent)) {
            intent.putExtra(WALLPAPER_FLAVOR_EXTRA, WALLPAPER_ONLY);

            mWallpaperLaunchExtra =
                    getResources().getString(R.string.config_wallpaper_picker_launch_extra);
            intent.putExtra(mWallpaperLaunchExtra, LAUNCHED_SUW);
            intent.putExtra(wallpaperLaunchExtra, LAUNCHED_SUW);
        } else {
            // This is the case when user enter the wallpaper picker from the search result entry
            // on the Settings app
            intent.putExtra(WALLPAPER_FLAVOR_EXTRA, WALLPAPER_FOCUS);
            intent.putExtra(wallpaperLaunchExtra, LAUNCH_SOURCE_SETTINGS_SEARCH);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -118,7 +118,7 @@ public class WallpaperSuggestionActivityTest {
    }

    @Test
    public void addExtras_intentNotFromSetupWizard_extrasHasFocusWallpaper() {
    public void addExtras_intentNotFromSetupWizard_extrasHasFocusWallpaperAndLaunchedSettingsSearch() {
        WallpaperSuggestionActivity activity = Robolectric.buildActivity(
                WallpaperSuggestionActivity.class, new Intent(Intent.ACTION_MAIN).setComponent(
                        new ComponentName(RuntimeEnvironment.application,
@@ -127,6 +127,8 @@ public class WallpaperSuggestionActivityTest {

        assertThat(intent).isNotNull();
        assertThat(intent.getStringExtra(WALLPAPER_FLAVOR)).isEqualTo("focus_wallpaper");
        assertThat(intent.getStringExtra(WALLPAPER_LAUNCH_SOURCE))
                .isEqualTo("app_launched_settings_search");
    }