Loading services/core/java/com/android/server/Dumpable.javadeleted 100644 → 0 +0 −44 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.IndentingPrintWriter; /** * Interface used to dump {@link SystemServer} state that is not associated with any service. * * <p>See {@link SystemServer.SystemServerDumper} for usage example. */ // TODO(b/149254050): replace / merge with package android.util.Dumpable (it would require // exporting IndentingPrintWriter as @SystemApi) and/or changing the method to use a prefix public interface Dumpable { /** * Dumps the state. */ void dump(@NonNull IndentingPrintWriter pw, @Nullable String[] args); /** * Gets the name of the dumpable. * * <p>If not overridden, will return the simple class name. */ default String getDumpableName() { return Dumpable.this.getClass().getSimpleName(); } } services/core/java/com/android/server/SystemServerInitThreadPool.java +8 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.server; import android.annotation.NonNull; import android.os.Build; import android.os.Process; import android.util.IndentingPrintWriter; import android.util.Dumpable; import android.util.Slog; import com.android.internal.annotations.GuardedBy; Loading @@ -28,6 +28,7 @@ import com.android.internal.util.Preconditions; import com.android.server.am.ActivityManagerService; import com.android.server.utils.TimingsTraceAndSlog; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; Loading Loading @@ -196,7 +197,12 @@ public final class SystemServerInitThreadPool implements Dumpable { } @Override public void dump(IndentingPrintWriter pw, String[] args) { public String getDumpableName() { return SystemServerInitThreadPool.class.getSimpleName(); } @Override public void dump(PrintWriter pw, String[] args) { synchronized (LOCK) { pw.printf("has instance: %b\n", (sInstance != null)); } Loading services/core/java/com/android/server/SystemServiceManager.java +10 −5 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.util.ArraySet; import android.util.Dumpable; import android.util.EventLog; import android.util.IndentingPrintWriter; import android.util.Slog; import android.util.SparseArray; Loading @@ -44,6 +44,7 @@ import com.android.server.utils.TimingsTraceAndSlog; import dalvik.system.PathClassLoader; import java.io.File; import java.io.PrintWriter; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; Loading Loading @@ -687,7 +688,12 @@ public final class SystemServiceManager implements Dumpable { } @Override public void dump(IndentingPrintWriter pw, String[] args) { public String getDumpableName() { return SystemServiceManager.class.getSimpleName(); } @Override public void dump(PrintWriter pw, String[] args) { pw.printf("Current phase: %d\n", mCurrentPhase); synchronized (mTargetUsers) { if (mCurrentUser != null) { Loading @@ -711,14 +717,13 @@ public final class SystemServiceManager implements Dumpable { } } final int startedLen = mServices.size(); String prefix = " "; if (startedLen > 0) { pw.printf("%d started services:\n", startedLen); pw.increaseIndent(); for (int i = 0; i < startedLen; i++) { final SystemService service = mServices.get(i); pw.println(service.getClass().getCanonicalName()); pw.print(prefix); pw.println(service.getClass().getCanonicalName()); } pw.decreaseIndent(); } else { pw.println("No started services"); } Loading services/java/com/android/server/SystemServer.java +7 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import android.system.Os; import android.text.TextUtils; import android.util.ArrayMap; import android.util.DisplayMetrics; import android.util.Dumpable; import android.util.EventLog; import android.util.IndentingPrintWriter; import android.util.Pair; Loading Loading @@ -663,7 +664,12 @@ public final class SystemServer implements Dumpable { } @Override public void dump(IndentingPrintWriter pw, String[] args) { public String getDumpableName() { return SystemServer.class.getSimpleName(); } @Override public void dump(PrintWriter pw, String[] args) { pw.printf("Runtime restart: %b\n", mRuntimeRestart); pw.printf("Start count: %d\n", mStartCount); pw.print("Runtime start-up time: "); Loading Loading
services/core/java/com/android/server/Dumpable.javadeleted 100644 → 0 +0 −44 Original line number Diff line number Diff line /* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.server; import android.annotation.NonNull; import android.annotation.Nullable; import android.util.IndentingPrintWriter; /** * Interface used to dump {@link SystemServer} state that is not associated with any service. * * <p>See {@link SystemServer.SystemServerDumper} for usage example. */ // TODO(b/149254050): replace / merge with package android.util.Dumpable (it would require // exporting IndentingPrintWriter as @SystemApi) and/or changing the method to use a prefix public interface Dumpable { /** * Dumps the state. */ void dump(@NonNull IndentingPrintWriter pw, @Nullable String[] args); /** * Gets the name of the dumpable. * * <p>If not overridden, will return the simple class name. */ default String getDumpableName() { return Dumpable.this.getClass().getSimpleName(); } }
services/core/java/com/android/server/SystemServerInitThreadPool.java +8 −2 Original line number Diff line number Diff line Loading @@ -19,7 +19,7 @@ package com.android.server; import android.annotation.NonNull; import android.os.Build; import android.os.Process; import android.util.IndentingPrintWriter; import android.util.Dumpable; import android.util.Slog; import com.android.internal.annotations.GuardedBy; Loading @@ -28,6 +28,7 @@ import com.android.internal.util.Preconditions; import com.android.server.am.ActivityManagerService; import com.android.server.utils.TimingsTraceAndSlog; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import java.util.Objects; Loading Loading @@ -196,7 +197,12 @@ public final class SystemServerInitThreadPool implements Dumpable { } @Override public void dump(IndentingPrintWriter pw, String[] args) { public String getDumpableName() { return SystemServerInitThreadPool.class.getSimpleName(); } @Override public void dump(PrintWriter pw, String[] args) { synchronized (LOCK) { pw.printf("has instance: %b\n", (sInstance != null)); } Loading
services/core/java/com/android/server/SystemServiceManager.java +10 −5 Original line number Diff line number Diff line Loading @@ -27,8 +27,8 @@ import android.os.SystemClock; import android.os.Trace; import android.os.UserHandle; import android.util.ArraySet; import android.util.Dumpable; import android.util.EventLog; import android.util.IndentingPrintWriter; import android.util.Slog; import android.util.SparseArray; Loading @@ -44,6 +44,7 @@ import com.android.server.utils.TimingsTraceAndSlog; import dalvik.system.PathClassLoader; import java.io.File; import java.io.PrintWriter; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; Loading Loading @@ -687,7 +688,12 @@ public final class SystemServiceManager implements Dumpable { } @Override public void dump(IndentingPrintWriter pw, String[] args) { public String getDumpableName() { return SystemServiceManager.class.getSimpleName(); } @Override public void dump(PrintWriter pw, String[] args) { pw.printf("Current phase: %d\n", mCurrentPhase); synchronized (mTargetUsers) { if (mCurrentUser != null) { Loading @@ -711,14 +717,13 @@ public final class SystemServiceManager implements Dumpable { } } final int startedLen = mServices.size(); String prefix = " "; if (startedLen > 0) { pw.printf("%d started services:\n", startedLen); pw.increaseIndent(); for (int i = 0; i < startedLen; i++) { final SystemService service = mServices.get(i); pw.println(service.getClass().getCanonicalName()); pw.print(prefix); pw.println(service.getClass().getCanonicalName()); } pw.decreaseIndent(); } else { pw.println("No started services"); } Loading
services/java/com/android/server/SystemServer.java +7 −1 Original line number Diff line number Diff line Loading @@ -84,6 +84,7 @@ import android.system.Os; import android.text.TextUtils; import android.util.ArrayMap; import android.util.DisplayMetrics; import android.util.Dumpable; import android.util.EventLog; import android.util.IndentingPrintWriter; import android.util.Pair; Loading Loading @@ -663,7 +664,12 @@ public final class SystemServer implements Dumpable { } @Override public void dump(IndentingPrintWriter pw, String[] args) { public String getDumpableName() { return SystemServer.class.getSimpleName(); } @Override public void dump(PrintWriter pw, String[] args) { pw.printf("Runtime restart: %b\n", mRuntimeRestart); pw.printf("Start count: %d\n", mStartCount); pw.print("Runtime start-up time: "); Loading