diff options
author | Andrew Lee <anwlee@google.com> | 2014-10-25 01:27:22 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-25 01:27:22 +0000 |
commit | 5847b66720850ac5fef89a4ce5386fb61d69a42e (patch) | |
tree | da4e6eaca7a247a697c43895b48a90313cf56b34 | |
parent | 880298f31882cd2d4f57117672dca19081f13b8a (diff) | |
parent | f1621a2f2d43a28b9a98b6e75bc1318d7e0c19a8 (diff) |
am f1621a2f: Show phone account settings for multiple sims.
* commit 'f1621a2f2d43a28b9a98b6e75bc1318d7e0c19a8':
Show phone account settings for multiple sims.
-rw-r--r-- | res/values/strings.xml | 9 | ||||
-rw-r--r-- | src/com/android/dialer/settings/DialerSettingsActivity.java | 31 |
2 files changed, 32 insertions, 8 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index beb7fe209..7a88b98cb 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -804,10 +804,15 @@ <!-- Title of settings screen for managing the "Respond via SMS" feature. [CHAR LIMIT=30] --> <string name="respond_via_sms_setting_title">Quick responses</string> - <!-- Label for the call settings section [CHAR LIMIT=30]--> + <!-- Label for the call settings section [CHAR LIMIT=30] --> <string name="call_settings_label">Call settings</string> - <!-- Label for the call settings section description [CHAR LIMIT=80]--> + <!-- Label for the call settings section description [CHAR LIMIT=80] --> <string name="call_settings_description">Voicemail, call waiting, and others</string> + <!-- Label for the phone account settings [CHAR LIMIT=30] --> + <string name="phone_account_settings_label">Phone account settings</string> + + <!-- Label for the phone account settings description [CHAR LIMIT=80] --> + <string name="phone_account_settings_description">Manage SIM and call settings</string> </resources> diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java index 7d80ac390..43186664e 100644 --- a/src/com/android/dialer/settings/DialerSettingsActivity.java +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -3,11 +3,15 @@ package com.android.dialer.settings; import com.google.common.collect.Lists; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.UserHandle; import android.os.UserManager; import android.preference.PreferenceManager; +import android.preference.PreferenceActivity.Header; +import android.telecom.TelecomManager; +import android.telephony.TelephonyManager; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.MenuItem; @@ -45,13 +49,28 @@ public class DialerSettingsActivity extends AnalyticsPreferenceActivity { generalSettingsHeader.fragment = GeneralSettingsFragment.class.getName(); target.add(generalSettingsHeader); - // Only add the call settings header if the current user is the primary/owner user. + // Only show call setting menus if the current user is the primary/owner user. if (isPrimaryUser()) { - final Header callSettingHeader = new Header(); - callSettingHeader.titleRes = R.string.call_settings_label; - callSettingHeader.summaryRes = R.string.call_settings_description; - callSettingHeader.intent = DialtactsActivity.getCallSettingsIntent(); - target.add(callSettingHeader); + final TelephonyManager telephonyManager = + (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE); + // Show "Call Settings" if there is one SIM and "Phone Accounts" if there are more. + if (telephonyManager.getPhoneCount() <= 1) { + final Header callSettingsHeader = new Header(); + callSettingsHeader.titleRes = R.string.call_settings_label; + callSettingsHeader.summaryRes = R.string.call_settings_description; + callSettingsHeader.intent = DialtactsActivity.getCallSettingsIntent(); + target.add(callSettingsHeader); + } else { + final Header phoneAccountSettingsHeader = new Header(); + final Intent phoneAccountSettingsIntent = + new Intent(TelecomManager.ACTION_CHANGE_PHONE_ACCOUNTS); + phoneAccountSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); + + phoneAccountSettingsHeader.titleRes = R.string.phone_account_settings_label; + phoneAccountSettingsHeader.summaryRes = R.string.phone_account_settings_description; + phoneAccountSettingsHeader.intent = phoneAccountSettingsIntent; + target.add(phoneAccountSettingsHeader); + } } } |