Set an action name for wallpaer index

Since Android T+, app has to assign an action name for opening a
external app page.

Test: Manual test wallpaper search result and can open.
Fix: 239867167
Change-Id: I4579aaf6e831ff82721c958e6b91ede4cabda2c8
This commit is contained in:
Tsung-Mao Fang
2022-07-25 15:06:34 +08:00
parent c79be68440
commit 0f7b80f47f
3 changed files with 14 additions and 1 deletions

View File

@@ -49,6 +49,10 @@
<string name="config_wallpaper_picker_class" translatable="false">com.android.settings.Settings$WallpaperSettingsActivity</string>
<!-- Fully-qualified class name for the styles & wallpaper picker activity. -->
<string name="config_styles_and_wallpaper_picker_class" translatable="false"></string>
<!-- Action name for the wallpaper picker activity. -->
<string name="config_wallpaper_picker_action" translatable="false"></string>
<!-- Action name for the styles & wallpaper picker activity. -->
<string name="config_styles_and_wallpaper_picker_action" translatable="false"></string>
<!-- Intent extra for wallpaper picker activity. -->
<string name="config_wallpaper_picker_launch_extra" translatable="false">com.android.wallpaper.LAUNCH_SOURCE</string>

View File

@@ -41,6 +41,8 @@ public class WallpaperPreferenceController extends BasePreferenceController {
private final String mWallpaperPackage;
private final String mWallpaperClass;
private final String mStylesAndWallpaperClass;
private final String mWallpaperActionName;
private final String mStylesAndWallpaperActionName;
private final String mWallpaperLaunchExtra;
public WallpaperPreferenceController(Context context, String key) {
@@ -49,6 +51,9 @@ public class WallpaperPreferenceController extends BasePreferenceController {
mWallpaperClass = mContext.getString(R.string.config_wallpaper_picker_class);
mStylesAndWallpaperClass =
mContext.getString(R.string.config_styles_and_wallpaper_picker_class);
mWallpaperActionName = mContext.getString(R.string.config_wallpaper_picker_action);
mStylesAndWallpaperActionName =
mContext.getString(R.string.config_styles_and_wallpaper_picker_action);
mWallpaperLaunchExtra = mContext.getString(R.string.config_wallpaper_picker_launch_extra);
}
@@ -72,6 +77,10 @@ public class WallpaperPreferenceController extends BasePreferenceController {
return areStylesAvailable() ? mStylesAndWallpaperClass : mWallpaperClass;
}
public String getComponentActionName() {
return areStylesAvailable() ? mStylesAndWallpaperActionName : mWallpaperActionName;
}
public String getKeywords() {
StringBuilder sb = new StringBuilder(mContext.getString(R.string.keywords_wallpaper));
if (areStylesAvailable()) {

View File

@@ -84,7 +84,7 @@ public class WallpaperSuggestionActivity extends StyleSuggestionActivityBase imp
ComponentName component = controller.getComponentName();
data.intentTargetPackage = component.getPackageName();
data.intentTargetClass = component.getClassName();
data.intentAction = Intent.ACTION_MAIN;
data.intentAction = controller.getComponentActionName();
data.key = SUPPORT_SEARCH_INDEX_KEY;
data.keywords = controller.getKeywords();
result.add(data);