From 8eab2b6bdffc3a5934796d074f541f1020b26f30 Mon Sep 17 00:00:00 2001 From: Wink Saville Date: Tue, 23 Sep 2014 14:20:58 -0700 Subject: [PATCH] Add SM isUsableSubIdValue Change-Id: Ib1381116545688de52bde111acf827b2e07c5621 --- .../android/telephony/SubscriptionManager.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java index 8e9e9ecf5e332..c96c3830b0dc1 100644 --- a/telephony/java/android/telephony/SubscriptionManager.java +++ b/telephony/java/android/telephony/SubscriptionManager.java @@ -65,6 +65,15 @@ public class SubscriptionManager implements BaseColumns { /** Indicates the caller wants the default sub id. */ public static final long DEFAULT_SUB_ID = Long.MAX_VALUE; + /** Minimum possible subid that represents a subscription */ + /** @hide */ + public static final long MIN_SUB_ID_VALUE = 0; + + /** Maximum possible subid that represents a subscription */ + /** @hide */ + public static final long MAX_SUB_ID_VALUE = DEFAULT_SUB_ID - 1; + + /** @hide */ public static final Uri CONTENT_URI = Uri.parse("content://telephony/siminfo"); @@ -914,6 +923,15 @@ public class SubscriptionManager implements BaseColumns { return subId > INVALID_SUB_ID ; } + /** + * @return true if subId is an usable subId value else false. A + * usable subId means its neither a INVALID_SUB_ID nor a DEFAUL_SUB_ID. + * @hide + */ + public static boolean isUsableSubIdValue(long subId) { + return subId >= MIN_SUB_ID_VALUE && subId <= MAX_SUB_ID_VALUE; + } + /** @hide */ public static boolean isValidSlotId(int slotId) { // We are testing INVALID_SLOT_ID and slotId >= 0 independently because we should