Add ability to dump specific dependency controller
Bug: 130804868
Test: adb shell dumpsys activity service SystemUIService Dependency OverviewProxyService
Change-Id: Ie88f62d0d0b17ded6f8ff5d3d850f1f444eed444
diff --git a/packages/SystemUI/src/com/android/systemui/Dependency.java b/packages/SystemUI/src/com/android/systemui/Dependency.java
index a421940..4b338f7 100644
--- a/packages/SystemUI/src/com/android/systemui/Dependency.java
+++ b/packages/SystemUI/src/com/android/systemui/Dependency.java
@@ -484,8 +484,18 @@
// with Dependency#get.
getDependency(DumpController.class);
- pw.println("Dumping existing controllers:");
- mDependencies.values().stream().filter(obj -> obj instanceof Dumpable)
+ // If an arg is specified, try to dump the dependency
+ String controller = args != null && args.length > 1
+ ? args[1].toLowerCase()
+ : null;
+ if (controller != null) {
+ pw.println("Dumping controller=" + controller + ":");
+ } else {
+ pw.println("Dumping existing controllers:");
+ }
+ mDependencies.values().stream()
+ .filter(obj -> obj instanceof Dumpable && (controller == null
+ || obj.getClass().getName().toLowerCase().endsWith(controller)))
.forEach(o -> ((Dumpable) o).dump(fd, pw, args));
}