diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-08-17 15:18:29 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2012-08-17 17:35:00 -0700 |
commit | 4702a856973a553deb82f71b1d3b6c3db5dbf4ba (patch) | |
tree | 355aaea84ebfa78d9e712c1b46fb257e55000d0f /core/java/android/app/Activity.java | |
parent | 79af1dd54c16cde063152922b42c96d72ae9eca8 (diff) | |
download | frameworks_base-4702a856973a553deb82f71b1d3b6c3db5dbf4ba.zip frameworks_base-4702a856973a553deb82f71b1d3b6c3db5dbf4ba.tar.gz frameworks_base-4702a856973a553deb82f71b1d3b6c3db5dbf4ba.tar.bz2 |
More view hierarchy, fragment debugging.
Add a View.toString() method.
Rename all of the View private flags to have a PFLAG prefix to
avoid going insane trying to figure out which constant goes with
which flag.
Activity.dump() now includes a summary of the activity's view
hierarchy, using the View.toString() method.
All exceptions thrown by FragmentManager now perform a dump of
the owning activity state, where appropriate.
Change-Id: I6482e397e10cb5a0612ab02ce6ed5131823437a6
Diffstat (limited to 'core/java/android/app/Activity.java')
-rw-r--r-- | core/java/android/app/Activity.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index 809acac..77107ee 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -4733,6 +4733,29 @@ public class Activity extends ContextThemeWrapper mLoaderManager.dump(prefix + " ", fd, writer, args); } mFragments.dump(prefix, fd, writer, args); + writer.print(prefix); writer.println("View Hierarchy:"); + dumpViewHierarchy(prefix + " ", writer, getWindow().getDecorView()); + } + + private void dumpViewHierarchy(String prefix, PrintWriter writer, View view) { + writer.print(prefix); + if (view == null) { + writer.println("null"); + return; + } + writer.println(view.toString()); + if (!(view instanceof ViewGroup)) { + return; + } + ViewGroup grp = (ViewGroup)view; + final int N = grp.getChildCount(); + if (N <= 0) { + return; + } + prefix = prefix + " "; + for (int i=0; i<N; i++) { + dumpViewHierarchy(prefix, writer, grp.getChildAt(i)); + } } /** |