diff options
Diffstat (limited to 'src/com/android/dialer')
-rw-r--r-- | src/com/android/dialer/settings/DialerSettingsActivity.java | 22 | ||||
-rw-r--r-- | src/com/android/dialer/util/TelecomUtil.java | 9 |
2 files changed, 24 insertions, 7 deletions
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java index fbdb4f9f5..dc1e21457 100644 --- a/src/com/android/dialer/settings/DialerSettingsActivity.java +++ b/src/com/android/dialer/settings/DialerSettingsActivity.java @@ -61,10 +61,12 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { @Override public void onBuildHeaders(List<Header> target) { - Header displayOptionsHeader = new Header(); - displayOptionsHeader.titleRes = R.string.display_options_title; - displayOptionsHeader.fragment = DisplayOptionsSettingsFragment.class.getName(); - target.add(displayOptionsHeader); + if (showDisplayOptions()) { + Header displayOptionsHeader = new Header(); + displayOptionsHeader.titleRes = R.string.display_options_title; + displayOptionsHeader.fragment = DisplayOptionsSettingsFragment.class.getName(); + target.add(displayOptionsHeader); + } Header soundSettingsHeader = new Header(); soundSettingsHeader.titleRes = R.string.sounds_and_vibration_title; @@ -127,6 +129,18 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity { } } + /** + * Returns {@code true} or {@code false} based on whether the display options setting should be + * shown. For languages such as Chinese, Japanese, or Korean, display options aren't useful + * since contacts are sorted and displayed family name first by default. + * + * @return {@code true} if the display options should be shown, {@code false} otherwise. + */ + private boolean showDisplayOptions() { + return getResources().getBoolean(R.bool.config_display_order_user_changeable) + && getResources().getBoolean(R.bool.config_sort_order_user_changeable); + } + @Override public void onHeaderClick(Header header, int position) { if (header.id == R.id.settings_header_sounds_and_vibration) { diff --git a/src/com/android/dialer/util/TelecomUtil.java b/src/com/android/dialer/util/TelecomUtil.java index bd201c459..69c7334b9 100644 --- a/src/com/android/dialer/util/TelecomUtil.java +++ b/src/com/android/dialer/util/TelecomUtil.java @@ -95,11 +95,14 @@ public class TelecomUtil { } public static boolean handleMmi(Context context, String dialString, - PhoneAccountHandle handle) { + @Nullable PhoneAccountHandle handle) { if (hasModifyPhoneStatePermission(context)) { try { - return TelecomManagerCompat.handleMmi( - getTelecomManager(context), dialString, handle); + if (handle == null) { + return getTelecomManager(context).handleMmi(dialString); + } else { + return getTelecomManager(context).handleMmi(dialString, handle); + } } catch (SecurityException e) { Log.w(TAG, "TelecomManager.handleMmi called without permission."); } |