summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xapi/current.txt3
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java34
2 files changed, 22 insertions, 15 deletions
diff --git a/api/current.txt b/api/current.txt
index 6042b2fa4c32..3beb491c5412 100755
--- a/api/current.txt
+++ b/api/current.txt
@@ -42787,6 +42787,7 @@ package android.telephony {
method public static int getDefaultSubscriptionId();
method public static int getDefaultVoiceSubscriptionId();
method public java.util.List<android.telephony.SubscriptionInfo> getOpportunisticSubscriptions(int);
+ method public static int getSlotIndex(int);
method public static int[] getSubscriptionIds(int);
method public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);
method public boolean isNetworkRoaming(int);
@@ -42804,7 +42805,9 @@ package android.telephony {
field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
field public static final java.lang.String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
+ field public static final int INVALID_SIM_SLOT_INDEX = -2; // 0xfffffffe
field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
+ field public static final int SIM_NOT_INSERTED = -3; // 0xfffffffd
}
public static class SubscriptionManager.OnOpportunisticSubscriptionsChangedListener {
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index e9423f75c9e1..777b850bc9c5 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -86,9 +86,8 @@ public class SubscriptionManager {
/** @hide */
public static final int INVALID_PHONE_INDEX = -1;
- /** An invalid slot identifier */
- /** @hide */
- public static final int INVALID_SIM_SLOT_INDEX = -1;
+ /** Indicates invalid sim slot. This can be returned by {@link #getSlotIndex(int)}. */
+ public static final int INVALID_SIM_SLOT_INDEX = -2;
/** Indicates the caller wants the default sub id. */
/** @hide */
@@ -139,9 +138,8 @@ public class SubscriptionManager {
/** @hide */
public static final String SIM_SLOT_INDEX = "sim_id";
- /** SIM is not inserted */
- /** @hide */
- public static final int SIM_NOT_INSERTED = -1;
+ /** Indicates SIM is not inserted. This can be returned by {@link #getSlotIndex(int)}. */
+ public static final int SIM_NOT_INSERTED = -3;
/**
* TelephonyProvider column name for user displayed name.
@@ -1264,16 +1262,22 @@ public class SubscriptionManager {
/**
* Get slotIndex associated with the subscription.
- * @return slotIndex as a positive integer or a negative value if an error either
- * SIM_NOT_INSERTED or < 0 if an invalid slot index
- * @hide
- */
- @UnsupportedAppUsage
- public static int getSlotIndex(int subId) {
- if (!isValidSubscriptionId(subId)) {
+ *
+ * @param subscriptionId the unique SubscriptionInfo index in database
+ * @return slotIndex as a positive integer or a negative value,
+ * <ol>
+ * <li>{@link #INVALID_SUBSCRIPTION_ID} if the supplied subscriptionId is invalid </li>
+ * <li>{@link #SIM_NOT_INSERTED} if sim is not inserted </li>
+ * <li>{@link #INVALID_SIM_SLOT_INDEX} if the supplied subscriptionId doesn't have an
+ * associated slot index </li>
+ * </ol>
+ */
+ public static int getSlotIndex(int subscriptionId) {
+ if (!isValidSubscriptionId(subscriptionId)) {
if (DBG) {
- logd("[getSlotIndex]- fail");
+ logd("[getSlotIndex]- supplied subscriptionId is invalid. ");
}
+ return INVALID_SUBSCRIPTION_ID;
}
int result = INVALID_SIM_SLOT_INDEX;
@@ -1281,7 +1285,7 @@ public class SubscriptionManager {
try {
ISub iSub = ISub.Stub.asInterface(ServiceManager.getService("isub"));
if (iSub != null) {
- result = iSub.getSlotIndex(subId);
+ result = iSub.getSlotIndex(subscriptionId);
}
} catch (RemoteException ex) {
// ignore it