summaryrefslogtreecommitdiffstats
path: root/service/java/com/android/server/wifi/WifiMetrics.java
diff options
context:
space:
mode:
authorGlen Kuhne <kuh@google.com>2016-09-16 16:35:57 -0700
committerGlen Kuhne <kuh@google.com>2016-09-19 14:26:59 -0700
commit9ff7dea01b09f658492b7b8fa122695e56d28cdc (patch)
treeb7589a67d39b04bc4554a949d53e49feddf448e4 /service/java/com/android/server/wifi/WifiMetrics.java
parent7a36be372edfa3f7fe0e37320b9b21a5fbadf277 (diff)
downloadandroid_frameworks_opt_net_wifi-9ff7dea01b09f658492b7b8fa122695e56d28cdc.tar.gz
android_frameworks_opt_net_wifi-9ff7dea01b09f658492b7b8fa122695e56d28cdc.tar.bz2
android_frameworks_opt_net_wifi-9ff7dea01b09f658492b7b8fa122695e56d28cdc.zip
Wifi Metrics: dumpsys arg for clean output
Modify the way dumpsys works in wifi so that 'dumpsys wifi wifiMetricsProto clean' outputs only serialized base64 encoded wifi metrics proto bytes. BUG=31556602 Test: Created new unit test Change-Id: Id1aa319a03a5e2bcffb1276057cb770679015abd
Diffstat (limited to 'service/java/com/android/server/wifi/WifiMetrics.java')
-rw-r--r--service/java/com/android/server/wifi/WifiMetrics.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java
index 643060b4f..11daa2947 100644
--- a/service/java/com/android/server/wifi/WifiMetrics.java
+++ b/service/java/com/android/server/wifi/WifiMetrics.java
@@ -902,9 +902,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
@@ -912,9 +914,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) {
@@ -925,10 +926,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();