summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/sim
diff options
context:
space:
mode:
authorSandeep Gutta <sangutta@codeaurora.org>2015-09-14 20:14:07 +0530
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:21:19 -0600
commit3d755752aced43b991c75c15a2812a7e7674601c (patch)
tree23b6d4f1f2ed5d9d7513c1f62e8ade80a3b5d431 /src/com/android/settings/sim
parentd6fb73a880118eeb6fd4da7b0f364f2ce01df1ca (diff)
downloadpackages_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
Diffstat (limited to 'src/com/android/settings/sim')
-rw-r--r--src/com/android/settings/sim/SimSettings.java66
1 files changed, 61 insertions, 5 deletions
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;
+ }
}