summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xWallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java36
1 files changed, 23 insertions, 13 deletions
diff --git a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
index a90cdbaae..e4fa637bc 100755
--- a/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
+++ b/WallpaperPicker/src/com/android/launcher3/WallpaperPickerActivity.java
@@ -1017,6 +1017,11 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
addWallpapers(bundled, wallpaperRes, r.first.packageName, r.second);
} catch (PackageManager.NameNotFoundException e) {
}
+ } else {
+ // Fall back to searching in our resources with the given package name if
+ // The above search fails. If the resource is not found, none will be added.
+ final String packageName = getResources().getResourcePackageName(R.array.wallpapers);
+ addWallpapers(bundled, getResources(), packageName, R.array.wallpapers);
}
if (partner == null || !partner.hideDefaultWallpaper()) {
@@ -1136,21 +1141,26 @@ public class WallpaperPickerActivity extends WallpaperCropActivity {
private void addWallpapers(ArrayList<WallpaperTileInfo> known, Resources res,
String packageName, int listResId) {
- final String[] extras = res.getStringArray(listResId);
- for (String extra : extras) {
- int resId = res.getIdentifier(extra, "drawable", packageName);
- if (resId != 0) {
- final int thumbRes = res.getIdentifier(extra + "_small", "drawable", packageName);
-
- if (thumbRes != 0) {
- ResourceWallpaperInfo wallpaperInfo =
- new ResourceWallpaperInfo(res, resId, res.getDrawable(thumbRes));
- known.add(wallpaperInfo);
- // Log.d(TAG, "add: [" + packageName + "]: " + extra + " (" + res + ")");
+ try {
+ final String[] extras = res.getStringArray(listResId);
+ for (String extra : extras) {
+ int resId = res.getIdentifier(extra, "drawable", packageName);
+ if (resId != 0) {
+ final int thumbRes = res.getIdentifier(extra + "_small", "drawable",
+ packageName);
+
+ if (thumbRes != 0) {
+ ResourceWallpaperInfo wallpaperInfo =
+ new ResourceWallpaperInfo(res, resId, res.getDrawable(thumbRes));
+ known.add(wallpaperInfo);
+ // Log.d(TAG, "add: [" + packageName + "]: " + extra + " (" + res + ")");
+ }
+ } else {
+ Log.e(TAG, "Couldn't find wallpaper " + extra);
}
- } else {
- Log.e(TAG, "Couldn't find wallpaper " + extra);
}
+ } catch (Resources.NotFoundException e) {
+ Log.e(TAG, "No wallpapers found, resource could not be located + " + listResId);
}
}