Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df7d2b08 authored by Sebastian Franco's avatar Sebastian Franco
Browse files

Set default grid when doing a backup and restore

When restoring from a tablet because phones don't have
the same table some issues can ocure because we setup a
non valid grid, the correct thing is to setup a default.

Bug: 325285743
Fix: 332964986
Flag: ACONFIG narrow_grid_restore enabled
Test: BackupAndRestoreDBSelectionTest
Change-Id: I28bf02e83dddf5ae84818d879a5e21600eddf67e
parent 03c55c55
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -359,6 +359,15 @@ public class InvariantDeviceProfile {
        return displayOption.grid.name;
    }

    /**
     * @deprecated This is a temporary solution because on the backup and restore case we modify the
     * IDP, this resets it. b/332974074
     */
    @Deprecated
    public void reset(Context context) {
        initGrid(context, getCurrentGridName(context));
    }

    @VisibleForTesting
    public static String getDefaultGridName(Context context) {
        return new InvariantDeviceProfile().initGrid(context, null);
+3 −0
Original line number Diff line number Diff line
@@ -126,6 +126,9 @@ public class RestoreDbTask {
        if (Flags.enableNarrowGridRestore()) {
            String oldPhoneFileName = idp.dbFile;
            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);
            trySettingPreviousGidAsCurrent(context, idp, oldPhoneFileName);
        } else {
            idp.reinitializeAfterRestore(context);