OSDN Git Service

Dump fragments in sysui when dumping
authorJason Monk <jmonk@google.com>
Thu, 17 May 2018 14:56:00 +0000 (10:56 -0400)
committerJason Monk <jmonk@google.com>
Thu, 17 May 2018 14:56:00 +0000 (10:56 -0400)
Test: adb shell dumpsys activity service com.android.systemui, ensure
      the nav bar state shows up.
Fixes: 79881849

Change-Id: I13e6fb4c61c02cbd142e64b7201667e47fe31232

packages/SystemUI/src/com/android/systemui/fragments/FragmentService.java

index 9a8512d..f9bf4f5 100644 (file)
@@ -23,14 +23,18 @@ import android.util.Log;
 import android.view.View;
 
 import com.android.systemui.ConfigurationChangedReceiver;
+import com.android.systemui.Dumpable;
 import com.android.systemui.SystemUI;
 import com.android.systemui.SystemUIApplication;
 
+import java.io.FileDescriptor;
+import java.io.PrintWriter;
+
 /**
  * Holds a map of root views to FragmentHostStates and generates them as needed.
  * Also dispatches the configuration changes to all current FragmentHostStates.
  */
-public class FragmentService implements ConfigurationChangedReceiver {
+public class FragmentService implements ConfigurationChangedReceiver, Dumpable {
 
     private static final String TAG = "FragmentService";
 
@@ -65,6 +69,14 @@ public class FragmentService implements ConfigurationChangedReceiver {
         }
     }
 
+    @Override
+    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+        pw.println("Dumping fragments:");
+        for (FragmentHostState state : mHosts.values()) {
+            state.mFragmentHostManager.getFragmentManager().dump("  ", fd, pw, args);
+        }
+    }
+
     private class FragmentHostState {
         private final View mView;