Merge "Don't set settings titles for single SIM devices." into lmp-mr1-dev
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index 1d054a6..c516dda 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -1124,7 +1124,7 @@
mSetupVoicemail = mShowVoicemailPreference &&
getIntent().getBooleanExtra(SETUP_VOICEMAIL_EXTRA, false);
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mSubscriptionInfoHelper.setActionBarTitle(
getActionBar(), getResources(), R.string.call_settings_with_label);
mPhone = mSubscriptionInfoHelper.getPhone();
@@ -1257,19 +1257,19 @@
addPreferencesFromResource(R.xml.cdma_call_privacy);
}
} else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
- fdnButton.setIntent(mSubscriptionInfoHelper.getIntent(this, FdnSetting.class));
+ fdnButton.setIntent(mSubscriptionInfoHelper.getIntent(FdnSetting.class));
if (getResources().getBoolean(R.bool.config_additional_call_setting)) {
addPreferencesFromResource(R.xml.gsm_umts_call_options);
Preference callForwardingPref = prefSet.findPreference(CALL_FORWARDING_KEY);
callForwardingPref.setIntent(mSubscriptionInfoHelper.getIntent(
- this, GsmUmtsCallForwardOptions.class));
+ GsmUmtsCallForwardOptions.class));
Preference additionalGsmSettingsPref =
prefSet.findPreference(ADDITIONAL_GSM_SETTINGS_KEY);
additionalGsmSettingsPref.setIntent(mSubscriptionInfoHelper.getIntent(
- this, GsmUmtsAdditionalCallOptions.class));
+ GsmUmtsAdditionalCallOptions.class));
}
} else {
throw new IllegalStateException("Unexpected phone type: " + phoneType);
@@ -1432,8 +1432,8 @@
* This is useful for implementing "HomeAsUp" capability for second-level Settings.
*/
public static void goUpToTopLevelSetting(
- Activity activity, SubscriptionInfoHelper subscriptionInfoHelper) {
- Intent intent = subscriptionInfoHelper.getIntent(activity, CallFeaturesSetting.class);
+ Activity activity, SubscriptionInfoHelper subscriptionInfoHelper) {
+ Intent intent = subscriptionInfoHelper.getIntent(CallFeaturesSetting.class);
intent.setAction(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
activity.startActivity(intent);
diff --git a/src/com/android/phone/GsmUmtsAdditionalCallOptions.java b/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
index 30ce1fa..88d32fb 100644
--- a/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
+++ b/src/com/android/phone/GsmUmtsAdditionalCallOptions.java
@@ -33,7 +33,7 @@
addPreferencesFromResource(R.xml.gsm_umts_additional_options);
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mSubscriptionInfoHelper.setActionBarTitle(
getActionBar(), getResources(), R.string.additional_gsm_call_settings_with_label);
mPhone = mSubscriptionInfoHelper.getPhone();
diff --git a/src/com/android/phone/GsmUmtsCallForwardOptions.java b/src/com/android/phone/GsmUmtsCallForwardOptions.java
index fe27850..5a16edc 100644
--- a/src/com/android/phone/GsmUmtsCallForwardOptions.java
+++ b/src/com/android/phone/GsmUmtsCallForwardOptions.java
@@ -53,7 +53,7 @@
addPreferencesFromResource(R.xml.callforward_options);
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mSubscriptionInfoHelper.setActionBarTitle(
getActionBar(), getResources(), R.string.call_forwarding_settings_with_label);
mPhone = mSubscriptionInfoHelper.getPhone();
diff --git a/src/com/android/phone/SubscriptionInfoHelper.java b/src/com/android/phone/SubscriptionInfoHelper.java
index f325b1a..9f0ebd0 100644
--- a/src/com/android/phone/SubscriptionInfoHelper.java
+++ b/src/com/android/phone/SubscriptionInfoHelper.java
@@ -22,6 +22,7 @@
import android.content.res.Resources;
import android.telephony.SubscriptionInfo;
import android.telephony.SubscriptionManager;
+import android.telephony.TelephonyManager;
import android.text.TextUtils;
import com.android.phone.PhoneGlobals;
@@ -45,24 +46,26 @@
private static final String SUB_LABEL_EXTRA =
"com.android.phone.settings.SubscriptionInfoHelper.SubscriptionLabel";
+ private static Context mContext;
+
private static int mSubId = NO_SUB_ID;
private static String mSubLabel;
/**
* Instantiates the helper, by extracting the subscription id and label from the intent.
*/
- public SubscriptionInfoHelper(Intent intent) {
+ public SubscriptionInfoHelper(Context context, Intent intent) {
+ mContext = context;
mSubId = intent.getIntExtra(SUB_ID_EXTRA, NO_SUB_ID);
mSubLabel = intent.getStringExtra(SUB_LABEL_EXTRA);
}
/**
- * @param context The context.
* @param newActivityClass The class of the activity for the intent to start.
* @return Intent containing extras for the subscription id and label if they exist.
*/
- public Intent getIntent(Context context, Class newActivityClass) {
- Intent intent = new Intent(context, newActivityClass);
+ public Intent getIntent(Class newActivityClass) {
+ Intent intent = new Intent(mContext, newActivityClass);
if (hasSubId()) {
intent.putExtra(SUB_ID_EXTRA, mSubId);
@@ -106,6 +109,10 @@
return;
}
+ if (!TelephonyManager.from(mContext).isMultiSimEnabled()) {
+ return;
+ }
+
String title = String.format(res.getString(resId), mSubLabel);
actionBar.setTitle(title);
}
diff --git a/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java b/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java
index d54de43..fa32a25 100644
--- a/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java
@@ -95,7 +95,7 @@
private void resolveIntent() {
Intent intent = getIntent();
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(intent);
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, intent);
mName = intent.getStringExtra(INTENT_EXTRA_NAME);
mNumber = intent.getStringExtra(INTENT_EXTRA_NUMBER);
diff --git a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
index 944eaad..00bd9fc 100644
--- a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
@@ -216,7 +216,7 @@
private void resolveIntent() {
Intent intent = getIntent();
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(intent);
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, intent);
mName = intent.getStringExtra(INTENT_EXTRA_NAME);
mNumber = intent.getStringExtra(INTENT_EXTRA_NUMBER);
@@ -335,7 +335,7 @@
private void deleteSelected() {
// delete ONLY if this is NOT a new contact.
if (!mAddContact) {
- Intent intent = mSubscriptionInfoHelper.getIntent(this, DeleteFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(DeleteFdnContactScreen.class);
intent.putExtra(INTENT_EXTRA_NAME, mName);
intent.putExtra(INTENT_EXTRA_NUMBER, mNumber);
startActivity(intent);
diff --git a/src/com/android/phone/settings/fdn/FdnList.java b/src/com/android/phone/settings/fdn/FdnList.java
index d7bfde2..0174a82 100644
--- a/src/com/android/phone/settings/fdn/FdnList.java
+++ b/src/com/android/phone/settings/fdn/FdnList.java
@@ -57,7 +57,7 @@
actionBar.setDisplayHomeAsUpEnabled(true);
}
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mSubscriptionInfoHelper.setActionBarTitle(
getActionBar(), getResources(), R.string.fdn_list_with_label);
}
@@ -101,7 +101,7 @@
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home: // See ActionBar#setDisplayHomeAsUpEnabled()
- Intent intent = mSubscriptionInfoHelper.getIntent(this, FdnSetting.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(FdnSetting.class);
intent.setAction(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
@@ -132,7 +132,7 @@
private void addContact() {
//If there is no INTENT_EXTRA_NAME provided, EditFdnContactScreen treats it as an "add".
- Intent intent = mSubscriptionInfoHelper.getIntent(this, EditFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(EditFdnContactScreen.class);
startActivity(intent);
}
@@ -154,7 +154,7 @@
String name = mCursor.getString(NAME_COLUMN);
String number = mCursor.getString(NUMBER_COLUMN);
- Intent intent = mSubscriptionInfoHelper.getIntent(this, EditFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(EditFdnContactScreen.class);
intent.putExtra(INTENT_EXTRA_NAME, name);
intent.putExtra(INTENT_EXTRA_NUMBER, number);
startActivity(intent);
@@ -166,7 +166,7 @@
String name = mCursor.getString(NAME_COLUMN);
String number = mCursor.getString(NUMBER_COLUMN);
- Intent intent = mSubscriptionInfoHelper.getIntent(this, DeleteFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(DeleteFdnContactScreen.class);
intent.putExtra(INTENT_EXTRA_NAME, name);
intent.putExtra(INTENT_EXTRA_NUMBER, number);
startActivity(intent);
diff --git a/src/com/android/phone/settings/fdn/FdnSetting.java b/src/com/android/phone/settings/fdn/FdnSetting.java
index acbe0b8..b825f7a 100644
--- a/src/com/android/phone/settings/fdn/FdnSetting.java
+++ b/src/com/android/phone/settings/fdn/FdnSetting.java
@@ -455,7 +455,7 @@
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
- mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(this, getIntent());
mPhone = mSubscriptionInfoHelper.getPhone();
addPreferencesFromResource(R.xml.fdn_setting);
@@ -473,7 +473,7 @@
PreferenceScreen fdnListPref =
(PreferenceScreen) prefSet.findPreference(FDN_LIST_PREF_SCREEN_KEY);
- fdnListPref.setIntent(mSubscriptionInfoHelper.getIntent(this, FdnList.class));
+ fdnListPref.setIntent(mSubscriptionInfoHelper.getIntent(FdnList.class));
// Only reset the pin change dialog if we're not in the middle of changing it.
if (icicle == null) {