Special handling when a db for one grid option is not setup yet

- Init KEY_MIGRATION_SRC_WORKSPACE_SIZE and KEY_MIGRATION_SRC_HOTSEAT_COUNT
- Load default workspace only when default db is created, not when peeking into dbs of other grid options during grid preview / migration

Fixes: 154184711
Test: run grid preview and migration right after a cleared cache Pixel Launcher
Change-Id: I86c7072b8c4a9da76e289c55ab440071f192fc38
This commit is contained in:
Tracy Zhou
2020-04-20 01:13:26 -07:00
parent 1bb37acb5d
commit ed5f3082b0
6 changed files with 34 additions and 30 deletions
@@ -1,5 +1,7 @@
package com.android.launcher3.model;
import static com.android.launcher3.InvariantDeviceProfile.KEY_MIGRATION_SRC_HOTSEAT_COUNT;
import static com.android.launcher3.InvariantDeviceProfile.KEY_MIGRATION_SRC_WORKSPACE_SIZE;
import static com.android.launcher3.LauncherSettings.Settings.EXTRA_VALUE;
import static com.android.launcher3.Utilities.getPointString;
import static com.android.launcher3.Utilities.parsePoint;
@@ -53,9 +55,6 @@ public class GridSizeMigrationTask {
private static final String TAG = "GridSizeMigrationTask";
private static final boolean DEBUG = true;
private static final String KEY_MIGRATION_SRC_WORKSPACE_SIZE = "migration_src_workspace_size";
private static final String KEY_MIGRATION_SRC_HOTSEAT_COUNT = "migration_src_hotseat_count";
// These are carefully selected weights for various item types (Math.random?), to allow for
// the least absurd migration experience.
private static final float WT_SHORTCUT = 1;
@@ -894,8 +893,7 @@ public class GridSizeMigrationTask {
String gridSizeString = getPointString(idp.numColumns, idp.numRows);
return !gridSizeString.equals(prefs.getString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, ""))
|| idp.numHotseatIcons != prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT,
idp.numHotseatIcons);
|| idp.numHotseatIcons != prefs.getInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, -1);
}
/** See {@link #migrateGridIfNeeded(Context, InvariantDeviceProfile)} */