Merge "Make unregisterAfterReplacement tear down CONNECTING networks."

This commit is contained in:
Treehugger Robot
2022-10-13 07:17:17 +00:00
committed by Gerrit Code Review
2 changed files with 67 additions and 3 deletions

View File

@@ -3650,8 +3650,18 @@ public class ConnectivityService extends IConnectivityManager.Stub
break;
}
case NetworkAgent.EVENT_UNREGISTER_AFTER_REPLACEMENT: {
// If nai is not yet created, or is already destroyed, ignore.
if (!shouldDestroyNativeNetwork(nai)) break;
if (!nai.isCreated()) {
Log.d(TAG, "unregisterAfterReplacement on uncreated " + nai.toShortString()
+ ", tearing down instead");
teardownUnneededNetwork(nai);
break;
}
if (nai.isDestroyed()) {
Log.d(TAG, "unregisterAfterReplacement on destroyed " + nai.toShortString()
+ ", ignoring");
break;
}
final int timeoutMs = (int) arg.second;
if (timeoutMs < 0 || timeoutMs > NetworkAgent.MAX_TEARDOWN_DELAY_MS) {