fix the issue widget id can be wrong after restore

Bug: 171774227
Test: manual testing
1. randomly add/remove widgets to workspace
2. create a backup (Settings > System > Backup)
3. reset the device
4. restore from the backup
5. verify all of the widgets are restored properly

Change-Id: Id65e474dd9349aca715d7e6b88f8d58bc63066ae
This commit is contained in:
Pinyao Ting committed 2020-10-28 22:04:35 -07:00
1 parent 8f48f23039
commit f39f351a0d
3 files changed
+29 -7

No files matched your search

@@ -113,14 +113,26 @@ public class ContentWriter {
public static final class CommitParams {
final Uri mUri = LauncherSettings.Favorites.CONTENT_URI;
String mWhere;
String[] mSelectionArgs;
final Uri mUri;
final String mWhere;
final String[] mSelectionArgs;
public CommitParams(String where, String[] selectionArgs) {
this(LauncherSettings.Favorites.CONTENT_URI, where, selectionArgs);
}
private CommitParams(Uri uri, String where, String[] selectionArgs) {
mUri = uri;
mWhere = where;
mSelectionArgs = selectionArgs;
}
/**
* Creates commit params for backup table.
*/
public static CommitParams backupCommitParams(String where, String[] selectionArgs) {
return new CommitParams(
LauncherSettings.Favorites.BACKUP_CONTENT_URI, where, selectionArgs);
}
}
}