diff --git a/src/com/android/launcher3/InvariantDeviceProfile.java b/src/com/android/launcher3/InvariantDeviceProfile.java index 7acba753ff..1b38695acf 100644 --- a/src/com/android/launcher3/InvariantDeviceProfile.java +++ b/src/com/android/launcher3/InvariantDeviceProfile.java @@ -52,7 +52,6 @@ import androidx.core.content.res.ResourcesCompat; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.icons.DotRenderer; -import com.android.launcher3.logging.FileLog; import com.android.launcher3.model.DeviceGridState; import com.android.launcher3.provider.RestoreDbTask; import com.android.launcher3.testing.shared.ResourceUtils; @@ -303,35 +302,6 @@ public class InvariantDeviceProfile implements SafeCloseable { DisplayController.INSTANCE.executeIfCreated(dc -> dc.setPriorityListener(null)); } - /** - * Reinitialize the current grid after a restore, where some grids might now be disabled. - */ - public void reinitializeAfterRestore(Context context) { - String currentGridName = getCurrentGridName(context); - String currentDbFile = dbFile; - String newGridName = initGrid(context, currentGridName); - String newDbFile = dbFile; - FileLog.d(TAG, "Reinitializing grid after restore." - + " currentGridName=" + currentGridName - + ", currentDbFile=" + currentDbFile - + ", newGridName=" + newGridName - + ", newDbFile=" + newDbFile); - if (!newDbFile.equals(currentDbFile)) { - FileLog.d(TAG, "Restored grid is disabled : " + currentGridName - + ", migrating to: " + newGridName - + ", removing all other grid db files"); - for (String gridDbFile : LauncherFiles.GRID_DB_FILES) { - if (gridDbFile.equals(currentDbFile)) { - continue; - } - if (context.getDatabasePath(gridDbFile).delete()) { - FileLog.d(TAG, "Removed old grid db file: " + gridDbFile); - } - } - setCurrentGrid(context, newGridName); - } - } - public static String getCurrentGridName(Context context) { return LauncherPrefs.get(context).get(GRID_NAME); } diff --git a/src/com/android/launcher3/model/GridSizeMigrationDBController.java b/src/com/android/launcher3/model/GridSizeMigrationDBController.java index bad7577fc3..bef2e3b92e 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationDBController.java +++ b/src/com/android/launcher3/model/GridSizeMigrationDBController.java @@ -38,7 +38,6 @@ import android.util.Log; import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; -import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherPrefs; import com.android.launcher3.LauncherSettings; @@ -129,7 +128,6 @@ public class GridSizeMigrationDBController { } if (LauncherPrefs.get(context).get(IS_FIRST_LOAD_AFTER_RESTORE) - && Flags.enableGridMigrationFix() && srcDeviceState.getColumns().equals(destDeviceState.getColumns()) && srcDeviceState.getRows() < destDeviceState.getRows()) { Log.i("b/360462379", "Grid migration fix entry point."); diff --git a/src/com/android/launcher3/model/GridSizeMigrationLogic.kt b/src/com/android/launcher3/model/GridSizeMigrationLogic.kt index 9470abf11d..07316ef0ee 100644 --- a/src/com/android/launcher3/model/GridSizeMigrationLogic.kt +++ b/src/com/android/launcher3/model/GridSizeMigrationLogic.kt @@ -339,7 +339,7 @@ class GridSizeMigrationLogic { srcDeviceState: DeviceGridState, destDeviceState: DeviceGridState, ): Boolean { - return (isFirstLoad && Flags.enableGridMigrationFix()) && + return isFirstLoad && srcDeviceState.columns == destDeviceState.columns && srcDeviceState.rows < destDeviceState.rows } diff --git a/src/com/android/launcher3/provider/RestoreDbTask.java b/src/com/android/launcher3/provider/RestoreDbTask.java index 59c27af6da..8db981f26a 100644 --- a/src/com/android/launcher3/provider/RestoreDbTask.java +++ b/src/com/android/launcher3/provider/RestoreDbTask.java @@ -51,7 +51,6 @@ import androidx.annotation.NonNull; import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; -import com.android.launcher3.Flags; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.LauncherAppState; import com.android.launcher3.LauncherFiles; @@ -124,18 +123,14 @@ public class RestoreDbTask { // executed again. LauncherPrefs.get(context).removeSync(RESTORE_DEVICE); - if (Flags.enableNarrowGridRestore()) { - DeviceGridState deviceGridState = new DeviceGridState(context); - String oldPhoneFileName = deviceGridState.getDbFile(); - List previousDbs = existingDbs(context); - removeOldDBs(context, oldPhoneFileName); - // The idp before this contains data about the old phone, after this it becomes the idp - // of the current phone. - idp.reset(context); - trySettingPreviousGridAsCurrent(context, idp, oldPhoneFileName, previousDbs); - } else { - idp.reinitializeAfterRestore(context); - } + DeviceGridState deviceGridState = new DeviceGridState(context); + String oldPhoneFileName = deviceGridState.getDbFile(); + List previousDbs = existingDbs(context); + removeOldDBs(context, oldPhoneFileName); + // The idp before this contains data about the old phone, after this it becomes the idp + // of the current phone. + idp.reset(context); + trySettingPreviousGridAsCurrent(context, idp, oldPhoneFileName, previousDbs); }