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 authored and Federico Baron committed 2024-10-23 22:26:38 +00:00
1 parent 8e7ab8d282
commit a796d74e36
12 files changed
+1060 -239

No files matched your search

@@ -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();