Register wm, am, cpuinfo, meminfo services with dumpsys priorities

Register services to be called as soon as a bug report is taken so relevant debug info can be captured.

dumpsys --priority CRITICAL times: adb shell dumpsys --priority CRITICAL | grep "was the duration"
0.005s was the duration of dumpsys SurfaceFlinger
0.002s was the duration of dumpsys cpuinfo
0.003s was the duration of dumpsys activity
0.025s was the duration of dumpsys window

Bug: 31774394

Test: adb shell setprop dumpstate.version "2.0-dev-priority-dumps" && \
                adb bugreport ~/tmp_new.zip
Test: adb shell dumpsys --priority CRITICAL
Test: adb shell dumpsys --priority HIGH
Test: adb shell dumpsys --priority NORMAL
Change-Id: Ic656a05dd9a838f0b13043b4387dae7b5c691f7e
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index ff45070..49dd5285 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -125,6 +125,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Future;
 
+import static android.os.IServiceManager.DUMP_PRIORITY_CRITICAL;
 import static android.view.Display.DEFAULT_DISPLAY;
 
 public final class SystemServer {
@@ -824,7 +825,8 @@
             wm = WindowManagerService.main(context, inputManager,
                     mFactoryTestMode != FactoryTest.FACTORY_TEST_LOW_LEVEL,
                     !mFirstBoot, mOnlyCore, new PhoneWindowManager());
-            ServiceManager.addService(Context.WINDOW_SERVICE, wm);
+            ServiceManager.addService(Context.WINDOW_SERVICE, wm, /* allowIsolated= */ false,
+                    DUMP_PRIORITY_CRITICAL);
             ServiceManager.addService(Context.INPUT_SERVICE, inputManager);
             traceEnd();