summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2014-10-24 14:22:59 -0700
committerAndrew Lee <anwlee@google.com>2014-10-24 16:26:44 -0700
commitf1621a2f2d43a28b9a98b6e75bc1318d7e0c19a8 (patch)
tree8d5b1de634fc421e1aff465b997ebb4ca9582b19 /src
parent152266fb7ae309942e9a67419f104a29f491c0b8 (diff)
Show phone account settings for multiple sims.
Bug: 18114923 Change-Id: I93559004bb4fe31b24685155a57424e24770c115
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/settings/DialerSettingsActivity.java31
1 files changed, 25 insertions, 6 deletions
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);
+ }
}
}