Fix filter on CONNECTIVITY_ACTION updates

Only send for network types which the network supports.

bug:22411968
Change-Id: I97765544eb653caf0ea4fc5d3feec5742d5d88dc
This commit is contained in:
Robert Greenwalt
2015-07-10 16:00:36 -07:00
parent 718df19ed0
commit 3df86c6974

View File

@@ -559,8 +559,9 @@ public class ConnectivityService extends IConnectivityManager.Stub
final DetailedState state = nai.networkInfo.getDetailedState(); final DetailedState state = nai.networkInfo.getDetailedState();
for (int type = 0; type < mTypeLists.length; type++) { for (int type = 0; type < mTypeLists.length; type++) {
final ArrayList<NetworkAgentInfo> list = mTypeLists[type]; final ArrayList<NetworkAgentInfo> list = mTypeLists[type];
final boolean contains = (list != null && list.contains(nai));
final boolean isFirst = (list != null && list.size() > 0 && nai == list.get(0)); final boolean isFirst = (list != null && list.size() > 0 && nai == list.get(0));
if (isFirst || isDefault) { if (isFirst || (contains && isDefault)) {
maybeLogBroadcast(nai, state, type, isDefault); maybeLogBroadcast(nai, state, type, isDefault);
sendLegacyNetworkBroadcast(nai, state, type); sendLegacyNetworkBroadcast(nai, state, type);
} }