diff options
3 files changed, 62 insertions, 9 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index cdc51d1..51fd346 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -3926,10 +3926,9 @@ public final class ViewRootImpl implements ViewParent, } public void dumpGfxInfo(int[] info) { + info[0] = info[1] = 0; if (mView != null) { getGfxInfo(mView, info); - } else { - info[0] = info[1] = 0; } } diff --git a/core/java/android/view/WindowManagerImpl.java b/core/java/android/view/WindowManagerImpl.java index 5d33cec..dd6b537 100644 --- a/core/java/android/view/WindowManagerImpl.java +++ b/core/java/android/view/WindowManagerImpl.java @@ -530,13 +530,16 @@ public class WindowManagerImpl implements WindowManager { for (int i = 0; i < count; i++) { ViewRootImpl root = mRoots[i]; + String name = getWindowName(root); + pw.printf("\n\t%s", name); + HardwareRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer; if (renderer != null) { renderer.dumpGfxInfo(pw); } } - pw.println("\nView hierarchy:"); + pw.println("\nView hierarchy:\n"); int viewsCount = 0; int displayListsSize = 0; @@ -546,15 +549,14 @@ public class WindowManagerImpl implements WindowManager { ViewRootImpl root = mRoots[i]; root.dumpGfxInfo(info); - String name = root.getClass().getName() + '@' + - Integer.toHexString(hashCode()); - pw.printf(" %s: %d views, %.2f kB (display lists)", + String name = getWindowName(root); + pw.printf(" %s\n %d views, %.2f kB of display lists", name, info[0], info[1] / 1024.0f); HardwareRenderer renderer = root.getView().mAttachInfo.mHardwareRenderer; if (renderer != null) { pw.printf(", %d frames rendered", renderer.getFrameCount()); } - pw.printf("\n"); + pw.printf("\n\n"); viewsCount += info[0]; displayListsSize += info[1]; @@ -570,6 +572,11 @@ public class WindowManagerImpl implements WindowManager { } } + private static String getWindowName(ViewRootImpl root) { + return root.mWindowAttributes.getTitle() + "/" + + root.getClass().getName() + '@' + Integer.toHexString(root.hashCode()); + } + public void setStoppedState(IBinder token, boolean stopped) { synchronized (this) { if (mViews == null) 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); |