Merge "add and incorporate TetheringConfiguration.dump()"
This commit is contained in:
@@ -1584,14 +1584,14 @@ public class Tethering extends BaseNetworkObserver implements IControlsTethering
|
||||
|
||||
pw.println("Tethering:");
|
||||
pw.increaseIndent();
|
||||
final TetheringConfiguration cfg = mConfig;
|
||||
pw.print("preferredUpstreamIfaceTypes:");
|
||||
synchronized (mPublicSync) {
|
||||
for (Integer netType : cfg.preferredUpstreamIfaceTypes) {
|
||||
pw.print(" " + ConnectivityManager.getNetworkTypeName(netType));
|
||||
}
|
||||
pw.println();
|
||||
|
||||
pw.println("Configuration:");
|
||||
pw.increaseIndent();
|
||||
final TetheringConfiguration cfg = mConfig;
|
||||
cfg.dump(pw);
|
||||
pw.decreaseIndent();
|
||||
|
||||
synchronized (mPublicSync) {
|
||||
pw.println("Tether state:");
|
||||
pw.increaseIndent();
|
||||
for (int i = 0; i < mTetherStates.size(); i++) {
|
||||
|
||||
@@ -22,12 +22,15 @@ import static android.net.ConnectivityManager.TYPE_MOBILE_HIPRI;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Log;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
|
||||
/**
|
||||
@@ -97,6 +100,44 @@ public class TetheringConfiguration {
|
||||
return matchesDownstreamRegexs(iface, tetherableBluetoothRegexs);
|
||||
}
|
||||
|
||||
public void dump(PrintWriter pw) {
|
||||
dumpStringArray(pw, "tetherableUsbRegexs", tetherableUsbRegexs);
|
||||
dumpStringArray(pw, "tetherableWifiRegexs", tetherableWifiRegexs);
|
||||
dumpStringArray(pw, "tetherableBluetoothRegexs", tetherableBluetoothRegexs);
|
||||
|
||||
pw.print("isDunRequired: ");
|
||||
pw.println(isDunRequired);
|
||||
|
||||
String[] upstreamTypes = null;
|
||||
if (preferredUpstreamIfaceTypes != null) {
|
||||
upstreamTypes = new String[preferredUpstreamIfaceTypes.size()];
|
||||
int i = 0;
|
||||
for (Integer netType : preferredUpstreamIfaceTypes) {
|
||||
upstreamTypes[i] = ConnectivityManager.getNetworkTypeName(netType);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
dumpStringArray(pw, "preferredUpstreamIfaceTypes", upstreamTypes);
|
||||
|
||||
dumpStringArray(pw, "dhcpRanges", dhcpRanges);
|
||||
dumpStringArray(pw, "defaultIPv4DNS", defaultIPv4DNS);
|
||||
}
|
||||
|
||||
private static void dumpStringArray(PrintWriter pw, String label, String[] values) {
|
||||
pw.print(label);
|
||||
pw.print(": ");
|
||||
|
||||
if (values != null) {
|
||||
final StringJoiner sj = new StringJoiner(", ", "[", "]");
|
||||
for (String value : values) { sj.add(value); }
|
||||
pw.print(sj.toString());
|
||||
} else {
|
||||
pw.print("null");
|
||||
}
|
||||
|
||||
pw.println();
|
||||
}
|
||||
|
||||
private static boolean checkDunRequired(Context ctx) {
|
||||
final TelephonyManager tm = ctx.getSystemService(TelephonyManager.class);
|
||||
final int secureSetting =
|
||||
|
||||
Reference in New Issue
Block a user