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

Commit 971da6c3 authored by Andras Kloczl's avatar Andras Kloczl
Browse files

Add logging to catch rare launcher wipe issue

Test: not necessary
Bug: 200010396
Change-Id: If7c478e220c2c0ee9f6479b18bf05bf39811b451
parent da76a1de
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -119,12 +119,23 @@ public class DeviceGridState {
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        DeviceGridState that = (DeviceGridState) o;
        return mNumHotseat == that.mNumHotseat
                && deviceTypeCompatible(mDeviceType, that.mDeviceType)
                && Objects.equals(mGridSizeString, that.mGridSizeString);
    public String toString() {
        return "DeviceGridState{"
                + "mGridSizeString='" + mGridSizeString + '\''
                + ", mNumHotseat=" + mNumHotseat
                + ", mDeviceType=" + mDeviceType
                + '}';
    }

    /**
     * Returns true if the database from another DeviceGridState can be loaded into the current
     * DeviceGridState without migration, or false otherwise.
     */
    public boolean isCompatible(DeviceGridState other) {
        if (this == other) return true;
        if (other == null) return false;
        return mNumHotseat == other.mNumHotseat
                && deviceTypeCompatible(mDeviceType, other.mDeviceType)
                && Objects.equals(mGridSizeString, other.mGridSizeString);
    }
}
+7 −1
Original line number Diff line number Diff line
@@ -103,7 +103,13 @@ public class GridSizeMigrationTaskV2 {
     * Check given a new IDP, if migration is necessary.
     */
    public static boolean needsToMigrate(Context context, InvariantDeviceProfile idp) {
        return !new DeviceGridState(idp).equals(new DeviceGridState(context));
        DeviceGridState idpGridState = new DeviceGridState(idp);
        DeviceGridState contextGridState = new DeviceGridState(context);
        boolean needsToMigrate = !idpGridState.isCompatible(contextGridState);
        // TODO: Revert this change after b/200010396 is fixed
        Log.d(TAG, "Migration is needed. idpGridState: " + idpGridState
                + ", contextGridState: " + contextGridState);
        return needsToMigrate;
    }

    /** See {@link #migrateGridIfNeeded(Context, InvariantDeviceProfile)} */