diff options
author | Romain Guy <romainguy@google.com> | 2012-06-14 12:52:53 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2012-06-14 14:25:08 -0700 |
commit | 54ab347fdde0e4d14d923cca80e5bcc7b879fc52 (patch) | |
tree | d26e29f10f1352dfc396560db2ab1f68b3f61b2e /packages | |
parent | 15c9c6141a00cd91290928bce742a2ae6761aca2 (diff) | |
download | frameworks_base-54ab347fdde0e4d14d923cca80e5bcc7b879fc52.zip frameworks_base-54ab347fdde0e4d14d923cca80e5bcc7b879fc52.tar.gz frameworks_base-54ab347fdde0e4d14d923cca80e5bcc7b879fc52.tar.bz2 |
Don't create a giant layer for all notifications
Bug #6642475
When expanding the status bar, create one layer per notification instead of
a single giant layer for the pile of notifications. This prevents layer
creation failure when the total height of the notifications is larger
than the maximum allowed texture size in OpenGL ES 2.0.
This change only enables layers on notifications that will be visible
once the notification area is fully expanded.
Change-Id: I3c791a66cf5ac0973f3a65cfcd84b95209d580f3
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java | 51 |
1 files changed, 49 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index baf86f3..393ff0b 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1376,12 +1376,59 @@ public class PhoneStatusBar extends BaseStatusBar { if (!mTracking) return; mTracking = false; - mPile.setLayerType(View.LAYER_TYPE_NONE, null); + setPileLayers(View.LAYER_TYPE_NONE); mVelocityTracker.recycle(); mVelocityTracker = null; mCloseView.setPressed(false); } + /** + * Enables or disables layers on the children of the notifications pile. + * + * When layers are enabled, this method attempts to enable layers for the minimal + * number of children. Only children visible when the notification area is fully + * expanded will receive a layer. The technique used in this method might cause + * more children than necessary to get a layer (at most one extra child with the + * current UI.) + * + * @param layerType {@link View#LAYER_TYPE_NONE} or {@link View#LAYER_TYPE_HARDWARE} + */ + private void setPileLayers(int layerType) { + final int count = mPile.getChildCount(); + + switch (layerType) { + case View.LAYER_TYPE_NONE: + for (int i = 0; i < count; i++) { + mPile.getChildAt(i).setLayerType(layerType, null); + } + break; + case View.LAYER_TYPE_HARDWARE: + final int[] location = new int[2]; + mNotificationPanel.getLocationInWindow(location); + + final int left = location[0]; + final int top = location[1]; + final int right = left + mNotificationPanel.getWidth(); + final int bottom = top + getExpandedViewMaxHeight(); + + final Rect childBounds = new Rect(); + + for (int i = 0; i < count; i++) { + final View view = mPile.getChildAt(i); + view.getLocationInWindow(location); + + childBounds.set(location[0], location[1], + location[0] + view.getWidth(), location[1] + view.getHeight()); + + if (childBounds.intersects(left, top, right, bottom)) { + view.setLayerType(layerType, null); + } + } + + break; + } + } + void incrementAnim(long frameTimeNanos) { final long deltaNanos = Math.max(frameTimeNanos - mAnimLastTimeNanos, 0); final float t = deltaNanos * 0.000000001f; // ns -> s @@ -1421,7 +1468,7 @@ public class PhoneStatusBar extends BaseStatusBar { mCloseView.setPressed(true); mTracking = true; - mPile.setLayerType(View.LAYER_TYPE_HARDWARE, null); + setPileLayers(View.LAYER_TYPE_HARDWARE); mVelocityTracker = VelocityTracker.obtain(); if (opening) { makeExpandedVisible(true); |