From fef4d0e08185619d791cce1668468a8bc172999c Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 9 Sep 2021 18:24:51 +0100 Subject: [PATCH] Allow restore between TYPE_PHONE AND TYPE_MULTI_DISPLAY Bug: 199407109 Test: manual Change-Id: I6eb982a79f4130925a9d7e0972faf0f01a6aac20 --- src/com/android/launcher3/model/DeviceGridState.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/com/android/launcher3/model/DeviceGridState.java b/src/com/android/launcher3/model/DeviceGridState.java index 761053d2d0..1076e8834b 100644 --- a/src/com/android/launcher3/model/DeviceGridState.java +++ b/src/com/android/launcher3/model/DeviceGridState.java @@ -28,6 +28,7 @@ import android.text.TextUtils; import com.android.launcher3.InvariantDeviceProfile; import com.android.launcher3.Utilities; import com.android.launcher3.logging.StatsLogManager.LauncherEvent; +import com.android.launcher3.util.IntSet; import java.util.Locale; import java.util.Objects; @@ -44,6 +45,7 @@ public class DeviceGridState { public static final int TYPE_PHONE = 0; public static final int TYPE_MULTI_DISPLAY = 1; public static final int TYPE_TABLET = 2; + public static final IntSet COMPATIBLE_TYPES = IntSet.wrap(TYPE_PHONE, TYPE_MULTI_DISPLAY); private final String mGridSizeString; private final int mNumHotseat; @@ -109,7 +111,9 @@ public class DeviceGridState { if (o == null || getClass() != o.getClass()) return false; DeviceGridState that = (DeviceGridState) o; return mNumHotseat == that.mNumHotseat - && mDeviceType == that.mDeviceType + && (mDeviceType == that.mDeviceType + || (COMPATIBLE_TYPES.contains(mDeviceType) + && COMPATIBLE_TYPES.contains(that.mDeviceType))) && Objects.equals(mGridSizeString, that.mGridSizeString); } }