Merge "Adding launch source info in the wallpaper picker intent (1/3)" into main
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user