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

Commit 4242f704 authored by Rakesh Pallerla's avatar Rakesh Pallerla Committed by Deepak Kundra
Browse files

Add Manual Provisioning Support

* Add status variable in SubInfoRecord.
* Add new APIs in SubscriptionManager to activate/deactivate sub.
* Add new APIs to get and set subStatus.

Change-Id: I6d0f43dab7bf5dde759d4ced3c9d8e70dfb84dd2
DELETED:telephony/java/android/telephony/SubInfoRecord.java
parent bbf2ddf4
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -120,6 +120,16 @@ public class SubscriptionManager {
    /** @hide */
    public static final int SIM_NOT_INSERTED = -1;

    /**
     * The activation state of SIM/sub.
     * <P>Type: INTEGER (int)</P>
     */
    public static final String SUB_STATE = "sub_state";

    public static final int INACTIVE = 0;
    public static final int ACTIVE = 1;
    public static final int SUB_CONFIGURATION_IN_PROGRESS = 2;

    /**
     * TelephonyProvider column name for user displayed name.
     * <P>Type: TEXT (String)</P>
@@ -1117,6 +1127,49 @@ public class SubscriptionManager {
        return phoneId >= 0 && phoneId < TelephonyManager.getDefault().getPhoneCount();
    }

    public static void activateSubId(int subId) {
        logd("activateSubId sub id = " + subId);
        try {
            getISubInfo().activateSubId(subId);
        } catch (RemoteException ex) {
            return;
        }
    }

    public static void deactivateSubId(int subId) {
        logd("deactivateSubId sub id = " + subId);
        try {
            getISubInfo().deactivateSubId(subId);
        } catch (RemoteException ex) {
            return;
        }
    }

    public static int getSubState(int subId) {
        logd("getSubState sub id = " + subId);
        try {
            return getISubInfo().getSubState(subId);
        } catch (RemoteException ex) {
            return INACTIVE;
        }
    }

    public static int setSubState(int subId, int subState) {
        logd("setSubState sub id = " + subId + " state = " + subState);
        try {
            return getISubInfo().setSubState(subId, subState);
        } catch (RemoteException ex) {
            return INACTIVE;
        }
    }

   /**
    @hide
    */
    private static ISub getISubInfo() {
        return ISub.Stub.asInterface(ServiceManager.getService("isub"));
    }

    /** @hide */
    public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) {
        int[] subIds = SubscriptionManager.getSubId(phoneId);
+8 −0
Original line number Diff line number Diff line
@@ -183,4 +183,12 @@ interface ISub {
    int getSimStateForSlotIdx(int slotIdx);

    boolean isActiveSubId(int subId);

    void activateSubId(int subId);

    void deactivateSubId(int subId);

    int setSubState(int subId, int subStatus);

    int getSubState(int subId);
}
+2 −1
Original line number Diff line number Diff line
@@ -183,7 +183,8 @@ public class PhoneConstants {
    public enum CardUnavailableReason {
        REASON_CARD_REMOVED,
        REASON_RADIO_UNAVAILABLE,
        REASON_SIM_REFRESH_RESET
        REASON_SIM_REFRESH_RESET,
        REASON_APM_SIM_POWER_DOWN
    };

    // Initial MTU value.