Refactor grid migration

In this CL:
-Make GridsizeMigrationLogic functions pure (no side effects)
-Make it so GridSizeMigrationLogic contains the migration logic and does NOT interact with the database
-Let GridSizeMigrationUtil receive the results from the logic layer and use those results to interact with the database appropriately

In future CLs:
-Refactor GridSizeMigrationLogic to Kotlin

Bug: 358399271
Flag: com.android.launcher3.grid_migration_refactor
Test: GridSizeMigrationTest
Change-Id: Ifcc5ca356558a7463352580f2e89eef8c86ed16b
This commit is contained in:
fbaron
2024-08-08 11:45:29 -07:00
committed by Federico Baron
parent 8e7ab8d282
commit a796d74e36
12 changed files with 1060 additions and 239 deletions
@@ -435,7 +435,15 @@ public class LoaderTask implements Runnable {
final WidgetInflater widgetInflater = new WidgetInflater(context);
ModelDbController dbController = mApp.getModel().getModelDbController();
dbController.tryMigrateDB(restoreEventLogger);
if (Flags.gridMigrationRefactor()) {
try {
dbController.attemptMigrateDb(restoreEventLogger);
} catch (Exception e) {
FileLog.e(TAG, "Failed to migrate grid", e);
}
} else {
dbController.tryMigrateDB(restoreEventLogger);
}
Log.d(TAG, "loadWorkspace: loading default favorites");
dbController.loadDefaultFavoritesIfNecessary();