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

Commit ffa4a136 authored by Brad Ebinger's avatar Brad Ebinger Committed by android-build-merger
Browse files

Merge "Unable to make MO call after swapping SIM with CLIR enabled" am:...

Merge "Unable to make MO call after swapping SIM with CLIR enabled" am: 2c527431 am: 5975e2d9 am: 6a6b1b6f
am: 2d61f164

Change-Id: Ieae10fd28d3ce8fc57f3b977f13e0d459faca6ab
parents 2945dce0 2d61f164
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -2366,13 +2366,33 @@ public class GsmCdmaPhone extends Phone {
    @UnsupportedAppUsage
    private void syncClirSetting() {
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        int clirSetting = sp.getInt(CLIR_KEY + getPhoneId(), -1);
        Rlog.i(LOG_TAG, "syncClirSetting: " + CLIR_KEY + getPhoneId() + "=" + clirSetting);
        migrateClirSettingIfNeeded(sp);

        int clirSetting = sp.getInt(CLIR_KEY + getSubId(), -1);
        Rlog.i(LOG_TAG, "syncClirSetting: " + CLIR_KEY + getSubId() + "=" + clirSetting);
        if (clirSetting >= 0) {
            mCi.setCLIR(clirSetting, null);
        }
    }

    /**
     * Migrate CLIR setting with sudId mapping once if there's CLIR setting mapped with phoneId.
     */
    private void migrateClirSettingIfNeeded(SharedPreferences sp) {
        // Get old CLIR setting mapped with phoneId
        int clirSetting = sp.getInt("clir_key" + getPhoneId(), -1);
        if (clirSetting >= 0) {
            // Migrate CLIR setting to new shared preference key with subId
            Rlog.i(LOG_TAG, "Migrate CLIR setting: value=" + clirSetting + ", clir_key"
                    + getPhoneId() + " -> " + CLIR_KEY + getSubId());
            SharedPreferences.Editor editor = sp.edit();
            editor.putInt(CLIR_KEY + getSubId(), clirSetting);

            // Remove old CLIR setting key
            editor.remove("clir_key" + getPhoneId()).commit();
        }
    }

    private void handleRadioAvailable() {
        mCi.getBasebandVersion(obtainMessage(EVENT_GET_BASEBAND_VERSION_DONE));

+4 −4
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    private static final String CDMA_NON_ROAMING_LIST_OVERRIDE_PREFIX = "cdma_non_roaming_list_";

    // Key used to read/write current CLIR setting
    public static final String CLIR_KEY = "clir_key";
    public static final String CLIR_KEY = "clir_sub_key";

    // Key used for storing voice mail count
    private static final String VM_COUNT = "vm_count_key";
@@ -1486,9 +1486,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
        // Open the shared preferences editor, and write the value.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getContext());
        SharedPreferences.Editor editor = sp.edit();
        editor.putInt(CLIR_KEY + getPhoneId(), commandInterfaceCLIRMode);
        Rlog.i(LOG_TAG, "saveClirSetting: " + CLIR_KEY + getPhoneId() + "=" +
                commandInterfaceCLIRMode);
        editor.putInt(CLIR_KEY + getSubId(), commandInterfaceCLIRMode);
        Rlog.i(LOG_TAG, "saveClirSetting: " + CLIR_KEY + getSubId() + "="
                + commandInterfaceCLIRMode);

        // Commit and log the result.
        if (!editor.commit()) {
+1 −1
Original line number Diff line number Diff line
@@ -770,7 +770,7 @@ public class ImsPhoneCallTracker extends CallTracker implements ImsPullCall {
        if (mSharedPreferenceProxy != null && mPhone.getDefaultPhone() != null) {
            SharedPreferences sp = mSharedPreferenceProxy.getDefaultSharedPreferences(
                    mPhone.getContext());
            return sp.getInt(Phone.CLIR_KEY + mPhone.getDefaultPhone().getPhoneId(),
            return sp.getInt(Phone.CLIR_KEY + mPhone.getSubId(),
                    CommandsInterface.CLIR_DEFAULT);
        } else {
            loge("dial; could not get default CLIR mode.");
+1 −1
Original line number Diff line number Diff line
@@ -487,7 +487,7 @@ public class ImsPhoneCallTrackerTest extends TelephonyTest {
        }

        // Ensure that the correct key was queried from the shared prefs.
        assertEquals("clir_key0", mStringCaptor.getValue());
        assertEquals("clir_sub_key0", mStringCaptor.getValue());
    }

    /**