Fixing set wallpaper crash in Launcher
Change-Id: I3b6299bb10f397209cd69e715fee783abe0c9b64
diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java
index 6e7f9b6..8fb3025 100644
--- a/src/com/android/launcher2/CustomizePagedView.java
+++ b/src/com/android/launcher2/CustomizePagedView.java
@@ -231,19 +231,11 @@
public void run() {
// add the shortcut
ResolveInfo info = (ResolveInfo) animView.getTag();
- Intent createShortcutIntent = new Intent(Intent.ACTION_CREATE_SHORTCUT);
- if (info.labelRes == R.string.group_applications) {
- // Create app shortcuts is a special built-in case of shortcuts
- createShortcutIntent.putExtra(
- Intent.EXTRA_SHORTCUT_NAME,getContext().getString(
- R.string.group_applications));
- } else {
- ComponentName name = new ComponentName(info.activityInfo.packageName,
- info.activityInfo.name);
- createShortcutIntent.setComponent(name);
- }
- mLauncher.prepareAddItemFromHomeCustomizationDrawer();
- mLauncher.processShortcut(createShortcutIntent);
+ Intent createWallpapersIntent = new Intent(Intent.ACTION_SET_WALLPAPER);
+ ComponentName name = new ComponentName(info.activityInfo.packageName,
+ info.activityInfo.name);
+ createWallpapersIntent.setComponent(name);
+ mLauncher.processWallpaper(createWallpapersIntent);
}
});
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 8eece96..d619aa2 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -1459,6 +1459,10 @@
}
}
+ void processWallpaper(Intent intent) {
+ startActivityForResult(intent, REQUEST_PICK_WALLPAPER);
+ }
+
void addLiveFolder(Intent intent) {
// Handle case where user selected "Folder"
String folderName = getResources().getString(R.string.group_folder);