Initial support for restore workspace from last stable db entry.
(see go/play-launcher-plan-launcher-implementation)
1. When Launcher launches for the first time, creates a backup
of the workspace before sanitizing db entries.
2. Creates a new path in LauncherProvider that triggers workspace
restore using last stable db entry of the same grid size.
3. When restore from backup created this way, the table will be
sanitized afterward.
Test:
1. apply on master, build & refresh on physical device
2. factory reset, go through SuW and perform restore
3. exit SuW without signing into Work Profile
4. run following commands in console
adb root
adb remount
adb pull
/data/data/com.google.android.apps.nexuslauncher/databases/launcher.db
sqlite3 ./launcher.db
.tables
SELECT * FROM favorites_bakup;
Bug: 141472083
Change-Id: I8032866a97eb333946d4f62352595d180364126b
diff --git a/src/com/android/launcher3/LauncherProvider.java b/src/com/android/launcher3/LauncherProvider.java
index 900c966..b589560 100644
--- a/src/com/android/launcher3/LauncherProvider.java
+++ b/src/com/android/launcher3/LauncherProvider.java
@@ -387,6 +387,11 @@
tableExists(mOpenHelper.getReadableDatabase(), Favorites.BACKUP_TABLE_NAME);
return null;
}
+ case LauncherSettings.Settings.METHOD_RESTORE_BACKUP_TABLE: {
+ RestoreDbTask.restoreIfPossible(
+ getContext(), mOpenHelper, new BackupManager(getContext()));
+ return null;
+ }
}
return null;
}