Skip to content

Commit d8f7e04

Browse files
lcolittiAndroid (Google) Code Review
authored andcommitted
Merge "Update LegacyTypeTracker state before sending connect broadcasts." into lmp-dev
2 parents d146224 + 061f415 commit d8f7e04

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

services/core/java/com/android/server/ConnectivityService.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,11 +516,13 @@ public void add(int type, NetworkAgentInfo nai) {
516516
return;
517517
}
518518

519-
if (list.isEmpty() || isDefaultNetwork(nai)) {
519+
list.add(nai);
520+
521+
// Send a broadcast if this is the first network of its type or if it's the default.
522+
if (list.size() == 1 || isDefaultNetwork(nai)) {
520523
maybeLogBroadcast(nai, true, type);
521524
sendLegacyNetworkBroadcast(nai, true, type);
522525
}
523-
list.add(nai);
524526
}
525527

526528
/** Removes the given network from the specified legacy type list. */

0 commit comments

Comments
 (0)