Reducing memory impact of hardware layers in Launcher
- Disabling hardware layers in customize tray
- Destroying hardware layers for pages in All Apps that are not visible
- Re-adding CachedTextView for icons in customize tray (to regain some of the lost performance there)
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 96b0551..45baa6c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -596,7 +596,21 @@
canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
mScrollY + mBottom - mTop);
+ for (int i = 0; i < pageCount; i++) {
+ View child = getChildAt(i);
+ if (child != null && child instanceof PagedViewCellLayout) {
+ boolean willBeDrawn = i >= leftScreen && i <= rightScreen;
+ if (!willBeDrawn) {
+ ((PagedViewCellLayout)child).destroyHardwareLayers();
+ }
+ }
+ }
+
for (int i = leftScreen; i <= rightScreen; i++) {
+ View child = getChildAt(i);
+ if (child != null && child instanceof PagedViewCellLayout) {
+ ((PagedViewCellLayout)child).createHardwareLayers();
+ }
drawChild(canvas, getChildAt(i), drawingTime);
}
canvas.restore();