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

View File

@@ -17,6 +17,7 @@
package com.android.launcher3;
import static com.android.launcher3.Utilities.getDevicePrefs;
import static com.android.launcher3.Utilities.getPointString;
import static com.android.launcher3.config.FeatureFlags.APPLY_CONFIG_AT_RUNTIME;
import static com.android.launcher3.settings.SettingsActivity.GRID_OPTIONS_PREFERENCE_KEY;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;
@@ -69,6 +70,9 @@ public class InvariantDeviceProfile {
public static final MainThreadInitializedObject<InvariantDeviceProfile> INSTANCE =
new MainThreadInitializedObject<>(InvariantDeviceProfile::new);
public static final String KEY_MIGRATION_SRC_WORKSPACE_SIZE = "migration_src_workspace_size";
public static final String KEY_MIGRATION_SRC_HOTSEAT_COUNT = "migration_src_hotseat_count";
private static final String KEY_IDP_GRID_NAME = "idp_grid_name";
private static final float ICON_SIZE_DEFINED_IN_APP_DP = 48;
@@ -165,6 +169,10 @@ public class InvariantDeviceProfile {
if (!newGridName.equals(gridName)) {
Utilities.getPrefs(context).edit().putString(KEY_IDP_GRID_NAME, newGridName).apply();
}
Utilities.getPrefs(context).edit()
.putInt(KEY_MIGRATION_SRC_HOTSEAT_COUNT, numHotseatIcons)
.putString(KEY_MIGRATION_SRC_WORKSPACE_SIZE, getPointString(numColumns, numRows))
.apply();
mConfigMonitor = new ConfigMonitor(context,
APPLY_CONFIG_AT_RUNTIME.get() ? this::onConfigChanged : this::killProcess);