remember the provider path when creating a widget.
Bug: 10779026 Change-Id: I4f5b619087868a8f637c433c29e3aa6856ccc97d
This commit is contained in:
@@ -65,6 +65,7 @@ class LauncherAppWidgetInfo extends ItemInfo {
|
||||
void onAddToDatabase(ContentValues values) {
|
||||
super.onAddToDatabase(values);
|
||||
values.put(LauncherSettings.Favorites.APPWIDGET_ID, appWidgetId);
|
||||
values.put(LauncherSettings.Favorites.APPWIDGET_PROVIDER, providerName.flattenToString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -65,7 +65,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
|
||||
private static final String DATABASE_NAME = "launcher.db";
|
||||
|
||||
private static final int DATABASE_VERSION = 13;
|
||||
private static final int DATABASE_VERSION = 14;
|
||||
|
||||
static final String OLD_AUTHORITY = "com.android.launcher2.settings";
|
||||
static final String AUTHORITY = "com.android.launcher3.settings";
|
||||
@@ -342,7 +342,8 @@ public class LauncherProvider extends ContentProvider {
|
||||
"iconResource TEXT," +
|
||||
"icon BLOB," +
|
||||
"uri TEXT," +
|
||||
"displayMode INTEGER" +
|
||||
"displayMode INTEGER," +
|
||||
"appWidgetProvider TEXT" +
|
||||
");");
|
||||
addWorkspacesTable(db);
|
||||
|
||||
@@ -626,6 +627,22 @@ public class LauncherProvider extends ContentProvider {
|
||||
version = 13;
|
||||
}
|
||||
|
||||
if (version < 14) {
|
||||
db.beginTransaction();
|
||||
try {
|
||||
// Insert new column for holding widget provider name
|
||||
db.execSQL("ALTER TABLE favorites " +
|
||||
"ADD COLUMN appWidgetProvider TEXT;");
|
||||
db.setTransactionSuccessful();
|
||||
version = 14;
|
||||
} catch (SQLException ex) {
|
||||
// Old version remains, which means we wipe old data
|
||||
Log.e(TAG, ex.getMessage(), ex);
|
||||
} finally {
|
||||
db.endTransaction();
|
||||
}
|
||||
}
|
||||
|
||||
if (version != DATABASE_VERSION) {
|
||||
Log.w(TAG, "Destroying all old data.");
|
||||
db.execSQL("DROP TABLE IF EXISTS " + TABLE_FAVORITES);
|
||||
@@ -1244,6 +1261,7 @@ public class LauncherProvider extends ContentProvider {
|
||||
values.put(Favorites.SPANX, spanX);
|
||||
values.put(Favorites.SPANY, spanY);
|
||||
values.put(Favorites.APPWIDGET_ID, appWidgetId);
|
||||
values.put(Favorites.APPWIDGET_PROVIDER, cn.flattenToString());
|
||||
values.put(Favorites._ID, generateNewItemId());
|
||||
dbInsertAndCheck(this, db, TABLE_FAVORITES, null, values);
|
||||
|
||||
|
||||
@@ -234,6 +234,13 @@ class LauncherSettings {
|
||||
* <P>Type: INTEGER</P>
|
||||
*/
|
||||
static final String APPWIDGET_ID = "appWidgetId";
|
||||
|
||||
/**
|
||||
* The ComponentName of the widget provider
|
||||
*
|
||||
* <P>Type: STRING</P>
|
||||
*/
|
||||
public static final String APPWIDGET_PROVIDER = "appWidgetProvider";
|
||||
|
||||
/**
|
||||
* Indicates whether this favorite is an application-created shortcut or not.
|
||||
|
||||
Reference in New Issue
Block a user