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

Commit aa418130 authored by Rakesh Pallerla's avatar Rakesh Pallerla Committed by Ricardo Cerqueira
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.

Conflicts:
	telephony/java/android/telephony/SubInfoRecord.java
	telephony/java/android/telephony/SubscriptionManager.java

Change-Id: I8098c46ced297cda748946caab86a5010cc0a255
parent 1c40482e
Loading
Loading
Loading
Loading
+9 −3
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class SubInfoRecord implements Parcelable {
     * Mobile Network Code
     */
    public int mnc;
    public int mStatus;

    public SubInfoRecord() {
        this.subId = SubscriptionManager.INVALID_SUB_ID;
@@ -89,11 +90,12 @@ public class SubInfoRecord implements Parcelable {
        this.simIconRes = new int[2];
        this.mcc = 0;
        this.mnc = 0;
        this.mStatus = SubscriptionManager.INACTIVE;
    }

    public SubInfoRecord(long subId, String iccId, int slotId, String displayName, int nameSource,
            int color, String number, int displayFormat, int roaming, int[] iconRes,
            int mcc, int mnc) {
            int mcc, int mnc, int status) {
        this.subId = subId;
        this.iccId = iccId;
        this.slotId = slotId;
@@ -106,6 +108,7 @@ public class SubInfoRecord implements Parcelable {
        this.simIconRes = iconRes;
        this.mcc = mcc;
        this.mnc = mnc;
        this.mStatus = status;
    }

    public static final Parcelable.Creator<SubInfoRecord> CREATOR = new Parcelable.Creator<SubInfoRecord>() {
@@ -124,9 +127,10 @@ public class SubInfoRecord implements Parcelable {
            source.readIntArray(iconRes);
            int mcc = source.readInt();
            int mnc = source.readInt();
            int status = source.readInt();

            return new SubInfoRecord(subId, iccId, slotId, displayName, nameSource, color, number,
                displayNumberFormat, dataRoaming, iconRes, mcc, mnc);
                displayNumberFormat, dataRoaming, iconRes, mcc, mnc, status);
        }

        @Override
@@ -149,6 +153,7 @@ public class SubInfoRecord implements Parcelable {
        dest.writeIntArray(simIconRes);
        dest.writeInt(mcc);
        dest.writeInt(mnc);
        dest.writeInt(mStatus);
    }

    @Override
@@ -162,6 +167,7 @@ public class SubInfoRecord implements Parcelable {
                + " mDisplayName=" + displayName + " mNameSource=" + nameSource
                + " mColor=" + color + " mNumber=" + number
                + " mDisplayNumberFormat=" + displayNumberFormat + " mDataRoaming=" + dataRoaming
                + " mSimIconRes=" + simIconRes + " mMcc " + mcc + " mMnc " + mnc + "}";
                + " mSimIconRes=" + simIconRes + " mMcc " + mcc + " mMnc " + mnc
                + " mStatus=" + mStatus + "}";
    }
}
+53 −0
Original line number Diff line number Diff line
@@ -117,6 +117,16 @@ public class SubscriptionManager implements BaseColumns {
    /** @hide - to be unhidden */
    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>
@@ -971,6 +981,49 @@ public class SubscriptionManager implements BaseColumns {
    }

    /** @hide */
    public static void activateSubId(long subId) {
        logd("activateSubId sub id = " + subId);
        try {
            getISubInfo().activateSubId(subId);
        } catch (RemoteException ex) {
            return;
        }
    }

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

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

    public static int setSubState(long 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"));
    }

    public static void putPhoneIdAndSubIdExtra(Intent intent, int phoneId) {
        long[] subIds = SubscriptionManager.getSubId(phoneId);
        if (subIds != null && subIds.length > 0) {
+8 −0
Original line number Diff line number Diff line
@@ -159,4 +159,12 @@ interface ISub {
    boolean isVoicePromptEnabled();

    void setVoicePromptEnabled(boolean enabled);

    void activateSubId(long subId);

    void deactivateSubId(long subId);

    int setSubState(long subId, int subStatus);

    int getSubState(long subId);
}
+2 −1
Original line number Diff line number Diff line
@@ -185,7 +185,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.