Setup infrastructure (multi-db support) for the new grid migration algorithm

We'll have a db for each grid option and a db for back up / restore.

TODO(pinyaoting): support back up / restore using the new infrastructure, particularly calls to GridBackupTable should use different DBs when the feature flag (NEW_GRID_MIGRATION_ALGORITHM) is on.

Bug: 144052802
Test: N/A

Change-Id: I644a3e70148bd78204a747a337446a3c038f616f
This commit is contained in:
Tracy Zhou
2020-01-27 13:44:06 -08:00
parent 328c9e5ac6
commit 7df93d28d4
14 changed files with 164 additions and 42 deletions

View File

@@ -19,6 +19,7 @@ package com.android.launcher3.model;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_LOCKED_USER;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SAFEMODE;
import static com.android.launcher3.ItemInfoWithIcon.FLAG_DISABLED_SUSPENDED;
import static com.android.launcher3.config.FeatureFlags.MULTI_DB_GRID_MIRATION_ALGO;
import static com.android.launcher3.model.ModelUtils.filterCurrentWorkspaceItems;
import static com.android.launcher3.util.Executors.MODEL_EXECUTOR;
import static com.android.launcher3.util.PackageManagerHelper.hasShortcutsPermission;
@@ -320,7 +321,9 @@ public class LoaderTask implements Runnable {
clearDb = true;
}
if (!clearDb && !GridSizeMigrationTask.migrateGridIfNeeded(context)) {
if (!clearDb && (MULTI_DB_GRID_MIRATION_ALGO.get()
? !GridSizeMigrationTaskV2.migrateGridIfNeeded(context)
: !GridSizeMigrationTask.migrateGridIfNeeded(context))) {
// Migration failed. Clear workspace.
clearDb = true;
}