am 6124877e: am 5ed870cc: Add MSIM support for FDN.
* commit '6124877e40ae3159826c2f50a4f3baf459e2c591':
Add MSIM support for FDN.
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 4c7f558..5701dfb 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -180,7 +180,7 @@
<!-- Cell Broadcast settings title. [CHAR LIMIT=50] -->
<string name="cell_broadcast_settings">Emergency broadcasts</string>
<!-- Call settings screen title -->
- <string name="call_settings">Call Settings</string>
+ <string name="call_settings">Call settings</string>
<!-- GSM Call settings screen, setting option name -->
<string name="additional_gsm_call_settings">Additional settings</string>
<!-- GSM-only Call settings screen, setting option name-->
@@ -260,6 +260,8 @@
<!-- Title of the progress dialog displayed while updating Call settings -->
<string name="updating_title">Call settings</string>
+ <!-- Title of the "Call settings" settings screen, with a text label identifying which SIM the settings are for. -->
+ <string name="call_settings_with_label">Call settings (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Title of the alert dialog displayed if an error occurs while updating Call settings -->
<string name="error_updating_title">Call settings error</string>
<!-- Toast in Call settings dialog while settings are being read -->
@@ -688,11 +690,17 @@
<string name="carrier_settings_title">Carrier settings</string>
<!-- FDN settings strings -->
- <!-- Call settings screen, setting option name -->
+ <!-- Label for "Fixed Dialing Number" settings in call settings. -->
<string name="fdn">Fixed Dialing Numbers</string>
- <!-- Call settings screen, button label that takes you to
- the Fixed Dialing Number management screen -->
+ <!-- Title for "Fixed Dialing Number" settings, with a label to identify the SIM the settings
+ apply to. -->
+ <string name="fdn_with_label">Fixed Dialing Numbers (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
+
+ <!-- Call settings screen, button label that takes you to the Fixed Dialing Number management screen -->
<string name="manage_fdn_list">FDN list</string>
+ <!-- Title for settings screen to manage Fixed Dialing Number contacts, with a label to identify
+ the SIM the settings apply to. -->
+ <string name="fdn_list_with_label">FDN list (<xliff:g id="subscriptionlabel" example="Verizon">%s</xliff:g>)</string>
<!-- Call settings screen, preference item label -->
<string name="fdn_activation">FDN activation</string>
<!-- Call settings setting option name when FDN is enabled -->
@@ -854,9 +862,6 @@
<!-- SIM PIN screen: button label -->
<string name="doneButton">Done</string>
- <!-- In-call screen: status label for a conference call -->
- <string name="caller_manage_header">Conference call <xliff:g id="conf_call_time">%s</xliff:g></string>
-
<!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. -->
<string name="fake_phone_activity_phoneNumber_text" translatable="false">(650) 555-1234</string>
<!-- Used in FakePhoneActivity test code. DO NOT TRANSLATE. -->
@@ -884,9 +889,6 @@
<string name="card_title_hanging_up">Hanging up</string>
<!-- In-call screen: status label for a call that's in CDMA flash mode -->
<string name="card_title_in_call">In call</string>
- <!-- In-call screen: special status label that shows your own phone
- number during emergency callback mode (ECM) [CHAR LIMIT=30] -->
- <string name="card_title_my_phone_number">My number is <xliff:g id="my_phone_number">%s</xliff:g></string>
<!-- Notification strings -->
<!-- The "label" of the in-call Notification for a dialing call, used
diff --git a/res/xml/call_feature_setting.xml b/res/xml/call_feature_setting.xml
index bcda6b0..0182ac0 100644
--- a/res/xml/call_feature_setting.xml
+++ b/res/xml/call_feature_setting.xml
@@ -15,7 +15,7 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:phone="http://schemas.android.com/apk/res/com.android.phone"
- android:title="@string/updating_title">
+ android:title="@string/call_settings">
<PreferenceScreen
android:key="phone_account_settings_preference_screen"
@@ -81,13 +81,7 @@
<PreferenceScreen
android:key="button_fdn_key"
android:title="@string/fdn"
- android:persistent="false">
-
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.phone.settings.fdn.FdnSetting" />
-
- </PreferenceScreen>
+ android:persistent="false" />
<CheckBoxPreference
android:key="button_enable_video_calling"
diff --git a/res/xml/fdn_setting.xml b/res/xml/fdn_setting.xml
index d03cf7c..7501dc8 100644
--- a/res/xml/fdn_setting.xml
+++ b/res/xml/fdn_setting.xml
@@ -30,17 +30,12 @@
android:summary="@string/sum_fdn_change_pin"
android:persistent="false"/>
+ <!-- The intent to launch the FDN List is set on this PreferenceScreen in FdnSetting, so that
+ its extras can be dynamically changed to include subscription information. -->
<PreferenceScreen
- android:key="button_fdn_list_key"
+ android:key="fdn_list_pref_screen_key"
android:title="@string/manage_fdn_list"
android:summary="@string/sum_fdn_manage_list"
- android:persistent="false">
-
- <!-- Intent to lauch the FDN list. -->
- <intent android:action="android.intent.action.MAIN"
- android:targetPackage="com.android.phone"
- android:targetClass="com.android.phone.settings.fdn.FdnList" />
-
- </PreferenceScreen>
+ android:persistent="false"/>
</PreferenceScreen>
diff --git a/src/com/android/phone/CallFeaturesSetting.java b/src/com/android/phone/CallFeaturesSetting.java
index d254f8f..5c11521 100644
--- a/src/com/android/phone/CallFeaturesSetting.java
+++ b/src/com/android/phone/CallFeaturesSetting.java
@@ -64,6 +64,7 @@
import com.android.phone.settings.AccountSelectionPreference;
import com.android.phone.settings.VoicemailProviderSettings;
import com.android.phone.settings.VoicemailProviderSettingsUtil;
+import com.android.phone.settings.fdn.FdnSetting;
import com.android.services.telephony.sip.SipUtil;
import java.lang.String;
@@ -114,13 +115,6 @@
// to trigger its configuration UI
public static final String ACTION_CONFIGURE_VOICEMAIL =
"com.android.phone.CallFeaturesSetting.CONFIGURE_VOICEMAIL";
- // Extra on intent to Call Settings containing the id of the subscription to modify.
- public static final String SUB_ID_EXTRA =
- "com.android.phone.CallFeaturesSetting.SubscriptionId";
- // Extra on intent to Call Settings containing the label of the subscription to modify.
- public static final String SUB_LABEL_EXTRA =
- "com.android.phone.CallFeaturesSetting.SubscriptionLabel";
-
// Extra put in the return from VM provider config containing voicemail number to set
public static final String VM_NUMBER_EXTRA = "com.android.phone.VoicemailNumber";
// Extra put in the return from VM provider config containing call forwarding number to set
@@ -215,6 +209,8 @@
private static final String VOICEMAIL_VIBRATION_ALWAYS = "always";
private static final String VOICEMAIL_VIBRATION_NEVER = "never";
+ private SubscriptionInfoHelper mSubscriptionInfoHelper;
+
private EditPhoneNumberPreference mSubMenuVoicemailSettings;
/** Whether dialpad plays DTMF tone or not. */
@@ -1250,7 +1246,7 @@
} else if (id == VOICEMAIL_FWD_SAVING_DIALOG || id == VOICEMAIL_FWD_READING_DIALOG ||
id == VOICEMAIL_REVERTING_DIALOG) {
ProgressDialog dialog = new ProgressDialog(this);
- dialog.setTitle(getText(R.string.updating_title));
+ dialog.setTitle(getText(R.string.call_settings));
dialog.setIndeterminate(true);
dialog.setCancelable(false);
dialog.setMessage(getText(
@@ -1319,7 +1315,11 @@
// ACTION_ADD_VOICEMAIL action.
mShowVoicemailPreference = (icicle == null) &&
getIntent().getAction().equals(ACTION_ADD_VOICEMAIL);
- }
+
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper.setActionBarTitle(
+ getActionBar(), getResources(), R.string.call_settings_with_label);
+ }
private void initPhoneAccountPreferences() {
mPhoneAccountSettingsPreference = findPreference(PHONE_ACCOUNT_SETTINGS_KEY);
@@ -1350,6 +1350,7 @@
}
addPreferencesFromResource(R.xml.call_feature_setting);
+
initPhoneAccountPreferences();
PreferenceScreen prefSet = getPreferenceScreen();
@@ -1427,15 +1428,16 @@
}
int phoneType = mPhone.getPhoneType();
+ Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
if (phoneType == PhoneConstants.PHONE_TYPE_CDMA) {
- Preference fdnButton = prefSet.findPreference(BUTTON_FDN_KEY);
- if (fdnButton != null) {
- prefSet.removePreference(fdnButton);
- }
+ prefSet.removePreference(fdnButton);
+
if (!getResources().getBoolean(R.bool.config_voice_privacy_disable)) {
addPreferencesFromResource(R.xml.cdma_call_privacy);
}
} else if (phoneType == PhoneConstants.PHONE_TYPE_GSM) {
+ fdnButton.setIntent(mSubscriptionInfoHelper.getIntent(this, FdnSetting.class));
+
if (getResources().getBoolean(R.bool.config_additional_call_setting)) {
addPreferencesFromResource(R.xml.gsm_umts_call_options);
}
diff --git a/src/com/android/phone/SubscriptionInfoHelper.java b/src/com/android/phone/SubscriptionInfoHelper.java
new file mode 100644
index 0000000..926a156
--- /dev/null
+++ b/src/com/android/phone/SubscriptionInfoHelper.java
@@ -0,0 +1,116 @@
+/**
+ * Copyright (C) 2014 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License
+ */
+
+package com.android.phone;
+
+import android.app.ActionBar;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.telephony.SubInfoRecord;
+import android.telephony.SubscriptionManager;
+import android.text.TextUtils;
+
+import com.android.phone.PhoneGlobals;
+import com.android.internal.telephony.Phone;
+import com.android.internal.telephony.PhoneFactory;
+
+/**
+ * Helper for manipulating intents or components with subscription-related information.
+ *
+ * In settings, subscription ids and labels are passed along to indicate that settings
+ * are being changed for particular subscriptions. This helper provides functions for
+ * helping extract this info and perform common operations using this info.
+ */
+public class SubscriptionInfoHelper {
+ private static final int NO_SUB_ID = -1;
+
+ // Extra on intent containing the id of a subscription.
+ private static final String SUB_ID_EXTRA =
+ "com.android.phone.settings.SubscriptionInfoHelper.SubscriptionId";
+ // Extra on intent containing the label of a subscription.
+ private static final String SUB_LABEL_EXTRA =
+ "com.android.phone.settings.SubscriptionInfoHelper.SubscriptionLabel";
+
+ 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) {
+ 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);
+
+ if (hasSubId()) {
+ intent.putExtra(SUB_ID_EXTRA, mSubId);
+ }
+
+ if (!TextUtils.isEmpty(mSubLabel)) {
+ intent.putExtra(SUB_LABEL_EXTRA, mSubLabel);
+ }
+
+ return intent;
+ }
+
+ public static void addExtrasToIntent(Intent intent, SubInfoRecord subscription) {
+ intent.putExtra(SubscriptionInfoHelper.SUB_ID_EXTRA, subscription.getSubscriptionId());
+ intent.putExtra(
+ SubscriptionInfoHelper.SUB_LABEL_EXTRA, subscription.getDisplayName().toString());
+ }
+
+ /**
+ * @return Phone object. If a subscription id exists, it returns the phone for the id.
+ */
+ public Phone getPhone() {
+ return hasSubId()
+ ? PhoneFactory.getPhone(SubscriptionManager.getPhoneId(mSubId))
+ : PhoneGlobals.getPhone();
+ }
+
+ /**
+ * Sets the action bar title to the string specified by the given resource id, formatting
+ * it with the subscription label. This assumes the resource string is formattable with a
+ * string-type specifier.
+ *
+ * If the subscription label does not exists, leave the existing title.
+ */
+ public void setActionBarTitle(ActionBar actionBar, Resources res, int resId) {
+ if (actionBar == null || TextUtils.isEmpty(mSubLabel)) {
+ return;
+ }
+
+ String title = String.format(res.getString(resId), mSubLabel);
+ actionBar.setTitle(title);
+ }
+
+ public boolean hasSubId() {
+ return mSubId != NO_SUB_ID;
+ }
+
+ public int getSubId() {
+ return mSubId;
+ }
+}
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 09083ac..6f436fd 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -19,6 +19,7 @@
import com.android.phone.R;
import com.android.phone.CallFeaturesSetting;
+import com.android.phone.SubscriptionInfoHelper;
import com.android.services.telephony.sip.SipAccountRegistry;
import com.android.services.telephony.sip.SipSharedPreferences;
import com.android.services.telephony.sip.SipUtil;
@@ -294,8 +295,8 @@
for (SubInfoRecord subscription : SubscriptionManager.getActiveSubInfoList()) {
CharSequence label = subscription.getDisplayName();
Intent intent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS);
- intent.putExtra(CallFeaturesSetting.SUB_ID_EXTRA, subscription.getSubscriptionId());
- intent.putExtra(CallFeaturesSetting.SUB_LABEL_EXTRA, label);
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ SubscriptionInfoHelper.addExtrasToIntent(intent, subscription);
Preference accountPreference = new Preference(mApplicationContext);
accountPreference.setTitle(label);
diff --git a/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java b/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java
index c0fc1e8..d54de43 100644
--- a/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/DeleteFdnContactScreen.java
@@ -31,6 +31,7 @@
import com.android.phone.PhoneGlobals;
import com.android.phone.R;
+import com.android.phone.SubscriptionInfoHelper;
import static android.view.Window.PROGRESS_VISIBILITY_OFF;
import static android.view.Window.PROGRESS_VISIBILITY_ON;
@@ -47,6 +48,8 @@
private static final int PIN2_REQUEST_CODE = 100;
+ private SubscriptionInfoHelper mSubscriptionInfoHelper;
+
private String mName;
private String mNumber;
private String mPin2;
@@ -92,6 +95,8 @@
private void resolveIntent() {
Intent intent = getIntent();
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(intent);
+
mName = intent.getStringExtra(INTENT_EXTRA_NAME);
mNumber = intent.getStringExtra(INTENT_EXTRA_NUMBER);
@@ -114,7 +119,7 @@
buf.append(mPin2);
buf.append("'");
- Uri uri = Uri.parse("content://icc/fdn");
+ Uri uri = FdnList.getContentUri(mSubscriptionInfoHelper);
mQueryHandler = new QueryHandler(getContentResolver());
mQueryHandler.startDelete(0, null, uri, buf.toString(), null);
@@ -124,6 +129,7 @@
private void authenticatePin2() {
Intent intent = new Intent();
intent.setClass(this, GetPin2Screen.class);
+ intent.setData(FdnList.getContentUri(mSubscriptionInfoHelper));
startActivityForResult(intent, PIN2_REQUEST_CODE);
}
diff --git a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
index 3064a7a..944eaad 100644
--- a/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
+++ b/src/com/android/phone/settings/fdn/EditFdnContactScreen.java
@@ -49,6 +49,7 @@
import com.android.phone.PhoneGlobals;
import com.android.phone.R;
+import com.android.phone.SubscriptionInfoHelper;
import com.android.internal.telephony.Phone;
import com.android.internal.telephony.PhoneFactory;
@@ -68,6 +69,8 @@
private static final int PIN2_REQUEST_CODE = 100;
+ private SubscriptionInfoHelper mSubscriptionInfoHelper;
+
private String mName;
private String mNumber;
private String mPin2;
@@ -107,8 +110,7 @@
getWindow().requestFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setContentView(R.layout.edit_fdn_contact_screen);
setupView();
- setTitle(mAddContact ?
- R.string.add_fdn_contact : R.string.edit_fdn_contact);
+ setTitle(mAddContact ? R.string.add_fdn_contact : R.string.edit_fdn_contact);
displayProgress(false);
}
@@ -214,6 +216,8 @@
private void resolveIntent() {
Intent intent = getIntent();
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(intent);
+
mName = intent.getStringExtra(INTENT_EXTRA_NAME);
mNumber = intent.getStringExtra(INTENT_EXTRA_NUMBER);
@@ -266,10 +270,6 @@
return mNumberField.getText().toString();
}
- private Uri getContentURI() {
- return Uri.parse("content://icc/fdn");
- }
-
/**
* @param number is voice mail number
* @return true if number length is less than 20-digit limit
@@ -291,7 +291,7 @@
return;
}
- Uri uri = getContentURI();
+ Uri uri = FdnList.getContentUri(mSubscriptionInfoHelper);
ContentValues bundle = new ContentValues(3);
bundle.put("tag", getNameFromTextField());
@@ -314,7 +314,7 @@
handleResult(false, true);
return;
}
- Uri uri = getContentURI();
+ Uri uri = FdnList.getContentUri(mSubscriptionInfoHelper);
ContentValues bundle = new ContentValues();
bundle.put("tag", mName);
@@ -335,8 +335,7 @@
private void deleteSelected() {
// delete ONLY if this is NOT a new contact.
if (!mAddContact) {
- Intent intent = new Intent();
- intent.setClass(this, DeleteFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(this, DeleteFdnContactScreen.class);
intent.putExtra(INTENT_EXTRA_NAME, mName);
intent.putExtra(INTENT_EXTRA_NUMBER, mNumber);
startActivity(intent);
@@ -347,6 +346,7 @@
private void authenticatePin2() {
Intent intent = new Intent();
intent.setClass(this, GetPin2Screen.class);
+ intent.setData(FdnList.getContentUri(mSubscriptionInfoHelper));
startActivityForResult(intent, PIN2_REQUEST_CODE);
}
diff --git a/src/com/android/phone/settings/fdn/FdnList.java b/src/com/android/phone/settings/fdn/FdnList.java
index 0f189d4..d7bfde2 100644
--- a/src/com/android/phone/settings/fdn/FdnList.java
+++ b/src/com/android/phone/settings/fdn/FdnList.java
@@ -26,8 +26,9 @@
import android.view.View;
import android.widget.ListView;
-import com.android.phone.R;
import com.android.phone.ADNList;
+import com.android.phone.R;
+import com.android.phone.SubscriptionInfoHelper;
/**
* Fixed Dialing Number (FDN) List UI for the Phone app. FDN is a feature of the service provider
@@ -41,6 +42,11 @@
private static final String INTENT_EXTRA_NAME = "name";
private static final String INTENT_EXTRA_NUMBER = "number";
+ private static final Uri FDN_CONTENT_URI = Uri.parse("content://icc/fdn");
+ private static final String FDN_CONTENT_PATH_WITH_SUB_ID = "content://icc/fdn/subId/";
+
+ private SubscriptionInfoHelper mSubscriptionInfoHelper;
+
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
@@ -50,12 +56,16 @@
// android.R.id.home will be triggered in onOptionsItemSelected()
actionBar.setDisplayHomeAsUpEnabled(true);
}
+
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mSubscriptionInfoHelper.setActionBarTitle(
+ getActionBar(), getResources(), R.string.fdn_list_with_label);
}
@Override
protected Uri resolveIntent() {
Intent intent = getIntent();
- intent.setData(Uri.parse("content://icc/fdn"));
+ intent.setData(getContentUri(mSubscriptionInfoHelper));
return intent.getData();
}
@@ -91,7 +101,7 @@
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home: // See ActionBar#setDisplayHomeAsUpEnabled()
- Intent intent = new Intent(this, FdnSetting.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(this, FdnSetting.class);
intent.setAction(Intent.ACTION_MAIN);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
@@ -121,10 +131,8 @@
}
private void addContact() {
- // if we don't put extras "name" when starting this activity, then
- // EditFdnContactScreen treats it like add contact.
- Intent intent = new Intent();
- intent.setClass(this, EditFdnContactScreen.class);
+ //If there is no INTENT_EXTRA_NAME provided, EditFdnContactScreen treats it as an "add".
+ Intent intent = mSubscriptionInfoHelper.getIntent(this, EditFdnContactScreen.class);
startActivity(intent);
}
@@ -146,8 +154,7 @@
String name = mCursor.getString(NAME_COLUMN);
String number = mCursor.getString(NUMBER_COLUMN);
- Intent intent = new Intent();
- intent.setClass(this, EditFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(this, EditFdnContactScreen.class);
intent.putExtra(INTENT_EXTRA_NAME, name);
intent.putExtra(INTENT_EXTRA_NUMBER, number);
startActivity(intent);
@@ -159,11 +166,20 @@
String name = mCursor.getString(NAME_COLUMN);
String number = mCursor.getString(NUMBER_COLUMN);
- Intent intent = new Intent();
- intent.setClass(this, DeleteFdnContactScreen.class);
+ Intent intent = mSubscriptionInfoHelper.getIntent(this, DeleteFdnContactScreen.class);
intent.putExtra(INTENT_EXTRA_NAME, name);
intent.putExtra(INTENT_EXTRA_NUMBER, number);
startActivity(intent);
}
}
+
+ /**
+ * Returns the uri for updating the ICC FDN entry, taking into account the subscription id.
+ */
+ public static Uri getContentUri(SubscriptionInfoHelper subscriptionInfoHelper) {
+ return subscriptionInfoHelper.hasSubId()
+ ? Uri.parse(FDN_CONTENT_PATH_WITH_SUB_ID + subscriptionInfoHelper.getSubId())
+ : FDN_CONTENT_URI;
+ }
+
}
diff --git a/src/com/android/phone/settings/fdn/FdnSetting.java b/src/com/android/phone/settings/fdn/FdnSetting.java
index 35e15e5..8716d37 100644
--- a/src/com/android/phone/settings/fdn/FdnSetting.java
+++ b/src/com/android/phone/settings/fdn/FdnSetting.java
@@ -35,6 +35,7 @@
import com.android.phone.CallFeaturesSetting;
import com.android.phone.PhoneGlobals;
import com.android.phone.R;
+import com.android.phone.SubscriptionInfoHelper;
/**
* FDN settings UI for the Phone app.
@@ -46,6 +47,7 @@
private static final String LOG_TAG = PhoneGlobals.LOG_TAG;
private static final boolean DBG = false;
+ private SubscriptionInfoHelper mSubscriptionInfoHelper;
private Phone mPhone;
/**
@@ -56,10 +58,9 @@
private static final int EVENT_PIN2_CHANGE_COMPLETE = 200;
// String keys for preference lookup
- // We only care about the pin preferences here, the manage FDN contacts
- // Preference is handled solely in xml.
private static final String BUTTON_FDN_ENABLE_KEY = "button_fdn_enable_key";
private static final String BUTTON_CHANGE_PIN2_KEY = "button_change_pin2_key";
+ private static final String FDN_LIST_PREF_SCREEN_KEY = "fdn_list_pref_screen_key";
private EditPinPreference mButtonEnableFDN;
private EditPinPreference mButtonChangePin2;
@@ -454,9 +455,10 @@
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
- addPreferencesFromResource(R.xml.fdn_setting);
+ mSubscriptionInfoHelper = new SubscriptionInfoHelper(getIntent());
+ mPhone = mSubscriptionInfoHelper.getPhone();
- mPhone = PhoneGlobals.getPhone();
+ addPreferencesFromResource(R.xml.fdn_setting);
//get UI object references
PreferenceScreen prefSet = getPreferenceScreen();
@@ -469,6 +471,10 @@
mButtonChangePin2.setOnPinEnteredListener(this);
+ PreferenceScreen fdnListPref =
+ (PreferenceScreen) prefSet.findPreference(FDN_LIST_PREF_SCREEN_KEY);
+ fdnListPref.setIntent(mSubscriptionInfoHelper.getIntent(this, FdnList.class));
+
// Only reset the pin change dialog if we're not in the middle of changing it.
if (icicle == null) {
resetPinChangeState();
@@ -485,13 +491,15 @@
if (actionBar != null) {
// android.R.id.home will be triggered in onOptionsItemSelected()
actionBar.setDisplayHomeAsUpEnabled(true);
+ mSubscriptionInfoHelper.setActionBarTitle(
+ actionBar, getResources(), R.string.fdn_with_label);
}
}
@Override
protected void onResume() {
super.onResume();
- mPhone = PhoneGlobals.getPhone();
+ mPhone = mSubscriptionInfoHelper.getPhone();
updateEnableFDN();
}