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

Commit 4b3808df authored by Muhammed Siju's avatar Muhammed Siju Committed by Steve Kondik
Browse files

Add support for default data subscription setting.

Default data subscription setting holds the default preference for data
subscription. It will be updated when user changes data preference,
sub deactivated or card removal.

Current set preferred data subscription API does not update the default
data subscription preference. This change is to handle temporary DDS switch
by apps like MMS.

New APIs to update and retrieve the default data subscription are added.

Change-Id: I495266cff2a5319c57279d9decb77d6a87bbfae8
CRs-Fixed: 642210
parent 2e00347e
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -7591,6 +7591,19 @@ public final class Settings {
          */
        public static final String MULTI_SIM_DATA_CALL_SUBSCRIPTION = "multi_sim_data_call";

        /**
          * Subscription set by user for data call on a multi sim device. The difference from
          * MULTI_SIM_DATA_CALL_SUBSCRIPTION is that this is the subscription that user set
          * originally. Where as MULTI_SIM_DATA_CALL_SUBSCRIPTION holds the current data call
          * subscription value, which could be different from user preferred value due to
          * temporary DDS switch for say a silent DDS switch for MMS transaction.
          * The value may change dynamically in case of a SIM removal or de activation.
          * The supported values are 0 = SUB1, 1 = SUB2, 2 = SUB3, etc.
          * @hide
          */
        public static final String MULTI_SIM_DEFAULT_DATA_CALL_SUBSCRIPTION
                = "multi_sim_defaut_data_call";

        /**
          * Subscription to be used for SMS on a multi sim device. The supported values
          * are 0 = SUB1, 1 = SUB2 and etc.
+30 −0
Original line number Diff line number Diff line
@@ -1029,8 +1029,24 @@ public class MSimTelephonyManager {
        }
    }

    /**
     * Returns the default preferred data subscription value.
     */
    public int getDefaultDataSubscription() {
        try {
            return getITelephonyMSim().getDefaultDataSubscription();
        } catch (RemoteException ex) {
            return MSimConstants.DEFAULT_SUBSCRIPTION;
        } catch (NullPointerException ex) {
            return MSimConstants.DEFAULT_SUBSCRIPTION;
        }
    }

    /**
     * Sets the designated data subscription.
     * This API may be used by apps which needs to switch the DDS temporarily
     * like MMS app. Default data subscription setting will not be updated by
     * this API.
     */
    public boolean setPreferredDataSubscription(int subscription) {
        try {
@@ -1042,6 +1058,20 @@ public class MSimTelephonyManager {
        }
    }

    /**
     * Sets the designated data subscription and updates the default data
     * subscription setting.
     */
    public boolean setDefaultDataSubscription(int subscription) {
        try {
            return getITelephonyMSim().setDefaultDataSubscription(subscription);
        } catch (RemoteException ex) {
            return false;
        } catch (NullPointerException ex) {
            return false;
        }
    }

    /**
     * Returns the preferred voice subscription.
     */
+14 −2
Original line number Diff line number Diff line
@@ -359,15 +359,27 @@ interface ITelephonyMSim {
    int getPreferredVoiceSubscription();

    /**
     * get user prefered data subscription
     * get current prefered data subscription
     * @return subscription id
     */
    int getPreferredDataSubscription();

    /**
     * get default prefered data subscription
     * @return subscription id
     */
    int getDefaultDataSubscription();

    /*
     * Set user prefered data subscription
     * Set current prefered data subscription temporarily.
     * @return true if success
     */
    boolean setPreferredDataSubscription(int subscription);

    /*
     * Set prefered data subscription and updates default data subscription.
     * @return true if success
     */
    boolean setDefaultDataSubscription(int subscription);
}