|
20 | 20 | import android.animation.AnimatorListenerAdapter; |
21 | 21 | import android.content.Context; |
22 | 22 | import android.content.res.Resources; |
| 23 | +import android.graphics.Rect; |
23 | 24 | import android.os.ServiceManager; |
24 | 25 | import android.util.AttributeSet; |
25 | 26 | import android.util.Slog; |
|
32 | 33 | import android.view.WindowManager; |
33 | 34 | import android.widget.LinearLayout; |
34 | 35 |
|
| 36 | +import java.io.FileDescriptor; |
| 37 | +import java.io.PrintWriter; |
| 38 | +import java.lang.StringBuilder; |
| 39 | + |
35 | 40 | import com.android.internal.statusbar.IStatusBarService; |
36 | 41 |
|
37 | 42 | import com.android.systemui.R; |
@@ -237,4 +242,79 @@ public void reorient() { |
237 | 242 | Slog.d(TAG, "reorient(): rot=" + mDisplay.getRotation()); |
238 | 243 | } |
239 | 244 | } |
| 245 | + |
| 246 | + private String getResourceName(int resId) { |
| 247 | + if (resId != 0) { |
| 248 | + final android.content.res.Resources res = mContext.getResources(); |
| 249 | + try { |
| 250 | + return res.getResourceName(resId); |
| 251 | + } catch (android.content.res.Resources.NotFoundException ex) { |
| 252 | + return "(unknown)"; |
| 253 | + } |
| 254 | + } else { |
| 255 | + return "(null)"; |
| 256 | + } |
| 257 | + } |
| 258 | + |
| 259 | + private static String visibilityToString(int vis) { |
| 260 | + switch (vis) { |
| 261 | + case View.INVISIBLE: |
| 262 | + return "INVISIBLE"; |
| 263 | + case View.GONE: |
| 264 | + return "GONE"; |
| 265 | + default: |
| 266 | + return "VISIBLE"; |
| 267 | + } |
| 268 | + } |
| 269 | + |
| 270 | + public void dump(FileDescriptor fd, PrintWriter pw, String[] args) { |
| 271 | + pw.println("NavigationBarView {"); |
| 272 | + final Rect r = new Rect(); |
| 273 | + |
| 274 | + pw.println(String.format(" this: " + PhoneStatusBar.viewInfo(this) |
| 275 | + + " " + visibilityToString(getVisibility()))); |
| 276 | + |
| 277 | + getWindowVisibleDisplayFrame(r); |
| 278 | + final boolean offscreen = r.right > mDisplay.getRawWidth() |
| 279 | + || r.bottom > mDisplay.getRawHeight(); |
| 280 | + pw.println(" window: " |
| 281 | + + r.toShortString() |
| 282 | + + " " + visibilityToString(getWindowVisibility()) |
| 283 | + + (offscreen ? " OFFSCREEN!" : "")); |
| 284 | + |
| 285 | + pw.println(String.format(" mCurrentView: id=%s (%dx%d) %s", |
| 286 | + getResourceName(mCurrentView.getId()), |
| 287 | + mCurrentView.getWidth(), mCurrentView.getHeight(), |
| 288 | + visibilityToString(mCurrentView.getVisibility()))); |
| 289 | + |
| 290 | + pw.println(String.format(" disabled=0x%08x vertical=%s hidden=%s low=%s menu=%s", |
| 291 | + mDisabledFlags, |
| 292 | + mVertical ? "true" : "false", |
| 293 | + mHidden ? "true" : "false", |
| 294 | + mLowProfile ? "true" : "false", |
| 295 | + mShowMenu ? "true" : "false")); |
| 296 | + |
| 297 | + final View back = getBackButton(); |
| 298 | + final View home = getHomeButton(); |
| 299 | + final View recent = getRecentsButton(); |
| 300 | + final View menu = getMenuButton(); |
| 301 | + |
| 302 | + pw.println(" back: " |
| 303 | + + PhoneStatusBar.viewInfo(back) |
| 304 | + + " " + visibilityToString(back.getVisibility()) |
| 305 | + ); |
| 306 | + pw.println(" home: " |
| 307 | + + PhoneStatusBar.viewInfo(home) |
| 308 | + + " " + visibilityToString(home.getVisibility()) |
| 309 | + ); |
| 310 | + pw.println(" rcnt: " |
| 311 | + + PhoneStatusBar.viewInfo(recent) |
| 312 | + + " " + visibilityToString(recent.getVisibility()) |
| 313 | + ); |
| 314 | + pw.println(" menu: " |
| 315 | + + PhoneStatusBar.viewInfo(menu) |
| 316 | + + " " + visibilityToString(menu.getVisibility()) |
| 317 | + ); |
| 318 | + pw.println(" }"); |
| 319 | + } |
240 | 320 | } |
0 commit comments