diff options
author | Sunny Goyal <sunnygoyal@google.com> | 2015-02-17 11:44:15 -0800 |
---|---|---|
committer | Sunny Goyal <sunnygoyal@google.com> | 2015-02-17 12:00:30 -0800 |
commit | 2434d40ef271966096fea707ac4207d80d1b2901 (patch) | |
tree | 8b8b47d7006b0796e1ad7d7752738d74a6ba40a5 /src | |
parent | 8f9a787945c3326791c61b001e786b96e9fc4341 (diff) | |
download | android_packages_apps_Trebuchet-2434d40ef271966096fea707ac4207d80d1b2901.tar.gz android_packages_apps_Trebuchet-2434d40ef271966096fea707ac4207d80d1b2901.tar.bz2 android_packages_apps_Trebuchet-2434d40ef271966096fea707ac4207d80d1b2901.zip |
Fixing crash when dragging and dropping a restored widget.
> When the widget is in pending state, AppWidgetProviderInfo is not available
Bug: 19364311
Change-Id: If3126a375853e6e710c6eba4b8824e18f3f0d391
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHostView.java | 4 | ||||
-rw-r--r-- | src/com/android/launcher3/Workspace.java | 5 |
2 files changed, 4 insertions, 5 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java index 2d04df2de..954d2d711 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHostView.java +++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java @@ -145,9 +145,9 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc @Override public AppWidgetProviderInfo getAppWidgetInfo() { AppWidgetProviderInfo info = super.getAppWidgetInfo(); - if (!(info instanceof LauncherAppWidgetProviderInfo)) { + if (info != null && !(info instanceof LauncherAppWidgetProviderInfo)) { throw new IllegalStateException("Launcher widget must have" - + "LauncherAppWidgetProviderInfo"); + + " LauncherAppWidgetProviderInfo"); } return info; } diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 44d77571b..69fa457ab 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -3166,9 +3166,8 @@ public class Workspace extends SmoothPagedView // in its final location final LauncherAppWidgetHostView hostView = (LauncherAppWidgetHostView) cell; - LauncherAppWidgetProviderInfo pInfo = (LauncherAppWidgetProviderInfo) - hostView.getAppWidgetInfo(); - if (pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) { + AppWidgetProviderInfo pInfo = hostView.getAppWidgetInfo(); + if (pInfo != null && pInfo.resizeMode != AppWidgetProviderInfo.RESIZE_NONE) { final Runnable addResizeFrame = new Runnable() { public void run() { DragLayer dragLayer = mLauncher.getDragLayer(); |