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

Commit 1584a505 authored by Naveen Kalla's avatar Naveen Kalla
Browse files

Initialize RIL with the correct CDMA subscription mode setting

Users choice of CDMA Subscription Source is stored in CDMA_SUBSCRIPTION_MODE
setting in database.
If telephony restarts after a crash, use CDMA_SUBSCRIPTION_MODE instead
of PREFERRED_CDMA_SUBSCRIPTION in PhoneFactory to prevent
mismatch with the value in the settings database chosen by the user.

Also, remove the Setting PREFERRED_CDMA_SUBSCRIPTION from the database.
With this change the special treatment for LTE on CDMA will not be needed.
The correct value can be set in the database for CDMA_SUBSCRIPTION_MODE
and that will be taken on power-up by this code.

Change-Id: I11fff596a5fe721c64f192c889672326517dc43d
parent b8127144
Loading
Loading
Loading
Loading
+1 −27
Original line number Original line Diff line number Diff line
@@ -48,9 +48,6 @@ public class PhoneFactory {
    static private Looper sLooper;
    static private Looper sLooper;
    static private Context sContext;
    static private Context sContext;


    static final int sPreferredCdmaSubscription =
                         CdmaSubscriptionSourceManager.PREFERRED_CDMA_SUBSCRIPTION;

    //***** Class Methods
    //***** Class Methods


    public static void makeDefaultPhones(Context context) {
    public static void makeDefaultPhones(Context context) {
@@ -108,30 +105,7 @@ public class PhoneFactory {
                        Settings.Global.PREFERRED_NETWORK_MODE, preferredNetworkMode);
                        Settings.Global.PREFERRED_NETWORK_MODE, preferredNetworkMode);
                Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkMode));
                Rlog.i(LOG_TAG, "Network Mode set to " + Integer.toString(networkMode));


                // Get cdmaSubscription
                int cdmaSubscription = CdmaSubscriptionSourceManager.getDefault(context);
                // TODO: Change when the ril will provides a way to know at runtime
                //       the configuration, bug 4202572. And the ril issues the
                //       RIL_UNSOL_CDMA_SUBSCRIPTION_SOURCE_CHANGED, bug 4295439.
                int cdmaSubscription;
                int lteOnCdma = TelephonyManager.getLteOnCdmaModeStatic();
                switch (lteOnCdma) {
                    case PhoneConstants.LTE_ON_CDMA_FALSE:
                        cdmaSubscription = CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_NV;
                        Rlog.i(LOG_TAG, "lteOnCdma is 0 use SUBSCRIPTION_FROM_NV");
                        break;
                    case PhoneConstants.LTE_ON_CDMA_TRUE:
                        cdmaSubscription = CdmaSubscriptionSourceManager.SUBSCRIPTION_FROM_RUIM;
                        Rlog.i(LOG_TAG, "lteOnCdma is 1 use SUBSCRIPTION_FROM_RUIM");
                        break;
                    case PhoneConstants.LTE_ON_CDMA_UNKNOWN:
                    default:
                        //Get cdmaSubscription mode from Settings.System
                        cdmaSubscription = Settings.Global.getInt(context.getContentResolver(),
                                Settings.Global.PREFERRED_CDMA_SUBSCRIPTION,
                                sPreferredCdmaSubscription);
                        Rlog.i(LOG_TAG, "lteOnCdma not set, using PREFERRED_CDMA_SUBSCRIPTION");
                        break;
                }
                Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription);
                Rlog.i(LOG_TAG, "Cdma Subscription set to " + cdmaSubscription);


                //reads the system properties and makes commandsinterface
                //reads the system properties and makes commandsinterface
+3 −3
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ public class CdmaSubscriptionSourceManager extends Handler {
        mCi = ci;
        mCi = ci;
        mCi.registerForCdmaSubscriptionChanged(this, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
        mCi.registerForCdmaSubscriptionChanged(this, EVENT_CDMA_SUBSCRIPTION_SOURCE_CHANGED, null);
        mCi.registerForOn(this, EVENT_RADIO_ON, null);
        mCi.registerForOn(this, EVENT_RADIO_ON, null);
        int subscriptionSource = getDefaultCdmaSubscriptionSource();
        int subscriptionSource = getDefault(context);
        mCdmaSubscriptionSource.set(subscriptionSource);
        mCdmaSubscriptionSource.set(subscriptionSource);
    }
    }


@@ -134,9 +134,9 @@ public class CdmaSubscriptionSourceManager extends Handler {
     *
     *
     * @return Default CDMA subscription source from Settings DB if present.
     * @return Default CDMA subscription source from Settings DB if present.
     */
     */
    private int getDefaultCdmaSubscriptionSource() {
    public static int getDefault(Context context) {
        // Get the default value from the Settings
        // Get the default value from the Settings
        int subscriptionSource = Settings.Global.getInt(mContext.getContentResolver(),
        int subscriptionSource = Settings.Global.getInt(context.getContentResolver(),
                Settings.Global.CDMA_SUBSCRIPTION_MODE, PREFERRED_CDMA_SUBSCRIPTION);
                Settings.Global.CDMA_SUBSCRIPTION_MODE, PREFERRED_CDMA_SUBSCRIPTION);
        return subscriptionSource;
        return subscriptionSource;
    }
    }