OSDN Git Service

Dump frame history for bugreports
authorJohn Reck <jreck@google.com>
Tue, 13 Feb 2018 00:21:21 +0000 (16:21 -0800)
committerJohn Reck <jreck@google.com>
Tue, 13 Feb 2018 00:21:21 +0000 (16:21 -0800)
Can provide more insights into ANR reports that end in nSyncAndDrawFrame

Test: verified 'dumpsys gfxinfo <package>' didn't change, but that
bugreports did

Change-Id: I4e0e4b071f761e35bb6d6c9d8174b5bde3220d92

core/java/android/view/ThreadedRenderer.java

index 370c97e..e50d40e 100644 (file)
@@ -331,6 +331,7 @@ public final class ThreadedRenderer {
 
     private static final int FLAG_DUMP_FRAMESTATS   = 1 << 0;
     private static final int FLAG_DUMP_RESET        = 1 << 1;
+    private static final int FLAG_DUMP_ALL          = FLAG_DUMP_FRAMESTATS;
 
     @IntDef(flag = true, prefix = { "FLAG_DUMP_" }, value = {
             FLAG_DUMP_FRAMESTATS,
@@ -636,7 +637,10 @@ public final class ThreadedRenderer {
      */
     void dumpGfxInfo(PrintWriter pw, FileDescriptor fd, String[] args) {
         pw.flush();
-        int flags = 0;
+        // If there's no arguments, eg 'dumpsys gfxinfo', then dump everything.
+        // If there's a targetted package, eg 'dumpsys gfxinfo com.android.systemui', then only
+        // dump the summary information
+        int flags = (args == null || args.length == 0) ? FLAG_DUMP_ALL : 0;
         for (int i = 0; i < args.length; i++) {
             switch (args[i]) {
                 case "framestats":
@@ -645,6 +649,9 @@ public final class ThreadedRenderer {
                 case "reset":
                     flags |= FLAG_DUMP_RESET;
                     break;
+                case "-a": // magic option passed when dumping a bugreport.
+                    flags = FLAG_DUMP_ALL;
+                    break;
             }
         }
         nDumpProfileInfo(mNativeProxy, fd, flags);