Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 536c9614 authored by Shuo Qian's avatar Shuo Qian Committed by Android (Google) Code Review
Browse files

Merge "Make SubscriptionManager.getSlotIndex public"

parents e0ef793d ccea7355
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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 {
+19 −15
Original line number Diff line number Diff line
@@ -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