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

Commit e0532246 authored by Hu Chunming's avatar Hu Chunming Committed by Linux Build Service Account
Browse files

Conditionally remove the 4G/3G SIM card option

Remove the 4G/3G SIM card option in multi-sim settings
if SIM cards inserted the device should not be setable.

CRs-Fixed: 737178

Change-Id: I11d61680d527302235d4ce63f30fd6e029e42e2e
parent 498eed33
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -28,6 +28,13 @@
            android:key="sim_activities"
            android:title="@string/sim_pref_divider">

        <Preference
            android:key="select_primary_sub"
            android:persistent="false"
            android:title="@string/primary_sub_select_title" >
            <intent android:action="codeaurora.intent.action.ACTION_LTE_CONFIGURE" />
        </Preference>

        <com.android.settings.notification.DropDownPreference
            android:key="sim_cellular_data"
            android:title="@string/cellular_data_title" />
@@ -42,10 +49,4 @@

    </PreferenceCategory>

    <Preference
        android:key="select_primary_sub"
        android:persistent="false"
        android:title="@string/primary_sub_select_title" >
            <intent android:action="com.android.phone.LTE_CONFIGURE" />
    </Preference>
</PreferenceScreen>
+15 −4
Original line number Diff line number Diff line
@@ -58,10 +58,12 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
    private static final boolean DBG = true;

    public static final String CONFIG_LTE_SUB_SELECT_MODE = "config_lte_sub_select_mode";
    private static final String CONFIG_PRIMARY_SUB_SETABLE = "config_primary_sub_setable";

    private static final String DISALLOW_CONFIG_SIM = "no_config_sim";
    private static final String SIM_ENABLER_CATEGORY = "sim_enablers";
    private static final String SIM_CARD_CATEGORY = "sim_cards";
    private static final String SIM_ACTIVITIES_CATEGORY = "sim_activities";
    private static final String KEY_CELLULAR_DATA = "sim_cellular_data";
    private static final String KEY_CALLS = "sim_calls";
    private static final String KEY_SMS = "sim_sms";
@@ -78,6 +80,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
     */
    private List<SubInfoRecord> mAvailableSubInfos = null;
    private List<SubInfoRecord> mSubInfoList = null;
    private Preference mPrimarySubSelect = null;

    private static List<MultiSimEnablerPreference> mSimEnablers = null;

@@ -86,7 +89,6 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
    private SubInfoRecord mSMS = null;

    private int mNumSims;
    private Preference mPrimarySubSelect = null;

    public SimSettings() {
        super(DISALLOW_CONFIG_SIM);
@@ -259,8 +261,17 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
    private void initLTEPreference() {
        boolean isPrimarySubFeatureEnable = SystemProperties
                .getBoolean("persist.radio.primarycard", false);
        if (!isPrimarySubFeatureEnable) {
            removePreference(KEY_PRIMARY_SUB_SELECT);

        boolean primarySetable = android.provider.Settings.Global.getInt(
                this.getContentResolver(), CONFIG_PRIMARY_SUB_SETABLE, 0) == 1;

        logd("isPrimarySubFeatureEnable :" + isPrimarySubFeatureEnable +
                " primarySetable :" + primarySetable);

        if (!isPrimarySubFeatureEnable || !primarySetable) {
            final PreferenceCategory simActivities =
                    (PreferenceCategory) findPreference(SIM_ACTIVITIES_CATEGORY);
            simActivities.removePreference(mPrimarySubSelect);
            return;
        }

@@ -269,7 +280,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable
        boolean isManualMode = android.provider.Settings.Global.getInt(
                this.getContentResolver(), CONFIG_LTE_SUB_SELECT_MODE, 1) == 0;

        Log.d(TAG, "init LTE primary slot : " + primarySlot + " isManualMode :" + isManualMode);
        logd("init LTE primary slot : " + primarySlot + " isManualMode :" + isManualMode);
        if (-1 != primarySlot) {
            SubInfoRecord subInfo = findRecordBySlotId(primarySlot);
            CharSequence lteSummary = (subInfo == null ) ? null : subInfo.displayName;