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

Commit 4b09dff3 authored by Wink Saville's avatar Wink Saville
Browse files

Additional changes to SubscriptionManager API as per API council.

bug: 17575308
Change-Id: Idd98aa46c15a9219ccf28091c62602ac8bf16c62
parent cc0146c9
Loading
Loading
Loading
Loading
+21 −21
Original line number Diff line number Diff line
@@ -240,12 +240,12 @@ public final class Telephony {
        public static final String LOCKED = "locked";

        /**
         * The sub_id to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUB_ID} if the sub id cannot be
         * determined.
         * The subscription to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if
         * the sub id cannot be determined.
         * <p>Type: INTEGER (long) </p>
         */
        public static final String SUB_ID = "sub_id";
        public static final String SUBSCRIPTION_ID = "sub_id";

        /**
         * The MTU size of the mobile interface to which the APN connected
@@ -354,7 +354,7 @@ public final class Telephony {
         * @param date the timestamp for the message
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @param subId the sub_id which the message belongs to
         * @param subId the subscription which the message belongs to
         * @return the URI for the new message
         * @hide
         */
@@ -400,7 +400,7 @@ public final class Telephony {
         * @param read true if the message has been read, false if not
         * @param deliveryReport true if a delivery report was requested, false if not
         * @param threadId the thread_id of the message
         * @param subId the sub_id which the message belongs to
         * @param subId the subscription which the message belongs to
         * @return the URI for the new message
         * @hide
         */
@@ -410,7 +410,7 @@ public final class Telephony {
            ContentValues values = new ContentValues(8);
            Rlog.v(TAG,"Telephony addMessageToUri sub id: " + subId);

            values.put(SUB_ID, subId);
            values.put(SUBSCRIPTION_ID, subId);
            values.put(ADDRESS, address);
            if (date != null) {
                values.put(DATE, date);
@@ -536,7 +536,7 @@ public final class Telephony {
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param read true if the message has been read, false if not
             * @param subId the sub_id which the message belongs to
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
@@ -594,7 +594,7 @@ public final class Telephony {
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param subId the sub_id which the message belongs to
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
@@ -639,7 +639,7 @@ public final class Telephony {
             * @param body the body of the message
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param subId the sub_id which the message belongs to
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
@@ -706,7 +706,7 @@ public final class Telephony {
             * @param subject the psuedo-subject of the message
             * @param date the timestamp for the message
             * @param deliveryReport whether a delivery report was requested for the message
             * @param subId the sub_id which the message belongs to
             * @param subId the subscription which the message belongs to
             * @return the URI for the new message
             * @hide
             */
@@ -1708,12 +1708,12 @@ public final class Telephony {
        public static final String LOCKED = "locked";

        /**
         * The sub_id to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUB_ID} if the sub id cannot be
         * determined.
         * The subscription to which the message belongs to. Its value will be
         * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if
         * the sub id cannot be determined.
         * <p>Type: INTEGER (long)</p>
         */
        public static final String SUB_ID = "sub_id";
        public static final String SUBSCRIPTION_ID = "sub_id";

        /**
         * The identity of the sender of a sent message. It is
@@ -2548,12 +2548,12 @@ public final class Telephony {
            public static final String LAST_TRY = "last_try";

            /**
             * The sub_id to which the message belongs to. Its value will be
             * {@link android.telephony.SubscriptionManager#INVALID_SUB_ID} if the sub id cannot be
             * determined.
             * The subscription to which the message belongs to. Its value will be
             * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID} if
             * the sub id cannot be determined.
             * <p>Type: INTEGER (long) </p>
             */
            public static final String SUB_ID = "pending_sub_id";
            public static final String SUBSCRIPTION_ID = "pending_sub_id";
        }

        /**
@@ -2762,10 +2762,10 @@ public final class Telephony {
        public static final String MVNO_MATCH_DATA = "mvno_match_data";

        /**
         * The sub_id to which the APN belongs to
         * The subscription to which the APN belongs to
         * <p>Type: INTEGER (long) </p>
         */
        public static final String SUB_ID = "sub_id";
        public static final String SUBSCRIPTION_ID = "sub_id";

        /**
         * The profile_id to which the APN saved in modem
+3 −3
Original line number Diff line number Diff line
@@ -502,7 +502,7 @@ public final class SmsManager {
     * Get the associated subscription id. If the instance was returned by {@link #getDefault()},
     * then this method may return different values at different points in time (if the user
     * changes the default subscription id). It will return
     * {@link android.telephony.SubscriptionManager#INVALID_SUB_ID}
     * {@link android.telephony.SubscriptionManager#INVALID_SUBSCRIPTION_ID}
     * if the default subscription id cannot be determined.
     *
     * @return associated subscription id
@@ -892,9 +892,9 @@ public final class SmsManager {
            iccISms = ISms.Stub.asInterface(ServiceManager.getService("isms"));
            return iccISms.getPreferredSmsSubscription();
        } catch (RemoteException ex) {
            return SubscriptionManager.INVALID_SUB_ID;
            return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        } catch (NullPointerException ex) {
            return SubscriptionManager.INVALID_SUB_ID;
            return SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        }
    }

+4 −1
Original line number Diff line number Diff line
@@ -78,8 +78,11 @@ public class IccProvider extends ContentProvider {
        URL_MATCHER.addURI("icc", "sdn/subId/#", SDN_SUB);
    }

    private SubscriptionManager mSubscriptionManager;

    @Override
    public boolean onCreate() {
        mSubscriptionManager = SubscriptionManager.from(getContext());
        return true;
    }

@@ -117,7 +120,7 @@ public class IccProvider extends ContentProvider {

    private Cursor loadAllSimContacts(int efType) {
        Cursor [] result;
        List<SubscriptionInfo> subInfoList = SubscriptionManager.getActiveSubscriptionInfoList();
        List<SubscriptionInfo> subInfoList = mSubscriptionManager.getActiveSubscriptionInfoList();

        if ((subInfoList == null) || (subInfoList.size() == 0)) {
            result = new Cursor[0];
+1 −1
Original line number Diff line number Diff line
@@ -343,7 +343,7 @@ public abstract class PhoneBase extends Handler implements Phone {
     */
    protected PhoneBase(String name, PhoneNotifier notifier, Context context, CommandsInterface ci,
            boolean unitTestMode) {
        this(name, notifier, context, ci, unitTestMode, SubscriptionManager.DEFAULT_PHONE_ID);
        this(name, notifier, context, ci, unitTestMode, SubscriptionManager.DEFAULT_PHONE_INDEX);
    }

    /**
+4 −4
Original line number Diff line number Diff line
@@ -222,7 +222,7 @@ public class PhoneFactory {
            if (!sMadeDefaults) {
                throw new IllegalStateException("Default phones haven't been made yet!");
                // CAF_MSIM FIXME need to introduce default phone id ?
            } else if (phoneId == SubscriptionManager.DEFAULT_PHONE_ID) {
            } else if (phoneId == SubscriptionManager.DEFAULT_PHONE_INDEX) {
                Rlog.d(LOG_TAG, "getPhone: phoneId == DEFAULT_PHONE_ID");
                phone = sProxyPhone;
            } else {
@@ -308,7 +308,7 @@ public class PhoneFactory {

    /* Gets User preferred Voice subscription setting*/
    public static int getVoiceSubscription() {
        int subId = SubscriptionManager.INVALID_SUB_ID;
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;

        try {
            subId = Settings.Global.getInt(sContext.getContentResolver(),
@@ -382,7 +382,7 @@ public class PhoneFactory {

    /* Gets User preferred Data subscription setting*/
    public static long getDataSubscription() {
        int subId = SubscriptionManager.INVALID_SUB_ID;
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;

        try {
            subId = Settings.Global.getInt(sContext.getContentResolver(),
@@ -404,7 +404,7 @@ public class PhoneFactory {

    /* Gets User preferred SMS subscription setting*/
    public static int getSMSSubscription() {
        int subId = SubscriptionManager.INVALID_SUB_ID;
        int subId = SubscriptionManager.INVALID_SUBSCRIPTION_ID;
        try {
            subId = Settings.Global.getInt(sContext.getContentResolver(),
                    Settings.Global.MULTI_SIM_SMS_SUBSCRIPTION);
Loading