OSDN Git Service

Reduce number of wallpaper results in search.
authorAndrew Sapperstein <asapperstein@google.com>
Thu, 29 Jun 2017 00:16:57 +0000 (17:16 -0700)
committerAndrew Sapperstein <asapperstein@google.com>
Thu, 29 Jun 2017 00:16:57 +0000 (17:16 -0700)
Previously we indexed the intent in display settings and every
app that handled ACTION_SET_WALLPAPER. Now, we only index an
app that handles ACTION_SET_WALLPAPER and is the listed package in
config_wallpaper_picker_package.

Change-Id: Ife81702017e3e8be4a754873d9c453fddf1cbd9e
Fixes: 62793068
Test: manual, search wallpaper and observe results

src/com/android/settings/DisplaySettings.java
src/com/android/settings/display/WallpaperPreferenceController.java
src/com/android/settings/wallpaper/WallpaperSuggestionActivity.java
src/com/android/settings/wallpaper/WallpaperTypeSettings.java

index 9ce4c4a..c7f349e 100644 (file)
@@ -127,6 +127,7 @@ public class DisplaySettings extends DashboardFragment {
                 public List<String> getNonIndexableKeys(Context context) {
                     List<String> keys = super.getNonIndexableKeys(context);
                     keys.add(KEY_DISPLAY_SIZE);
+                    keys.add(WallpaperPreferenceController.KEY_WALLPAPER);
                     return keys;
                 }
 
index aa29afc..eb91052 100644 (file)
@@ -25,7 +25,7 @@ import static android.os.UserManager.DISALLOW_SET_WALLPAPER;
 
 public class WallpaperPreferenceController extends PreferenceController {
 
-    private static final String KEY_WALLPAPER = "wallpaper";
+    public static final String KEY_WALLPAPER = "wallpaper";
 
     public WallpaperPreferenceController(Context context) {
         super(context);
index afbb0b4..90c5888 100644 (file)
@@ -45,7 +45,7 @@ public class WallpaperSuggestionActivity extends Activity {
         finish();
     }
 
-    @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)
+    @VisibleForTesting
     void startFallbackSuggestion() {
         // fall back to default wallpaper picker
         Utils.startWithFragment(this, WallpaperTypeSettings.class.getName(), null, null, 0,
index bef4777..1ca8ac7 100644 (file)
@@ -90,8 +90,13 @@ public class WallpaperTypeSettings extends SettingsPreferenceFragment implements
                 final List<ResolveInfo> rList = pm.queryIntentActivities(intent,
                         PackageManager.MATCH_DEFAULT_ONLY);
 
-                // Add indexable data for each of the matching activities
+                // Add indexable data for package that is in config_wallpaper_picker_package
+                final String wallpaperPickerPackage =
+                        context.getString(R.string.config_wallpaper_picker_package);
                 for (ResolveInfo info : rList) {
+                    if (!wallpaperPickerPackage.equals(info.activityInfo.packageName)) {
+                        continue;
+                    }
                     CharSequence label = info.loadLabel(pm);
                     if (label == null) label = info.activityInfo.packageName;