Enable support for same page hotseat migration

Bug: 142753423
Test: Manual
Change-Id: Ib53a64629a595c412e30ca5ff46077efc73a3f3e
This commit is contained in:
Samuel Fufa
2020-02-25 18:47:54 -08:00
parent d71c3b185d
commit a421143dd7
6 changed files with 145 additions and 46 deletions

View File

@@ -2783,6 +2783,26 @@ public class CellLayout extends ViewGroup implements Transposable {
return false;
}
/**
* Finds solution to accept hotseat migration to cell layout. commits solution if commitConfig
*/
public boolean makeSpaceForHotseatMigration(boolean commitConfig) {
if (FeatureFlags.HOTSEAT_MIGRATE_NEW_PAGE.get()) return false;
int[] cellPoint = new int[2];
int[] directionVector = new int[]{0, -1};
cellToPoint(0, mCountY, cellPoint);
ItemConfiguration configuration = new ItemConfiguration();
if (findReorderSolution(cellPoint[0], cellPoint[1], mCountX, 1, mCountX, 1,
directionVector, null, false, configuration).isSolution) {
if (commitConfig) {
copySolutionToTempState(configuration, null);
commitTempPlacement();
}
return true;
}
return false;
}
public boolean isRegionVacant(int x, int y, int spanX, int spanY) {
return mOccupied.isRegionVacant(x, y, spanX, spanY);
}