summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-06-14 14:32:07 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-06-14 14:32:07 -0700
commita989b334fd097114ce1016ce1668597a213a441c (patch)
tree77b97302377cff26f18b9e25a0a506ee1d826a44 /packages/SystemUI/src/com/android/systemui
parentd2ee4960c492259665adc2c6630e1a59642677b9 (diff)
parent54ab347fdde0e4d14d923cca80e5bcc7b879fc52 (diff)
downloadframeworks_base-a989b334fd097114ce1016ce1668597a213a441c.zip
frameworks_base-a989b334fd097114ce1016ce1668597a213a441c.tar.gz
frameworks_base-a989b334fd097114ce1016ce1668597a213a441c.tar.bz2
Merge "Don't create a giant layer for all notifications Bug #6642475" into jb-dev
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java51
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);