Forward unknown Data Stall types to Connectivity Diagnostics.
This CL forwards suspected Data Stall events detected with unknown detection methods to ConnectivityDiagnostics. Currently, ConnectivityService drops any data stall events with unknown detection methods, which leads to false negatives for Connectivity Diagnostics registrants. This change ensures that registrants will still be notified as NetworkStack is updated to use new detection methods. The documentation for ConnectivityDiagnosticsManager#DataStallReport is also updated to reflect that the detection methods included in the report are a bit mask of detection methods used. Implicitly, this means that data stalls detected via unknown methods will have an empty bit mask (0x00). Bug: 156294356 Test: atest ConnectivityDiagnosticsManager Change-Id: I62d0bf91fcc17c7921afd519c72551399906bd6b
This commit is contained in:
@@ -437,7 +437,7 @@ public class ConnectivityDiagnosticsManager {
|
|||||||
*/
|
*/
|
||||||
private long mReportTimestamp;
|
private long mReportTimestamp;
|
||||||
|
|
||||||
/** The detection method used to identify the suspected data stall */
|
/** A bitmask of the detection methods used to identify the suspected data stall */
|
||||||
@DetectionMethod private final int mDetectionMethod;
|
@DetectionMethod private final int mDetectionMethod;
|
||||||
|
|
||||||
/** LinkProperties available on the Network at the reported timestamp */
|
/** LinkProperties available on the Network at the reported timestamp */
|
||||||
@@ -499,9 +499,9 @@ public class ConnectivityDiagnosticsManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the detection method used to identify this suspected data stall.
|
* Returns the bitmask of detection methods used to identify this suspected data stall.
|
||||||
*
|
*
|
||||||
* @return The detection method used to identify the suspected data stall
|
* @return The bitmask of detection methods used to identify the suspected data stall
|
||||||
*/
|
*/
|
||||||
public int getDetectionMethod() {
|
public int getDetectionMethod() {
|
||||||
return mDetectionMethod;
|
return mDetectionMethod;
|
||||||
|
|||||||
@@ -3094,30 +3094,24 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void notifyDataStallSuspected(DataStallReportParcelable p, int netId) {
|
private void notifyDataStallSuspected(DataStallReportParcelable p, int netId) {
|
||||||
|
log("Data stall detected with methods: " + p.detectionMethod);
|
||||||
|
|
||||||
final PersistableBundle extras = new PersistableBundle();
|
final PersistableBundle extras = new PersistableBundle();
|
||||||
switch (p.detectionMethod) {
|
int detectionMethod = 0;
|
||||||
case DETECTION_METHOD_DNS_EVENTS:
|
if (hasDataStallDetectionMethod(p, DETECTION_METHOD_DNS_EVENTS)) {
|
||||||
extras.putInt(KEY_DNS_CONSECUTIVE_TIMEOUTS, p.dnsConsecutiveTimeouts);
|
extras.putInt(KEY_DNS_CONSECUTIVE_TIMEOUTS, p.dnsConsecutiveTimeouts);
|
||||||
break;
|
detectionMethod |= DETECTION_METHOD_DNS_EVENTS;
|
||||||
case DETECTION_METHOD_TCP_METRICS:
|
}
|
||||||
|
if (hasDataStallDetectionMethod(p, DETECTION_METHOD_TCP_METRICS)) {
|
||||||
extras.putInt(KEY_TCP_PACKET_FAIL_RATE, p.tcpPacketFailRate);
|
extras.putInt(KEY_TCP_PACKET_FAIL_RATE, p.tcpPacketFailRate);
|
||||||
extras.putInt(KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS,
|
extras.putInt(KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS,
|
||||||
p.tcpMetricsCollectionPeriodMillis);
|
p.tcpMetricsCollectionPeriodMillis);
|
||||||
break;
|
detectionMethod |= DETECTION_METHOD_TCP_METRICS;
|
||||||
default:
|
|
||||||
// TODO(b/156294356): update for new data stall detection methods
|
|
||||||
log("Unknown data stall detection method, ignoring: " + p.detectionMethod);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyDataStallSuspected(p.detectionMethod, netId, p.timestampMillis, extras);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notifyDataStallSuspected(int detectionMethod, int netId, long timestampMillis,
|
|
||||||
@NonNull PersistableBundle extras) {
|
|
||||||
final Message msg = mConnectivityDiagnosticsHandler.obtainMessage(
|
final Message msg = mConnectivityDiagnosticsHandler.obtainMessage(
|
||||||
ConnectivityDiagnosticsHandler.EVENT_DATA_STALL_SUSPECTED, detectionMethod, netId,
|
ConnectivityDiagnosticsHandler.EVENT_DATA_STALL_SUSPECTED, detectionMethod, netId,
|
||||||
timestampMillis);
|
p.timestampMillis);
|
||||||
msg.setData(new Bundle(extras));
|
msg.setData(new Bundle(extras));
|
||||||
|
|
||||||
// NetworkStateTrackerHandler currently doesn't take any actions based on data
|
// NetworkStateTrackerHandler currently doesn't take any actions based on data
|
||||||
@@ -3126,6 +3120,10 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
mConnectivityDiagnosticsHandler.sendMessage(msg);
|
mConnectivityDiagnosticsHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean hasDataStallDetectionMethod(DataStallReportParcelable p, int detectionMethod) {
|
||||||
|
return (p.detectionMethod & detectionMethod) != 0;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean networkRequiresPrivateDnsValidation(NetworkAgentInfo nai) {
|
private boolean networkRequiresPrivateDnsValidation(NetworkAgentInfo nai) {
|
||||||
return isPrivateDnsValidationRequired(nai.networkCapabilities);
|
return isPrivateDnsValidationRequired(nai.networkCapabilities);
|
||||||
}
|
}
|
||||||
@@ -8185,6 +8183,19 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
|||||||
+ "creators");
|
+ "creators");
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyDataStallSuspected(detectionMethod, network.netId, timestampMillis, extras);
|
final DataStallReportParcelable p = new DataStallReportParcelable();
|
||||||
|
p.timestampMillis = timestampMillis;
|
||||||
|
p.detectionMethod = detectionMethod;
|
||||||
|
|
||||||
|
if (hasDataStallDetectionMethod(p, DETECTION_METHOD_DNS_EVENTS)) {
|
||||||
|
p.dnsConsecutiveTimeouts = extras.getInt(KEY_DNS_CONSECUTIVE_TIMEOUTS);
|
||||||
|
}
|
||||||
|
if (hasDataStallDetectionMethod(p, DETECTION_METHOD_TCP_METRICS)) {
|
||||||
|
p.tcpPacketFailRate = extras.getInt(KEY_TCP_PACKET_FAIL_RATE);
|
||||||
|
p.tcpMetricsCollectionPeriodMillis = extras.getInt(
|
||||||
|
KEY_TCP_METRICS_COLLECTION_PERIOD_MILLIS);
|
||||||
|
}
|
||||||
|
|
||||||
|
notifyDataStallSuspected(p, network.netId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user