Adding support for backing up favorites table
Favorites table is copied as a separate table name during the first grid migration. On subsequent migrations this backup table is used if it exists, otherwise new backup is created. The backup table is also removed if there is any insert or delete operation on the db (outside of the migration operation itself). Bug: 111850268 Bug: 121048571 Change-Id: I6f02f4a355c369ee99d89430971be258f7516f6e
This commit is contained in:
1 parent
efb8b83666
commit
161a214ede
11 files changed
+555
-213
No files matched your search
@@ -37,28 +37,20 @@ import java.util.ArrayList;
|
||||
*/
|
||||
public class LossyScreenMigrationTask extends GridSizeMigrationTask {
|
||||
|
||||
private final SQLiteDatabase mDb;
|
||||
|
||||
private final IntSparseArrayMap<DbEntry> mOriginalItems;
|
||||
private final IntSparseArrayMap<DbEntry> mUpdates;
|
||||
|
||||
protected LossyScreenMigrationTask(
|
||||
Context context, InvariantDeviceProfile idp, SQLiteDatabase db) {
|
||||
// Decrease the rows count by 1
|
||||
super(context, idp, getValidPackages(context),
|
||||
super(context, db, getValidPackages(context),
|
||||
new Point(idp.numColumns, idp.numRows + 1),
|
||||
new Point(idp.numColumns, idp.numRows));
|
||||
|
||||
mDb = db;
|
||||
mOriginalItems = new IntSparseArrayMap<>();
|
||||
mUpdates = new IntSparseArrayMap<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Cursor queryWorkspace(String[] columns, String where) {
|
||||
return mDb.query(Favorites.TABLE_NAME, columns, where, null, null, null, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update(DbEntry item) {
|
||||
mUpdates.put(item.id, item.copy());
|
||||
|
||||
Reference in new issue
Block a user