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

Commit 0f7b80f4 authored by Tsung-Mao Fang's avatar Tsung-Mao Fang
Browse files

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
parent c79be684
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -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>

+9 −0
Original line number Diff line number Diff line
@@ -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()) {
+1 −1
Original line number Diff line number Diff line
@@ -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);