From 56859f323c1e7da9d537478e080d73614b207376 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Mon, 19 Oct 2015 16:52:08 -0700 Subject: Ignore network policies with missing IMSI. In rare cases, we might have created a network policy before an IMSI was available. Because this policy is persisted, and we incorrectly think that it always applies, we end up annoying the user when data usage goes over the 2GB default warning threshold. This patch fixes the network matching logic to ignore these empty network policies when present. Bug: 24972775 Change-Id: Id26499b6716121dddf0f2c05b848b0bed5995e72 --- core/java/android/net/NetworkTemplate.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/core/java/android/net/NetworkTemplate.java b/core/java/android/net/NetworkTemplate.java index 57eef83..b7a411e 100644 --- a/core/java/android/net/NetworkTemplate.java +++ b/core/java/android/net/NetworkTemplate.java @@ -288,7 +288,8 @@ public class NetworkTemplate implements Parcelable { } else { final boolean matchesType = (sForceAllNetworkTypes || contains(DATA_USAGE_NETWORK_TYPES, ident.mType)); - return matchesType && ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId); + return matchesType && !ArrayUtils.isEmpty(mMatchSubscriberIds) + && ArrayUtils.contains(mMatchSubscriberIds, ident.mSubscriberId); } } -- cgit v1.1