From 488529506f2b767aec0c6e122e7227a9ebe067a2 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Thu, 1 Dec 2011 14:34:23 -0500 Subject: Add copious navigation bar info to SystemUI dumps. Bug: 5549288 Change-Id: I8556584e6abd22912d55dccc27ccebb6602b1bcb --- .../statusbar/phone/NavigationBarView.java | 80 ++++++++++++++++++++++ .../systemui/statusbar/phone/PhoneStatusBar.java | 13 +++- 2 files changed, 90 insertions(+), 3 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java index 694da20..97a1855 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NavigationBarView.java @@ -20,6 +20,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.content.Context; import android.content.res.Resources; +import android.graphics.Rect; import android.os.ServiceManager; import android.util.AttributeSet; import android.util.Slog; @@ -32,6 +33,10 @@ import android.view.Surface; import android.view.WindowManager; import android.widget.LinearLayout; +import java.io.FileDescriptor; +import java.io.PrintWriter; +import java.lang.StringBuilder; + import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.R; @@ -237,4 +242,79 @@ public class NavigationBarView extends LinearLayout { Slog.d(TAG, "reorient(): rot=" + mDisplay.getRotation()); } } + + private String getResourceName(int resId) { + if (resId != 0) { + final android.content.res.Resources res = mContext.getResources(); + try { + return res.getResourceName(resId); + } catch (android.content.res.Resources.NotFoundException ex) { + return "(unknown)"; + } + } else { + return "(null)"; + } + } + + private static String visibilityToString(int vis) { + switch (vis) { + case View.INVISIBLE: + return "INVISIBLE"; + case View.GONE: + return "GONE"; + default: + return "VISIBLE"; + } + } + + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { + pw.println("NavigationBarView {"); + final Rect r = new Rect(); + + pw.println(String.format(" this: " + PhoneStatusBar.viewInfo(this) + + " " + visibilityToString(getVisibility()))); + + getWindowVisibleDisplayFrame(r); + final boolean offscreen = r.right > mDisplay.getRawWidth() + || r.bottom > mDisplay.getRawHeight(); + pw.println(" window: " + + r.toShortString() + + " " + visibilityToString(getWindowVisibility()) + + (offscreen ? " OFFSCREEN!" : "")); + + pw.println(String.format(" mCurrentView: id=%s (%dx%d) %s", + getResourceName(mCurrentView.getId()), + mCurrentView.getWidth(), mCurrentView.getHeight(), + visibilityToString(mCurrentView.getVisibility()))); + + pw.println(String.format(" disabled=0x%08x vertical=%s hidden=%s low=%s menu=%s", + mDisabledFlags, + mVertical ? "true" : "false", + mHidden ? "true" : "false", + mLowProfile ? "true" : "false", + mShowMenu ? "true" : "false")); + + final View back = getBackButton(); + final View home = getHomeButton(); + final View recent = getRecentsButton(); + final View menu = getMenuButton(); + + pw.println(" back: " + + PhoneStatusBar.viewInfo(back) + + " " + visibilityToString(back.getVisibility()) + ); + pw.println(" home: " + + PhoneStatusBar.viewInfo(home) + + " " + visibilityToString(home.getVisibility()) + ); + pw.println(" rcnt: " + + PhoneStatusBar.viewInfo(recent) + + " " + visibilityToString(recent.getVisibility()) + ); + pw.println(" menu: " + + PhoneStatusBar.viewInfo(menu) + + " " + visibilityToString(menu.getVisibility()) + ); + pw.println(" }"); + } } 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 f0093d3..c69a145 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -1735,9 +1735,9 @@ public class PhoneStatusBar extends StatusBar { return anim; } - public String viewInfo(View v) { - return "(" + v.getLeft() + "," + v.getTop() + ")(" + v.getRight() + "," + v.getBottom() - + " " + v.getWidth() + "x" + v.getHeight() + ")"; + public static String viewInfo(View v) { + return "[(" + v.getLeft() + "," + v.getTop() + ")(" + v.getRight() + "," + v.getBottom() + + ") " + v.getWidth() + "x" + v.getHeight() + "]"; } public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { @@ -1768,6 +1768,13 @@ public class PhoneStatusBar extends StatusBar { + " scroll " + mScrollView.getScrollX() + "," + mScrollView.getScrollY()); } + pw.print(" mNavigationBarView="); + if (mNavigationBarView == null) { + pw.println("null"); + } else { + mNavigationBarView.dump(fd, pw, args); + } + if (DUMPTRUCK) { synchronized (mNotificationData) { int N = mNotificationData.size(); -- cgit v1.1