diff options
Diffstat (limited to 'src/com')
4 files changed, 29 insertions, 17 deletions
diff --git a/src/com/android/launcher3/IconCache.java b/src/com/android/launcher3/IconCache.java index 4d953ff10..be02d3583 100644 --- a/src/com/android/launcher3/IconCache.java +++ b/src/com/android/launcher3/IconCache.java @@ -253,13 +253,6 @@ public class IconCache { mLauncherApps.resolveActivity(intent, user); ComponentName component = intent.getComponent(); - try { - launcherActInfo.getComponentName(); - } catch (NullPointerException e) { - // launcherActInfo is invalid: b/14891460 - launcherActInfo = null; - } - // null info means not installed, but if we have a component from the intent then // we should still look in the cache for restored app icons. if (launcherActInfo == null && component == null) { diff --git a/src/com/android/launcher3/LauncherBackupHelper.java b/src/com/android/launcher3/LauncherBackupHelper.java index 81ced7b3b..ea14753d8 100644 --- a/src/com/android/launcher3/LauncherBackupHelper.java +++ b/src/com/android/launcher3/LauncherBackupHelper.java @@ -819,9 +819,15 @@ public class LauncherBackupHelper implements BackupHelper { if (!TextUtils.isEmpty(title)) { favorite.title = title; } - String intent = c.getString(INTENT_INDEX); - if (!TextUtils.isEmpty(intent)) { - favorite.intent = intent; + String intentDescription = c.getString(INTENT_INDEX); + if (!TextUtils.isEmpty(intentDescription)) { + try { + Intent intent = Intent.parseUri(intentDescription, 0); + intent.removeExtra(ItemInfo.EXTRA_PROFILE); + favorite.intent = intent.toUri(0); + } catch (URISyntaxException e) { + Log.e(TAG, "Invalid intent", e); + } } favorite.itemType = c.getInt(ITEM_TYPE_INDEX); if (favorite.itemType == Favorites.ITEM_TYPE_APPWIDGET) { @@ -874,6 +880,11 @@ public class LauncherBackupHelper implements BackupHelper { values.put(Favorites.APPWIDGET_ID, favorite.appWidgetId); } + UserHandleCompat myUserHandle = UserHandleCompat.myUserHandle(); + long userSerialNumber = + UserManagerCompat.getInstance(mContext).getSerialNumberForUser(myUserHandle); + values.put(LauncherSettings.Favorites.PROFILE_ID, userSerialNumber); + // Let LauncherModel know we've been here. values.put(LauncherSettings.Favorites.RESTORED, 1); diff --git a/src/com/android/launcher3/WidgetPreviewLoader.java b/src/com/android/launcher3/WidgetPreviewLoader.java index 48fe269c1..1b37700c6 100644 --- a/src/com/android/launcher3/WidgetPreviewLoader.java +++ b/src/com/android/launcher3/WidgetPreviewLoader.java @@ -515,9 +515,10 @@ public class WidgetPreviewLoader { Drawable drawable = null; if (previewImage != 0) { - drawable = mutateOnMainThread( - mPackageManager.getDrawable(packageName, previewImage, null)); - if (drawable == null) { + drawable = mPackageManager.getDrawable(packageName, previewImage, null); + if (drawable != null) { + drawable = mutateOnMainThread(drawable); + } else { Log.w(TAG, "Can't load widget preview drawable 0x" + Integer.toHexString(previewImage) + " for provider: " + provider); } @@ -572,9 +573,11 @@ public class WidgetPreviewLoader { (int) ((previewDrawableWidth - mAppIconSize * iconScale) / 2); int yoffset = (int) ((previewDrawableHeight - mAppIconSize * iconScale) / 2); - if (iconId > 0) - icon = mutateOnMainThread(mIconCache.getFullResIcon(packageName, iconId)); + if (iconId > 0) { + icon = mIconCache.getFullResIcon(packageName, iconId); + } if (icon != null) { + icon = mutateOnMainThread(icon); renderDrawableToBitmap(icon, defaultPreview, hoffset, yoffset, (int) (mAppIconSize * iconScale), (int) (mAppIconSize * iconScale)); diff --git a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java index c933712a9..21f2659ba 100644 --- a/src/com/android/launcher3/compat/LauncherAppsCompatVL.java +++ b/src/com/android/launcher3/compat/LauncherAppsCompatVL.java @@ -110,8 +110,13 @@ public class LauncherAppsCompatVL extends LauncherAppsCompat { } public LauncherActivityInfoCompat resolveActivity(Intent intent, UserHandleCompat user) { - return new LauncherActivityInfoCompatVL(ReflectUtils.invokeMethod(mLauncherApps, - mResolveActivity, intent, user.getUser())); + Object activity = ReflectUtils.invokeMethod(mLauncherApps, mResolveActivity, + intent, user.getUser()); + if (activity != null) { + return new LauncherActivityInfoCompatVL(activity); + } else { + return null; + } } public void startActivityForProfile(ComponentName component, Rect sourceBounds, |