summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTony Mak <tonymak@google.com>2015-12-07 03:53:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-12-07 03:53:49 +0000
commit235134a4908425ec40df4c0e98436c7f67008a1c (patch)
treec59a2c020ff8690fb2f93a9048788e2ef616c4cb /src
parent42bab8041d7766d14a5f6cbb51d32007a09ba9dd (diff)
parent95d594a27a71121a633b18e347821c87346ff006 (diff)
Merge "Allow non-primary users to configure calling accounts" into ub-contactsdialer-b-dev
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/settings/DialerSettingsActivity.java46
1 files changed, 24 insertions, 22 deletions
diff --git a/src/com/android/dialer/settings/DialerSettingsActivity.java b/src/com/android/dialer/settings/DialerSettingsActivity.java
index cc84486de..d7b8e117d 100644
--- a/src/com/android/dialer/settings/DialerSettingsActivity.java
+++ b/src/com/android/dialer/settings/DialerSettingsActivity.java
@@ -71,28 +71,30 @@ public class DialerSettingsActivity extends AppCompatPreferenceActivity {
TelephonyManager telephonyManager =
(TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
- // Only show call setting menus if the current user is the primary/owner user.
- if (isPrimaryUser()) {
- // Show "Call Settings" if there is one SIM and "Phone Accounts" if there are more.
- if (telephonyManager.getPhoneCount() <= 1) {
- Header callSettingsHeader = new Header();
- Intent callSettingsIntent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS);
- callSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
-
- callSettingsHeader.titleRes = R.string.call_settings_label;
- callSettingsHeader.intent = callSettingsIntent;
- target.add(callSettingsHeader);
- } else {
- Header phoneAccountSettingsHeader = new Header();
- 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.intent = phoneAccountSettingsIntent;
- target.add(phoneAccountSettingsHeader);
- }
-
+ // "Call Settings" (full settings) is shown if the current user is primary user and there
+ // is only one SIM. Before N, "Calling accounts" setting is shown if the current user is
+ // primary user and there are multiple SIMs. In N+, "Calling accounts" is shown whenever
+ // "Call Settings" is not shown.
+ boolean isPrimaryUser = isPrimaryUser();
+ if (isPrimaryUser && telephonyManager.getPhoneCount() <= 1) {
+ Header callSettingsHeader = new Header();
+ Intent callSettingsIntent = new Intent(TelecomManager.ACTION_SHOW_CALL_SETTINGS);
+ callSettingsIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+
+ callSettingsHeader.titleRes = R.string.call_settings_label;
+ callSettingsHeader.intent = callSettingsIntent;
+ target.add(callSettingsHeader);
+ } else if (android.os.Build.VERSION.CODENAME.startsWith("N") || isPrimaryUser) {
+ Header phoneAccountSettingsHeader = new Header();
+ 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.intent = phoneAccountSettingsIntent;
+ target.add(phoneAccountSettingsHeader);
+ }
+ if (isPrimaryUser) {
Header blockedCallsHeader = new Header();
blockedCallsHeader.titleRes = R.string.manage_blocked_numbers_label;
blockedCallsHeader.intent = new Intent(this, BlockedNumbersSettingsActivity.class);