fix the issue widget id wasn't being migrated in backup
After SuW the favorite table is copied into backup table, but the widget
id in the backup table hasn't been migrated. This introduces general
unstabality and can sometimes leads to the disappearance of widgets
after a restore.
Bug: 171774227
Test: run Backup Restore flows and verified database status with arbitrary
logging
Change-Id: If275a6b5395504d6de90e26c3998f759e797f6e1
diff --git a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
index 8bf027d..b85c648 100644
--- a/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
+++ b/src/com/android/launcher3/AppWidgetsRestoredReceiver.java
@@ -106,7 +106,8 @@
}
}
// attempt to update widget id in backup table as well
- new ContentWriter(context, ContentWriter.CommitParams.backupCommitParams(where, args))
+ new ContentWriter(context, ContentWriter.CommitParams.backupCommitParams(
+ "appWidgetId=? and profileId=?", args))
.put(LauncherSettings.Favorites.APPWIDGET_ID, newWidgetIds[i])
.put(LauncherSettings.Favorites.RESTORED, state)
.commit();