Fix SSID not being logged by the validation logs
Also add it in the logs of the notification manager. Clean cherry-pick of ag/4022397 Bug: 78547904 Test: manual Change-Id: I0afc18c94adf97154c61af2a5bdf933fb5f0e622 Merged-In: Iad5388a31a1502bc1944346276bb9600ac1386bd Merged-In: I8bdd4a020e9d04f46847ef3c7e80ccf5c5cd19ea
This commit is contained in:
@@ -497,24 +497,24 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
private static final int MAX_VALIDATION_LOGS = 10;
|
private static final int MAX_VALIDATION_LOGS = 10;
|
||||||
private static class ValidationLog {
|
private static class ValidationLog {
|
||||||
final Network mNetwork;
|
final Network mNetwork;
|
||||||
final String mNetworkExtraInfo;
|
final String mName;
|
||||||
final ReadOnlyLocalLog mLog;
|
final ReadOnlyLocalLog mLog;
|
||||||
|
|
||||||
ValidationLog(Network network, String networkExtraInfo, ReadOnlyLocalLog log) {
|
ValidationLog(Network network, String name, ReadOnlyLocalLog log) {
|
||||||
mNetwork = network;
|
mNetwork = network;
|
||||||
mNetworkExtraInfo = networkExtraInfo;
|
mName = name;
|
||||||
mLog = log;
|
mLog = log;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private final ArrayDeque<ValidationLog> mValidationLogs =
|
private final ArrayDeque<ValidationLog> mValidationLogs =
|
||||||
new ArrayDeque<ValidationLog>(MAX_VALIDATION_LOGS);
|
new ArrayDeque<ValidationLog>(MAX_VALIDATION_LOGS);
|
||||||
|
|
||||||
private void addValidationLogs(ReadOnlyLocalLog log, Network network, String networkExtraInfo) {
|
private void addValidationLogs(ReadOnlyLocalLog log, Network network, String name) {
|
||||||
synchronized (mValidationLogs) {
|
synchronized (mValidationLogs) {
|
||||||
while (mValidationLogs.size() >= MAX_VALIDATION_LOGS) {
|
while (mValidationLogs.size() >= MAX_VALIDATION_LOGS) {
|
||||||
mValidationLogs.removeLast();
|
mValidationLogs.removeLast();
|
||||||
}
|
}
|
||||||
mValidationLogs.addFirst(new ValidationLog(network, networkExtraInfo, log));
|
mValidationLogs.addFirst(new ValidationLog(network, name, log));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2059,7 +2059,7 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
synchronized (mValidationLogs) {
|
synchronized (mValidationLogs) {
|
||||||
pw.println("mValidationLogs (most recent first):");
|
pw.println("mValidationLogs (most recent first):");
|
||||||
for (ValidationLog p : mValidationLogs) {
|
for (ValidationLog p : mValidationLogs) {
|
||||||
pw.println(p.mNetwork + " - " + p.mNetworkExtraInfo);
|
pw.println(p.mNetwork + " - " + p.mName);
|
||||||
pw.increaseIndent();
|
pw.increaseIndent();
|
||||||
p.mLog.dump(fd, pw, args);
|
p.mLog.dump(fd, pw, args);
|
||||||
pw.decreaseIndent();
|
pw.decreaseIndent();
|
||||||
@@ -4584,8 +4584,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
nai.networkMonitor.systemReady = mSystemReady;
|
nai.networkMonitor.systemReady = mSystemReady;
|
||||||
}
|
}
|
||||||
addValidationLogs(nai.networkMonitor.getValidationLogs(), nai.network,
|
final String extraInfo = networkInfo.getExtraInfo();
|
||||||
networkInfo.getExtraInfo());
|
final String name = TextUtils.isEmpty(extraInfo)
|
||||||
|
? nai.networkCapabilities.getSSID() : extraInfo;
|
||||||
|
addValidationLogs(nai.networkMonitor.getValidationLogs(), nai.network, name);
|
||||||
if (DBG) log("registerNetworkAgent " + nai);
|
if (DBG) log("registerNetworkAgent " + nai);
|
||||||
mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_AGENT, nai));
|
mHandler.sendMessage(mHandler.obtainMessage(EVENT_REGISTER_NETWORK_AGENT, nai));
|
||||||
return nai.network.netId;
|
return nai.network.netId;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import android.net.NetworkCapabilities;
|
|||||||
import android.net.wifi.WifiInfo;
|
import android.net.wifi.WifiInfo;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
import android.util.SparseArray;
|
import android.util.SparseArray;
|
||||||
import android.util.SparseIntArray;
|
import android.util.SparseIntArray;
|
||||||
@@ -131,16 +132,17 @@ public class NetworkNotificationManager {
|
|||||||
final String tag = tagFor(id);
|
final String tag = tagFor(id);
|
||||||
final int eventId = notifyType.eventId;
|
final int eventId = notifyType.eventId;
|
||||||
final int transportType;
|
final int transportType;
|
||||||
final String extraInfo;
|
final String name;
|
||||||
if (nai != null) {
|
if (nai != null) {
|
||||||
transportType = getFirstTransportType(nai);
|
transportType = getFirstTransportType(nai);
|
||||||
extraInfo = nai.networkInfo.getExtraInfo();
|
final String extraInfo = nai.networkInfo.getExtraInfo();
|
||||||
|
name = TextUtils.isEmpty(extraInfo) ? nai.networkCapabilities.getSSID() : extraInfo;
|
||||||
// Only notify for Internet-capable networks.
|
// Only notify for Internet-capable networks.
|
||||||
if (!nai.networkCapabilities.hasCapability(NET_CAPABILITY_INTERNET)) return;
|
if (!nai.networkCapabilities.hasCapability(NET_CAPABILITY_INTERNET)) return;
|
||||||
} else {
|
} else {
|
||||||
// Legacy notifications.
|
// Legacy notifications.
|
||||||
transportType = TRANSPORT_CELLULAR;
|
transportType = TRANSPORT_CELLULAR;
|
||||||
extraInfo = null;
|
name = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear any previous notification with lower priority, otherwise return. http://b/63676954.
|
// Clear any previous notification with lower priority, otherwise return. http://b/63676954.
|
||||||
@@ -157,9 +159,8 @@ public class NetworkNotificationManager {
|
|||||||
|
|
||||||
if (DBG) {
|
if (DBG) {
|
||||||
Slog.d(TAG, String.format(
|
Slog.d(TAG, String.format(
|
||||||
"showNotification tag=%s event=%s transport=%s extraInfo=%s highPrioriy=%s",
|
"showNotification tag=%s event=%s transport=%s name=%s highPriority=%s",
|
||||||
tag, nameOf(eventId), getTransportName(transportType), extraInfo,
|
tag, nameOf(eventId), getTransportName(transportType), name, highPriority));
|
||||||
highPriority));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Resources r = Resources.getSystem();
|
Resources r = Resources.getSystem();
|
||||||
@@ -188,7 +189,7 @@ public class NetworkNotificationManager {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
title = r.getString(R.string.network_available_sign_in, 0);
|
title = r.getString(R.string.network_available_sign_in, 0);
|
||||||
details = r.getString(R.string.network_available_sign_in_detailed, extraInfo);
|
details = r.getString(R.string.network_available_sign_in_detailed, name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (notifyType == NotificationType.NETWORK_SWITCH) {
|
} else if (notifyType == NotificationType.NETWORK_SWITCH) {
|
||||||
|
|||||||
Reference in New Issue
Block a user