diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-08-14 12:55:00 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@google.com> | 2014-08-14 22:42:27 +0000 |
commit | 9da2f1e007268a42248a1778aa9b560e3ce3b704 (patch) | |
tree | eade39aacd886d616490402fc812c13ca2a62812 /services | |
parent | 9fde9a250fffc15c6bcdfc985de12c8646a9813c (diff) | |
download | frameworks_base-9da2f1e007268a42248a1778aa9b560e3ce3b704.zip frameworks_base-9da2f1e007268a42248a1778aa9b560e3ce3b704.tar.gz frameworks_base-9da2f1e007268a42248a1778aa9b560e3ce3b704.tar.bz2 |
Some networks may have null ifaces, I guess?
Seems like a bug further upstream, but guard ourselves against it
for now.
Bug: 17033841
Change-Id: Id0e5895c3389b63d4e34b1fb064efef8b72cd609
Diffstat (limited to 'services')
-rw-r--r-- | services/core/java/com/android/server/net/NetworkPolicyManagerService.java | 16 | ||||
-rw-r--r-- | services/core/java/com/android/server/net/NetworkStatsService.java | 19 |
2 files changed, 21 insertions, 14 deletions
diff --git a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java index ad2bb92..bb5243c 100644 --- a/services/core/java/com/android/server/net/NetworkPolicyManagerService.java +++ b/services/core/java/com/android/server/net/NetworkPolicyManagerService.java @@ -1060,9 +1060,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final NetworkIdentity ident = NetworkIdentity.buildNetworkIdentity(mContext, state); final String baseIface = state.linkProperties.getInterfaceName(); - connIdents.add(Pair.create(baseIface, ident)); - if (powerSave) { - connIfaces.add(baseIface); + if (baseIface != null) { + connIdents.add(Pair.create(baseIface, ident)); + if (powerSave) { + connIfaces.add(baseIface); + } } // Stacked interfaces are considered to have same identity as @@ -1070,9 +1072,11 @@ public class NetworkPolicyManagerService extends INetworkPolicyManager.Stub { final List<LinkProperties> stackedLinks = state.linkProperties.getStackedLinks(); for (LinkProperties stackedLink : stackedLinks) { final String stackedIface = stackedLink.getInterfaceName(); - connIdents.add(Pair.create(stackedIface, ident)); - if (powerSave) { - connIfaces.add(stackedIface); + if (stackedIface != null) { + connIdents.add(Pair.create(stackedIface, ident)); + if (powerSave) { + connIfaces.add(stackedIface); + } } } } diff --git a/services/core/java/com/android/server/net/NetworkStatsService.java b/services/core/java/com/android/server/net/NetworkStatsService.java index e35ca46..f995dee 100644 --- a/services/core/java/com/android/server/net/NetworkStatsService.java +++ b/services/core/java/com/android/server/net/NetworkStatsService.java @@ -896,10 +896,12 @@ public class NetworkStatsService extends INetworkStatsService.Stub { // Traffic occurring on the base interface is always counted for // both total usage and UID details. final String baseIface = state.linkProperties.getInterfaceName(); - findOrCreateNetworkIdentitySet(mActiveIfaces, baseIface).add(ident); - findOrCreateNetworkIdentitySet(mActiveUidIfaces, baseIface).add(ident); - if (isMobile) { - mobileIfaces.add(baseIface); + if (baseIface != null) { + findOrCreateNetworkIdentitySet(mActiveIfaces, baseIface).add(ident); + findOrCreateNetworkIdentitySet(mActiveUidIfaces, baseIface).add(ident); + if (isMobile) { + mobileIfaces.add(baseIface); + } } // Traffic occurring on stacked interfaces is usually clatd, @@ -909,15 +911,16 @@ public class NetworkStatsService extends INetworkStatsService.Stub { final List<LinkProperties> stackedLinks = state.linkProperties.getStackedLinks(); for (LinkProperties stackedLink : stackedLinks) { final String stackedIface = stackedLink.getInterfaceName(); - findOrCreateNetworkIdentitySet(mActiveUidIfaces, stackedIface).add(ident); - if (isMobile) { - mobileIfaces.add(stackedIface); + if (stackedIface != null) { + findOrCreateNetworkIdentitySet(mActiveUidIfaces, stackedIface).add(ident); + if (isMobile) { + mobileIfaces.add(stackedIface); + } } } } } - mobileIfaces.remove(null); mMobileIfaces = mobileIfaces.toArray(new String[mobileIfaces.size()]); } |