summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvan Charlton <evanc@google.com>2014-11-25 15:26:01 -0800
committerEvan Charlton <evanc@google.com>2014-12-05 15:22:44 -0800
commit7b2c6e230ef6df2ae7863dc61b632a25393707ee (patch)
tree6d9326809740c43e3f55bc848b2224899259a9e5
parentacdd149662c99e9fbaeddf52ec4644547ee6aa45 (diff)
downloadandroid_packages_services_Telephony-7b2c6e230ef6df2ae7863dc61b632a25393707ee.tar.gz
android_packages_services_Telephony-7b2c6e230ef6df2ae7863dc61b632a25393707ee.tar.bz2
android_packages_services_Telephony-7b2c6e230ef6df2ae7863dc61b632a25393707ee.zip
Start the configure intent with the right user
When opening the ConnectionService's CONFIGURE activity, make sure to direct it to the correct user. Additionally, register SIM/SIP PhoneAccounts as MULTI_USER so that secondary users can use them. Finally, differentiate between work profile PhoneAccounts so that they can be correctly identified by the user. Bug: 17421902 Bug: 17421044 Bug: 18278824 Change-Id: I673904a7ae038c88688bba62642e93174e55c308
-rw-r--r--res/values/strings.xml2
-rw-r--r--sip/src/com/android/services/telephony/sip/SipUtil.java3
-rw-r--r--src/com/android/phone/settings/AccountSelectionPreference.java6
-rw-r--r--src/com/android/phone/settings/PhoneAccountSettingsFragment.java12
-rw-r--r--src/com/android/services/telephony/TelecomAccountRegistry.java3
5 files changed, 20 insertions, 6 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 30af301c5..6b35ada6c 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -161,7 +161,7 @@
<!-- Label for selectecting a Wi-Fi call manager -->
<string name="wifi_calling_select_call_assistant">Choose call assistant</string>
<!-- Summary for the label of a setting to select the SIM call managers to use.-->
- <string name="wifi_calling_select_call_assistant_summary">Choose an app or service to manage the networks used for calls</string>
+ <string name="wifi_calling_select_call_assistant_summary">Manage the networks used for calls with</string>
<!-- Summary for the label of a switch setting to enable/disable the use of SIM call managers. -->
<string name="wifi_calling_use_call_assistant_summary">Let apps or services manage networks used for calls</string>
<!-- Label for setting to configure the selected call assistant. -->
diff --git a/sip/src/com/android/services/telephony/sip/SipUtil.java b/sip/src/com/android/services/telephony/sip/SipUtil.java
index 54bdc1e92..ea5ea46f4 100644
--- a/sip/src/com/android/services/telephony/sip/SipUtil.java
+++ b/sip/src/com/android/services/telephony/sip/SipUtil.java
@@ -116,7 +116,8 @@ public class SipUtil {
}
PhoneAccount.Builder builder = PhoneAccount.builder(accountHandle, profile.getDisplayName())
- .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER)
+ .setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER
+ | PhoneAccount.CAPABILITY_MULTI_USER)
.setAddress(Uri.parse(profile.getUriString()))
.setShortDescription(profile.getDisplayName())
.setIcon(context, R.drawable.ic_dialer_sip_black_24dp)
diff --git a/src/com/android/phone/settings/AccountSelectionPreference.java b/src/com/android/phone/settings/AccountSelectionPreference.java
index 7d1ede8eb..6872a166a 100644
--- a/src/com/android/phone/settings/AccountSelectionPreference.java
+++ b/src/com/android/phone/settings/AccountSelectionPreference.java
@@ -22,6 +22,7 @@ import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
+import android.content.pm.PackageManager;
import android.os.UserHandle;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -76,10 +77,15 @@ public class AccountSelectionPreference extends ListPreference implements
mEntryValues = new String[mAccounts.length + 1];
mEntries = new CharSequence[mAccounts.length + 1];
+ PackageManager pm = mContext.getPackageManager();
+
int selectedIndex = mAccounts.length; // Points to nullSelectionString by default
int i = 0;
for ( ; i < mAccounts.length; i++) {
CharSequence label = telecomManager.getPhoneAccount(mAccounts[i]).getLabel();
+ if (label != null) {
+ label = pm.getUserBadgedLabel(label, mAccounts[i].getUserHandle());
+ }
mEntries[i] = label == null ? null : label.toString();
mEntryValues[i] = Integer.toString(i);
if (Objects.equals(currentSelection, mAccounts[i])) {
diff --git a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
index 00851811e..03374ceed 100644
--- a/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
+++ b/src/com/android/phone/settings/PhoneAccountSettingsFragment.java
@@ -5,6 +5,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.sip.SipManager;
import android.os.Bundle;
+import android.os.UserHandle;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -223,8 +224,14 @@ public class PhoneAccountSettingsFragment extends PreferenceFragment
if (pref == mConfigureCallAssistant) {
Intent intent = getConfigureCallAssistantIntent();
if (intent != null) {
+ PhoneAccountHandle handle = mTelecomManager.getSimCallManager();
+ UserHandle userHandle = handle.getUserHandle();
try {
- startActivity(intent);
+ if (userHandle != null) {
+ getActivity().startActivityAsUser(intent, userHandle);
+ } else {
+ startActivity(intent);
+ }
} catch (ActivityNotFoundException e) {
Log.d(LOG_TAG, "Could not resolve call assistant configure intent: " + intent);
}
@@ -311,10 +318,9 @@ public class PhoneAccountSettingsFragment extends PreferenceFragment
* call assistants, and the currently selected call assistant.
*/
public void updateCallAssistantModel() {
- List<PhoneAccountHandle> simCallManagers = mTelecomManager.getSimCallManagers();
mSelectCallAssistant.setModel(
mTelecomManager,
- simCallManagers,
+ mTelecomManager.getSimCallManagers(),
mTelecomManager.getSimCallManager(),
getString(R.string.wifi_calling_call_assistant_none));
}
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index b36037e45..13b3c94f1 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -141,7 +141,8 @@ final class TelecomAccountRegistry {
// By default all SIM phone accounts can place emergency calls.
int capabilities = PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION |
PhoneAccount.CAPABILITY_CALL_PROVIDER |
- PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS;
+ PhoneAccount.CAPABILITY_PLACE_EMERGENCY_CALLS |
+ PhoneAccount.CAPABILITY_MULTI_USER;
if (iconBitmap == null) {
iconBitmap = BitmapFactory.decodeResource(