diff options
author | Jeff Sharkey <jsharkey@android.com> | 2014-12-02 18:30:14 -0800 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2014-12-08 08:42:59 -0800 |
commit | 3256601f5e4d94713f59e97b9d4912875c1bdcaf (patch) | |
tree | f1419e55b5b45e0b8485845ad21b72eadeccd977 /telephony/java | |
parent | 9eb2092ea146faa21b8c6e0e512c03fc67a09dda (diff) | |
download | frameworks_base-3256601f5e4d94713f59e97b9d4912875c1bdcaf.zip frameworks_base-3256601f5e4d94713f59e97b9d4912875c1bdcaf.tar.gz frameworks_base-3256601f5e4d94713f59e97b9d4912875c1bdcaf.tar.bz2 |
Offer to "merge" subscribers for data usage.
There are some cases where multiple subscriber identities (IMSI)
should be treated as "merged together" from a data usage
perspective. This is done by extending the template used for
matching purposes to support multiple subscribers.
Then, when we query historical usage or set network policies, we
normalize the matching template to merge to any other identities
that should be included. When normalizing, the "lowest" identity
is always used for equality and storage purposes, which allows
identities to come and go over time.
This change also fixes data usage recording for multi-SIM devices
by passing along the concrete subscriber identity for each network
interface. Also correctly create default policies for multi-SIM
devices. This change also drops setPolicyDataEnable() until it can
be wired up to the right underlying NetworkAgent. (This means we
still bring up the network, and then rely on iptables rules to block
traffic when over the limit, instead of proactively disabling the
connection.)
Bug: 18012787
Change-Id: If6acf32009fdfea2b836f5aff8e2f3e5e0248b4a
Diffstat (limited to 'telephony/java')
3 files changed, 23 insertions, 3 deletions
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index abf1ead..20cd037 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.NonNull; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; import android.content.Context; @@ -1064,7 +1065,7 @@ public class SubscriptionManager { * is never null but the length maybe 0. * @hide */ - public int[] getActiveSubscriptionIdList() { + public @NonNull int[] getActiveSubscriptionIdList() { int[] subId = null; try { diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 751e11b..83bf04f 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -16,6 +16,7 @@ package android.telephony; +import android.annotation.Nullable; import android.annotation.SystemApi; import android.annotation.SdkConstant; import android.annotation.SdkConstant.SdkConstantType; @@ -40,6 +41,7 @@ import com.android.internal.telephony.TelephonyProperties; import java.io.FileInputStream; import java.io.IOException; +import java.util.Arrays; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -1879,6 +1881,23 @@ public class TelephonyManager { } /** + * Return the set of subscriber IDs that should be considered as "merged + * together" for data usage purposes. This is commonly {@code null} to + * indicate no merging is required. Any returned subscribers are sorted in a + * deterministic order. + * + * @hide + */ + public @Nullable String[] getMergedSubscriberIds() { + try { + return getITelephony().getMergedSubscriberIds(); + } catch (RemoteException ex) { + } catch (NullPointerException ex) { + } + return null; + } + + /** * Returns the MSISDN string. * for a GSM phone. Return null if it is unavailable. * <p> @@ -3593,5 +3612,3 @@ public class TelephonyManager { } } } - - diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index bf7f332..d19fa2c 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -772,6 +772,8 @@ interface ITelephony { */ String getLine1AlphaTagForDisplay(int subId); + String[] getMergedSubscriberIds(); + /** * Override the operator branding for the current ICCID. * |