summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorGlen Kuhne <kuh@google.com>2016-10-05 17:16:30 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-10-05 17:16:30 +0000
commita96abb03c7e31ffae1e19faa24b12e55d270fa03 (patch)
tree2f55e545a46e50959181ab7a1c56f2f57724eff2 /service
parent8acd9c88b0e2e408e685eac3964135f40a783756 (diff)
parentda247f42ad1ee4071e15f0115ef57e73e1143ef1 (diff)
Merge "Wifi Metrics: dumpsys arg for clean output"
Diffstat (limited to 'service')
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java19
-rw-r--r--service/java/com/android/server/wifi/WifiStateMachine.java7
2 files changed, 21 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index e01e17b13..7cad314d4 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -922,9 +922,11 @@ public class WifiMetrics {
}
public static final String PROTO_DUMP_ARG = "wifiMetricsProto";
+ public static final String CLEAN_DUMP_ARG = "clean";
+
/**
* Dump all WifiMetrics. Collects some metrics from ConfigStore, Settings and WifiManager
- * at this time
+ * at this time.
*
* @param fd unused
* @param pw PrintWriter for writing dump to
@@ -932,9 +934,8 @@ public class WifiMetrics {
*/
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
synchronized (mLock) {
- pw.println("WifiMetrics:");
if (args.length > 0 && PROTO_DUMP_ARG.equals(args[0])) {
- //Dump serialized WifiLog proto
+ // Dump serialized WifiLog proto
consolidateProto(true);
for (ConnectionEvent event : mConnectionEventList) {
if (mCurrentConnectionEvent != event) {
@@ -945,10 +946,18 @@ public class WifiMetrics {
}
byte[] wifiMetricsProto = WifiMetricsProto.WifiLog.toByteArray(mWifiLogProto);
String metricsProtoDump = Base64.encodeToString(wifiMetricsProto, Base64.DEFAULT);
- pw.println(metricsProtoDump);
- pw.println("EndWifiMetrics");
+ if (args.length > 1 && CLEAN_DUMP_ARG.equals(args[1])) {
+ // Output metrics proto bytes (base64) and nothing else
+ pw.print(metricsProtoDump);
+ } else {
+ // Tag the start and end of the metrics proto bytes
+ pw.println("WifiMetrics:");
+ pw.println(metricsProtoDump);
+ pw.println("EndWifiMetrics");
+ }
clear();
} else {
+ pw.println("WifiMetrics:");
pw.println("mConnectionEvents:");
for (ConnectionEvent event : mConnectionEventList) {
String eventLine = event.toString();
diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java
index 2ca21b846..a4610abed 100644
--- a/service/java/com/android/server/wifi/WifiStateMachine.java
+++ b/service/java/com/android/server/wifi/WifiStateMachine.java
@@ -2086,6 +2086,13 @@ public class WifiStateMachine extends StateMachine implements WifiNative.WifiRss
@Override
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+ if (args.length > 1 && WifiMetrics.PROTO_DUMP_ARG.equals(args[0])
+ && WifiMetrics.CLEAN_DUMP_ARG.equals(args[1])) {
+ // Dump only wifi metrics serialized proto bytes (base64)
+ updateWifiMetrics();
+ mWifiMetrics.dump(fd, pw, args);
+ return;
+ }
super.dump(fd, pw, args);
mSupplicantStateTracker.dump(fd, pw, args);
pw.println("mLinkProperties " + mLinkProperties);