DO NOT MERGE Captive portal systel log improvements
This patch improves system logging around captive portal detection to
make inspection of bug reports sligthly easier:
- NetworkMonitor now logs by default CMD_CAPTIVE_PORTAL_RECHECK and
CMD_CAPTIVE_PORTAL_APP_FINISHED. Other system logs are kept off with
a new VDBG boolean contant,
- NetworkNotificationManager now prints the notification id at
notification time. This allows to easily correlate show and clear.
- errors in NetworkNotificationManager are logged as Throwable instead
of through their implicit toString() method.
Test: $ runtest frameworks-net
Bug: 32198726
(cherry picked from commit 8b025bf108c729156b40159038befa0e6c5bebce)
Change-Id: I7780c389a94c4b9fa226f53b02fe5960d1c08618
diff --git a/services/core/java/com/android/server/connectivity/NetworkMonitor.java b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
index c73d1dd..aa66917 100644
--- a/services/core/java/com/android/server/connectivity/NetworkMonitor.java
+++ b/services/core/java/com/android/server/connectivity/NetworkMonitor.java
@@ -80,7 +80,8 @@
*/
public class NetworkMonitor extends StateMachine {
private static final String TAG = NetworkMonitor.class.getSimpleName();
- private static final boolean DBG = false;
+ private static final boolean DBG = true;
+ private static final boolean VDBG = false;
// Default configuration values for captive portal detection probes.
// TODO: append a random length parameter to the default HTTPS url.
@@ -918,7 +919,7 @@
latencyBroadcast.putExtra(EXTRA_SSID, currentWifiInfo.getSSID());
latencyBroadcast.putExtra(EXTRA_BSSID, currentWifiInfo.getBSSID());
} else {
- if (DBG) logw("network info is TYPE_WIFI but no ConnectionInfo found");
+ if (VDBG) logw("network info is TYPE_WIFI but no ConnectionInfo found");
return;
}
break;
@@ -931,8 +932,8 @@
if (cellInfo.isRegistered()) {
numRegisteredCellInfo++;
if (numRegisteredCellInfo > 1) {
- log("more than one registered CellInfo. Can't " +
- "tell which is active. Bailing.");
+ if (VDBG) logw("more than one registered CellInfo." +
+ " Can't tell which is active. Bailing.");
return;
}
if (cellInfo instanceof CellInfoCdma) {
@@ -948,7 +949,7 @@
CellIdentityWcdma cellId = ((CellInfoWcdma) cellInfo).getCellIdentity();
latencyBroadcast.putExtra(EXTRA_CELL_ID, cellId);
} else {
- if (DBG) logw("Registered cellinfo is unrecognized");
+ if (VDBG) logw("Registered cellinfo is unrecognized");
return;
}
}