In the case the gird migration goes to a taller grid keep the grid configuration
For example going from 4x5 to 4x6 it will keep the 4x5 configuration which fits in the 4x6 grid. Also, it fixes GridMigrationTest which was flaky because of how it sorted arrays. Bug: 325286145 Flag: ACONFIG grid_migration_fix disabled Test: NA (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:2eaf15c37a051fd17c18c4443a8bd19d39057bf0) Merged-In: I6063e3c303320096f7429a3b1d909e107d2ef2a0 Change-Id: I6063e3c303320096f7429a3b1d909e107d2ef2a0
This commit is contained in:
committed by
Cherrypicker Worker
parent
87fbc2e02e
commit
f5a2e75100
@@ -40,6 +40,7 @@ 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;
|
||||
@@ -122,6 +123,16 @@ public class GridSizeMigrationUtil {
|
||||
if (!needsToMigrate(srcDeviceState, destDeviceState)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Flags.gridMigrationFix()
|
||||
&& srcDeviceState.getColumns().equals(destDeviceState.getColumns())
|
||||
&& srcDeviceState.getRows() < destDeviceState.getRows()) {
|
||||
// Only use this strategy when comparing the previous grid to the new grid and the
|
||||
// columns are the same and the destination has more rows
|
||||
copyTable(source, TABLE_NAME, target.getWritableDatabase(), TABLE_NAME, context);
|
||||
destDeviceState.writeToPrefs(context);
|
||||
return true;
|
||||
}
|
||||
copyTable(source, TABLE_NAME, target.getWritableDatabase(), TMP_TABLE, context);
|
||||
|
||||
HashSet<String> validPackages = getValidPackages(context);
|
||||
|
||||
Reference in New Issue
Block a user