From c3919c0e994309982efc8779af57e2bc78dcac43 Mon Sep 17 00:00:00 2001 From: Chris Wren Date: Wed, 18 Sep 2013 09:48:33 -0400 Subject: fixup missing providers on load. Bug: 10779026 Change-Id: I0a9fc43258623c233c7ba89a9e9f1dee97800967 --- src/com/android/launcher3/LauncherModel.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/com') diff --git a/src/com/android/launcher3/LauncherModel.java b/src/com/android/launcher3/LauncherModel.java index 179c8aa76..aaa901ac1 100644 --- a/src/com/android/launcher3/LauncherModel.java +++ b/src/com/android/launcher3/LauncherModel.java @@ -39,6 +39,7 @@ import android.os.Parcelable; import android.os.Process; import android.os.RemoteException; import android.os.SystemClock; +import android.provider.BaseColumns; import android.util.Log; import android.util.Pair; import com.android.launcher3.InstallWidgetReceiver.WidgetMimeTypeHandlerData; @@ -1696,6 +1697,8 @@ public class LauncherModel extends BroadcastReceiver { LauncherSettings.Favorites.ITEM_TYPE); final int appWidgetIdIndex = c.getColumnIndexOrThrow( LauncherSettings.Favorites.APPWIDGET_ID); + final int appWidgetProviderIndex = c.getColumnIndexOrThrow( + LauncherSettings.Favorites.APPWIDGET_PROVIDER); final int screenIndex = c.getColumnIndexOrThrow( LauncherSettings.Favorites.SCREEN); final int cellXIndex = c.getColumnIndexOrThrow @@ -1856,6 +1859,8 @@ public class LauncherModel extends BroadcastReceiver { case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET: // Read all Launcher-specific widget details int appWidgetId = c.getInt(appWidgetIdIndex); + String savedProvider = c.getString(appWidgetProviderIndex); + id = c.getLong(idIndex); final AppWidgetProviderInfo provider = @@ -1901,6 +1906,15 @@ public class LauncherModel extends BroadcastReceiver { if (!checkItemPlacement(occupied, appWidgetInfo)) { break; } + String providerName = provider.provider.flattenToString(); + if (!providerName.equals(savedProvider)) { + ContentValues values = new ContentValues(); + values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, + providerName); + String where = BaseColumns._ID + "= ?"; + String[] args = {Integer.toString(c.getInt(idIndex))}; + contentResolver.update(contentUri, values, where, args); + } sBgItemsIdMap.put(appWidgetInfo.id, appWidgetInfo); sBgAppWidgets.add(appWidgetInfo); } -- cgit v1.2.3