Supporting custom widgets provided by launcher
-> This change provides integration for widgets provided by
the launcher package which can run arbitrary code.
Change-Id: I6052da5c4afed7ee72e3b44d045b9c46f2d84c42
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 0ff1ef4..7424d61 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -592,7 +592,7 @@
}
public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
- boolean markCells) {
+ boolean markCells, boolean inLayout) {
final LayoutParams lp = params;
// Hotseat icons - remove text
@@ -613,8 +613,11 @@
if (lp.cellVSpan < 0) lp.cellVSpan = mCountY;
child.setId(childId);
-
- mShortcutsAndWidgets.addView(child, index, lp);
+ if (inLayout) {
+ mShortcutsAndWidgets.addView(child, index, lp, true);
+ } else {
+ mShortcutsAndWidgets.addView(child, index, lp, false);
+ }
if (markCells) markCellsAsOccupiedForView(child);
@@ -623,6 +626,11 @@
return false;
}
+ public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params,
+ boolean markCells) {
+ return addViewToCellLayout(child, index, childId, params, markCells, false);
+ }
+
@Override
public void removeAllViews() {
clearOccupiedCells();