diff options
author | Sandeep Gutta <sangutta@codeaurora.org> | 2015-09-14 20:14:07 +0530 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2015-10-06 03:21:19 -0600 |
commit | 3d755752aced43b991c75c15a2812a7e7674601c (patch) | |
tree | 23b6d4f1f2ed5d9d7513c1f62e8ade80a3b5d431 | |
parent | d6fb73a880118eeb6fd4da7b0f364f2ce01df1ca (diff) | |
download | packages_apps_Settings-3d755752aced43b991c75c15a2812a7e7674601c.zip packages_apps_Settings-3d755752aced43b991c75c15a2812a7e7674601c.tar.gz packages_apps_Settings-3d755752aced43b991c75c15a2812a7e7674601c.tar.bz2 |
Telephony(MSIM): Select preferred primary sub.
Add UI to select preferred primary sub.
It is used when two SIM cards inserted have same
priority as per policy.
Change-Id: I5726fe9f4df03e680dc2406854d08da77297444d
-rw-r--r-- | res/values-zh-rCN/strings.xml | 2 | ||||
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | res/xml/sim_settings.xml | 7 | ||||
-rw-r--r-- | src/com/android/settings/sim/SimSettings.java | 66 |
4 files changed, 72 insertions, 5 deletions
diff --git a/res/values-zh-rCN/strings.xml b/res/values-zh-rCN/strings.xml index f3ff3af..9b5ccbe 100644 --- a/res/values-zh-rCN/strings.xml +++ b/res/values-zh-rCN/strings.xml @@ -2869,4 +2869,6 @@ <string name="write_settings_description" msgid="6868293938839954623">"此权限允许应用修改系统设置。"</string> <string name="write_settings_on" msgid="8230580416068832239">"允许"</string> <string name="write_settings_off" msgid="5156104383386336233">"不允许"</string> + + <string name="primary_sub_select_title">默认4G/3G SIM卡</string> </resources> diff --git a/res/values/strings.xml b/res/values/strings.xml index b830a66..adaac4b 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -6980,4 +6980,6 @@ <string name="sub_activate_failed">Activation failed.</string> <string name="sub_deactivate_success">Successfully Deactivated.</string> <string name="sub_deactivate_failed">Deactivation failed.</string> + + <string name="primary_sub_select_title">Default 4G/3G Subscription</string> </resources> diff --git a/res/xml/sim_settings.xml b/res/xml/sim_settings.xml index 273a9b8..620cbcf 100644 --- a/res/xml/sim_settings.xml +++ b/res/xml/sim_settings.xml @@ -25,6 +25,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> + <Preference android:key="sim_cellular_data" android:title="@string/cellular_data_title" /> diff --git a/src/com/android/settings/sim/SimSettings.java b/src/com/android/settings/sim/SimSettings.java index b8f34aa..8639f6c 100644 --- a/src/com/android/settings/sim/SimSettings.java +++ b/src/com/android/settings/sim/SimSettings.java @@ -31,6 +31,7 @@ import android.os.Handler; import android.os.Message; import android.os.RemoteException; import android.os.ServiceManager; +import android.os.SystemProperties; import android.preference.Preference; import android.preference.PreferenceScreen; import android.preference.PreferenceCategory; @@ -58,7 +59,6 @@ import com.android.settings.Utils; import com.android.settings.search.BaseSearchIndexProvider; import com.android.settings.search.Indexable; import com.android.settings.R; -import android.os.SystemProperties; import com.android.internal.telephony.IExtTelephony; import com.android.internal.telephony.TelephonyProperties; @@ -82,6 +82,8 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable private static final String KEY_CALLS = "sim_calls"; private static final String KEY_SMS = "sim_sms"; public static final String EXTRA_SLOT_ID = "slot_id"; + private static final String SIM_ACTIVITIES_CATEGORY = "sim_activities"; + private static final String KEY_PRIMARY_SUB_SELECT = "select_primary_sub"; /** * By UX design we use only one Subscription Information(SubInfo) record per SIM slot. @@ -102,10 +104,17 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable private boolean needUpdate = false; private int mPhoneCount = TelephonyManager.getDefault().getPhoneCount(); private int[] mUiccProvisionStatus = new int[mPhoneCount]; + private Preference mPrimarySubSelect = null; - static final String ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED = + private static final String ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED = "org.codeaurora.intent.action.ACTION_UICC_MANUAL_PROVISION_STATUS_CHANGED"; - static final String EXTRA_NEW_PROVISION_STATE = "newProvisionState"; + private static final String EXTRA_NEW_PROVISION_STATE = "newProvisionState"; + private 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 CONFIG_CURRENT_PRIMARY_SUB = "config_current_primary_sub"; + // If this config set to '1' DDS option would be greyed out on UI. + // For more info pls refere framework code. + private static final String CONFIG_DISABLE_DDS_PREFERENCE = "config_disable_dds_preference"; public SimSettings() { super(DISALLOW_CONFIG_SIM); @@ -126,6 +135,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); addPreferencesFromResource(R.xml.sim_settings); + mPrimarySubSelect = (Preference) findPreference(KEY_PRIMARY_SUB_SELECT); mNumSlots = tm.getSimCount(); mSimCards = (PreferenceCategory)findPreference(SIM_CARD_CATEGORY); mAvailableSubInfos = new ArrayList<SubscriptionInfo>(mNumSlots); @@ -223,7 +233,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable } else if (sir == null) { simPref.setSummary(R.string.sim_selection_required_pref); } - simPref.setEnabled(mSelectableSubInfos.size() > 1); + simPref.setEnabled(mSelectableSubInfos.size() > 1 && !disableDds()); } private void updateCallValues() { @@ -248,6 +258,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable final TelephonyManager tm = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); tm.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE); + initLTEPreference(); updateSubscriptions(); } @@ -280,7 +291,7 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable final boolean ecbMode = SystemProperties.getBoolean( TelephonyProperties.PROPERTY_INECM_MODE, false); pref.setEnabled((state == TelephonyManager.CALL_STATE_IDLE) && !ecbMode - && (mSelectableSubInfos.size() > 1)); + && (mSelectableSubInfos.size() > 1) && !disableDds()); } } }; @@ -305,6 +316,8 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable } else if (findPreference(KEY_SMS) == preference) { intent.putExtra(SimDialogActivity.DIALOG_TYPE_KEY, SimDialogActivity.SMS_PICK); context.startActivity(intent); + } else if (preference == mPrimarySubSelect) { + startActivity(mPrimarySubSelect.getIntent()); } return true; @@ -887,4 +900,47 @@ public class SimSettings extends RestrictedSettingsFragment implements Indexable } } }; + + // When primarycard feature enabled this provides menu option for user + // to view/select current primary slot. + private void initLTEPreference() { + boolean isPrimarySubFeatureEnable = + SystemProperties.getBoolean("persist.radio.primarycard", false); + boolean primarySetable = Settings.Global.getInt(mContext.getContentResolver(), + CONFIG_PRIMARY_SUB_SETABLE, 0) == 1; + + log("isPrimarySubFeatureEnable :" + isPrimarySubFeatureEnable + + " primarySetable :" + primarySetable); + + if (!isPrimarySubFeatureEnable || !primarySetable) { + final PreferenceCategory simActivities = + (PreferenceCategory) findPreference(SIM_ACTIVITIES_CATEGORY); + simActivities.removePreference(mPrimarySubSelect); + return; + } + int currentPrimarySlot = Settings.Global.getInt(mContext.getContentResolver(), + CONFIG_CURRENT_PRIMARY_SUB, SubscriptionManager.INVALID_SIM_SLOT_INDEX); + boolean isManualMode = Settings.Global.getInt(mContext.getContentResolver(), + CONFIG_LTE_SUB_SELECT_MODE, 1) == 0; + + log("init LTE primary slot : " + currentPrimarySlot + " isManualMode :" + isManualMode); + + if (SubscriptionManager.isValidSlotId(currentPrimarySlot)) { + final SubscriptionInfo subInfo = mSubscriptionManager + .getActiveSubscriptionInfoForSimSlotIndex(currentPrimarySlot); + CharSequence lteSummary = (subInfo == null ) ? null : subInfo.getDisplayName(); + mPrimarySubSelect.setSummary(lteSummary); + } else { + mPrimarySubSelect.setSummary(""); + } + mPrimarySubSelect.setEnabled(isManualMode); + } + + private boolean disableDds() { + boolean disableDds = Settings.Global.getInt(mContext.getContentResolver(), + CONFIG_DISABLE_DDS_PREFERENCE, 0) == 1; + + log(" config disable dds = " + disableDds); + return disableDds; + } } |