Merge "Add logging to catch rare launcher wipe issue" into sc-v2-dev am: 25e84690b3
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/15839769 Change-Id: Ifb26c8168e31336f4591cfcbde66c5376b69dafc
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)} */
|
||||
|
||||
Reference in New Issue
Block a user