Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b32417a7 authored by Hugo Benichi's avatar Hugo Benichi
Browse files

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 8b025bf1)

Change-Id: I1eaab5ea702063dde3e23324d3a1b3dc172c5ac5
parent f6b180ff
Loading
Loading
Loading
Loading
+6 −5
Original line number Diff line number Diff line
@@ -80,7 +80,8 @@ import java.util.concurrent.TimeUnit;
 */
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.
@@ -954,7 +955,7 @@ public class NetworkMonitor extends StateMachine {
                    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;
@@ -967,8 +968,8 @@ public class NetworkMonitor extends StateMachine {
                    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) {
@@ -984,7 +985,7 @@ public class NetworkMonitor extends StateMachine {
                            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;
                        }
                    }
+3 −3
Original line number Diff line number Diff line
@@ -114,7 +114,7 @@ public class NetworkNotificationManager {
        }

        if (DBG) {
            Slog.d(TAG, "showNotification " + notifyType
            Slog.d(TAG, "showNotification id=" + id + " " + notifyType
                    + " transportType=" + getTransportName(transportType)
                    + " extraInfo=" + extraInfo + " highPriority=" + highPriority);
        }
@@ -187,7 +187,7 @@ public class NetworkNotificationManager {
        try {
            mNotificationManager.notifyAsUser(NOTIFICATION_ID, id, notification, UserHandle.ALL);
        } catch (NullPointerException npe) {
            Slog.d(TAG, "setNotificationVisible: visible notificationManager npe=" + npe);
            Slog.d(TAG, "setNotificationVisible: visible notificationManager error", npe);
        }
    }

@@ -198,7 +198,7 @@ public class NetworkNotificationManager {
        try {
            mNotificationManager.cancelAsUser(NOTIFICATION_ID, id, UserHandle.ALL);
        } catch (NullPointerException npe) {
            Slog.d(TAG, "setNotificationVisible: cancel notificationManager npe=" + npe);
            Slog.d(TAG, "setNotificationVisible: cancel notificationManager error", npe);
        }
    }