diff options
author | Michael Jurka <mikejurka@google.com> | 2011-08-11 18:05:24 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2011-08-11 18:05:24 -0700 |
commit | b8d0e1c3b329a3be07adb261b7b4031e87b6d70c (patch) | |
tree | 1d443120af5edf2db29b19711336a0565ddebf25 | |
parent | 2d96b970b67665ca290cb3776385cc1e354e313d (diff) | |
download | android_packages_apps_Trebuchet-b8d0e1c3b329a3be07adb261b7b4031e87b6d70c.tar.gz android_packages_apps_Trebuchet-b8d0e1c3b329a3be07adb261b7b4031e87b6d70c.tar.bz2 android_packages_apps_Trebuchet-b8d0e1c3b329a3be07adb261b7b4031e87b6d70c.zip |
Reducing HW layer usage on non-large devices
- On phones, we set HW layers on the workspace items themselves, which doesn't cost any performance
- On tablets this approach costs 5-6 FPS in the worst case when swiping pages so we stay with the old approach of enabling HW layers on the entire workspace page
Change-Id: I3626ea14844c3e4444cf79232dbde396840b1804
-rw-r--r-- | src/com/android/launcher2/CellLayout.java | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java index a17e2d604..6f59d1f3c 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -292,8 +292,20 @@ public class CellLayout extends ViewGroup { return minGap * (numCells - 1) + cellHeight * numCells; } + @Override + public void setChildrenLayersEnabled(boolean enabled) { + // see "Hardware Layer Note" lower in the code + if (LauncherApplication.isScreenLarge()) { + super.setChildrenLayersEnabled(enabled); + } else { + mChildren.setChildrenLayersEnabled(enabled); + } + } public void enableHardwareLayers() { - mChildren.enableHardwareLayers(); + // see "Hardware Layer Note" lower in the code + if (LauncherApplication.isScreenLarge()) { + mChildren.enableHardwareLayers(); + } } public void setGridSize(int x, int y) { @@ -638,6 +650,16 @@ public class CellLayout extends ViewGroup { child.setId(childId); + if (!LauncherApplication.isScreenLarge()) { + // Hardware Layer Note: + // On phones, we set hardware layers on individual items + // On tablets, we set hardware layers on the entire mChildren view + // Setting the hardware layers on individual items only uses + // less memory but on tablet-size devices it has worse performance + // (a drop of ~6fps) whereas on phones the performance is the same + // with both approaches + child.setLayerType(LAYER_TYPE_HARDWARE, null); + } mChildren.addView(child, index, lp); if (markCells) markCellsAsOccupiedForView(child); |