Adding accessibility controls
> Adding 'Remove' option to workspace items
> Adding 'Add to workspace' to all apps and widget list items, which
adds the item to the first available space, giving preference to
the current workspace screen
> Adding 'App info' and 'Uninstall' options to appropriate items
Bug: 18482913
Change-Id: Ifab7423af2d9ba502b5a2771b37bb5436b3df937
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 7424d61..e6865b2 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -2981,11 +2981,11 @@
static boolean findVacantCell(int[] vacant, int spanX, int spanY,
int xCount, int yCount, boolean[][] occupied) {
- for (int y = 0; y < yCount; y++) {
- for (int x = 0; x < xCount; x++) {
+ for (int y = 0; (y + spanY) <= yCount; y++) {
+ for (int x = 0; (x + spanX) <= xCount; x++) {
boolean available = !occupied[x][y];
-out: for (int i = x; i < x + spanX - 1 && x < xCount; i++) {
- for (int j = y; j < y + spanY - 1 && y < yCount; j++) {
+out: for (int i = x; i < x + spanX; i++) {
+ for (int j = y; j < y + spanY; j++) {
available = available && !occupied[i][j];
if (!available) break out;
}