Merge "Remove hidden APIs usage regarding to dump" am: f4956c7502 am: 9ffb4d5e8b
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1622625 MUST ONLY BE SUBMITTED BY AUTOMERGER Change-Id: I4152e7cfdc14d4372319e66a67b117a94aedc80b
This commit is contained in:
@@ -217,7 +217,6 @@ import com.android.server.connectivity.PermissionMonitor;
|
|||||||
import com.android.server.connectivity.ProxyTracker;
|
import com.android.server.connectivity.ProxyTracker;
|
||||||
import com.android.server.connectivity.QosCallbackTracker;
|
import com.android.server.connectivity.QosCallbackTracker;
|
||||||
import com.android.server.net.NetworkPolicyManagerInternal;
|
import com.android.server.net.NetworkPolicyManagerInternal;
|
||||||
import com.android.server.utils.PriorityDump;
|
|
||||||
|
|
||||||
import libcore.io.IoUtils;
|
import libcore.io.IoUtils;
|
||||||
|
|
||||||
@@ -884,27 +883,59 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
private final LegacyTypeTracker mLegacyTypeTracker = new LegacyTypeTracker(this);
|
private final LegacyTypeTracker mLegacyTypeTracker = new LegacyTypeTracker(this);
|
||||||
|
|
||||||
|
final LocalPriorityDump mPriorityDumper = new LocalPriorityDump();
|
||||||
/**
|
/**
|
||||||
* Helper class which parses out priority arguments and dumps sections according to their
|
* Helper class which parses out priority arguments and dumps sections according to their
|
||||||
* priority. If priority arguments are omitted, function calls the legacy dump command.
|
* priority. If priority arguments are omitted, function calls the legacy dump command.
|
||||||
*/
|
*/
|
||||||
private final PriorityDump.PriorityDumper mPriorityDumper = new PriorityDump.PriorityDumper() {
|
private class LocalPriorityDump {
|
||||||
@Override
|
private static final String PRIORITY_ARG = "--dump-priority";
|
||||||
public void dumpHigh(FileDescriptor fd, PrintWriter pw, String[] args, boolean asProto) {
|
private static final String PRIORITY_ARG_HIGH = "HIGH";
|
||||||
doDump(fd, pw, new String[] {DIAG_ARG}, asProto);
|
private static final String PRIORITY_ARG_NORMAL = "NORMAL";
|
||||||
doDump(fd, pw, new String[] {SHORT_ARG}, asProto);
|
|
||||||
|
LocalPriorityDump() {}
|
||||||
|
|
||||||
|
private void dumpHigh(FileDescriptor fd, PrintWriter pw) {
|
||||||
|
doDump(fd, pw, new String[] {DIAG_ARG});
|
||||||
|
doDump(fd, pw, new String[] {SHORT_ARG});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void dumpNormal(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
public void dumpNormal(FileDescriptor fd, PrintWriter pw, String[] args, boolean asProto) {
|
doDump(fd, pw, args);
|
||||||
doDump(fd, pw, args, asProto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args, boolean asProto) {
|
if (args == null) {
|
||||||
doDump(fd, pw, args, asProto);
|
dumpNormal(fd, pw, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String priority = null;
|
||||||
|
for (int argIndex = 0; argIndex < args.length; argIndex++) {
|
||||||
|
if (args[argIndex].equals(PRIORITY_ARG) && argIndex + 1 < args.length) {
|
||||||
|
argIndex++;
|
||||||
|
priority = args[argIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PRIORITY_ARG_HIGH.equals(priority)) {
|
||||||
|
dumpHigh(fd, pw);
|
||||||
|
} else if (PRIORITY_ARG_NORMAL.equals(priority)) {
|
||||||
|
dumpNormal(fd, pw, args);
|
||||||
|
} else {
|
||||||
|
// ConnectivityService publishes binder service using publishBinderService() with
|
||||||
|
// no priority assigned will be treated as NORMAL priority. Dumpsys does not send
|
||||||
|
// "--dump-priority" arguments to the service. Thus, dump both NORMAL and HIGH to
|
||||||
|
// align the legacy design.
|
||||||
|
// TODO: Integrate into signal dump.
|
||||||
|
dumpNormal(fd, pw, args);
|
||||||
|
pw.println();
|
||||||
|
pw.println("DUMP OF SERVICE HIGH connectivity");
|
||||||
|
pw.println();
|
||||||
|
dumpHigh(fd, pw);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Keeps track of the number of requests made under different uids.
|
* Keeps track of the number of requests made under different uids.
|
||||||
@@ -2603,7 +2634,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
@Override
|
@Override
|
||||||
protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter writer,
|
protected void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter writer,
|
||||||
@Nullable String[] args) {
|
@Nullable String[] args) {
|
||||||
PriorityDump.dump(mPriorityDumper, fd, writer, args);
|
mPriorityDumper.dump(fd, writer, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkDumpPermission(Context context, String tag, PrintWriter pw) {
|
private boolean checkDumpPermission(Context context, String tag, PrintWriter pw) {
|
||||||
@@ -2618,10 +2649,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doDump(FileDescriptor fd, PrintWriter writer, String[] args, boolean asProto) {
|
private void doDump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||||
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
||||||
if (!checkDumpPermission(mContext, TAG, pw)) return;
|
if (!checkDumpPermission(mContext, TAG, pw)) return;
|
||||||
if (asProto) return;
|
|
||||||
|
|
||||||
if (CollectionUtils.contains(args, DIAG_ARG)) {
|
if (CollectionUtils.contains(args, DIAG_ARG)) {
|
||||||
dumpNetworkDiagnostics(pw);
|
dumpNetworkDiagnostics(pw);
|
||||||
|
|||||||
@@ -16,9 +16,6 @@
|
|||||||
|
|
||||||
package com.android.server;
|
package com.android.server;
|
||||||
|
|
||||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_HIGH;
|
|
||||||
import static android.os.IServiceManager.DUMP_FLAG_PRIORITY_NORMAL;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
@@ -42,6 +39,6 @@ public final class ConnectivityServiceInitializer extends SystemService {
|
|||||||
public void onStart() {
|
public void onStart() {
|
||||||
Log.i(TAG, "Registering " + Context.CONNECTIVITY_SERVICE);
|
Log.i(TAG, "Registering " + Context.CONNECTIVITY_SERVICE);
|
||||||
publishBinderService(Context.CONNECTIVITY_SERVICE, mConnectivity,
|
publishBinderService(Context.CONNECTIVITY_SERVICE, mConnectivity,
|
||||||
/* allowIsolated= */ false, DUMP_FLAG_PRIORITY_HIGH | DUMP_FLAG_PRIORITY_NORMAL);
|
/* allowIsolated= */ false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user