summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryce Lee <brycelee@google.com>2015-10-16 22:33:53 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-10-16 22:33:53 +0000
commitbd2c23b4b5ed2920956f4215c21a2a93a58a748d (patch)
tree1c58c15960acad38ac9c6246a9775a9dba7ab60e
parenta4c743b01cdf1e757bf02b3ba3e9797c7ff53a33 (diff)
parent6d984fe7bca83276c9de36e1d4522940ac5e4ea2 (diff)
downloadandroid_packages_services_Telephony-bd2c23b4b5ed2920956f4215c21a2a93a58a748d.tar.gz
android_packages_services_Telephony-bd2c23b4b5ed2920956f4215c21a2a93a58a748d.tar.bz2
android_packages_services_Telephony-bd2c23b4b5ed2920956f4215c21a2a93a58a748d.zip
am 6d984fe7: Merge "Mark emergency accounts with the correct capability for wear." into cw-e-dev
* commit '6d984fe7bca83276c9de36e1d4522940ac5e4ea2': Mark emergency accounts with the correct capability for wear.
-rw-r--r--res/values/config.xml3
-rw-r--r--src/com/android/services/telephony/TelecomAccountRegistry.java25
2 files changed, 23 insertions, 5 deletions
diff --git a/res/values/config.xml b/res/values/config.xml
index 139fb712c..fa730d4b5 100644
--- a/res/values/config.xml
+++ b/res/values/config.xml
@@ -209,4 +209,7 @@
<!-- Component for custom voicemail notification handling. [DO NOT TRANSLATE] -->
<string name="config_customVoicemailComponent">@null</string>
+
+ <!-- Flag indicating whether to allow pstn phone accounts [DO NOT TRANSLATE] -->
+ <bool name="config_pstn_phone_accounts_enabled">true</bool>
</resources>
diff --git a/src/com/android/services/telephony/TelecomAccountRegistry.java b/src/com/android/services/telephony/TelecomAccountRegistry.java
index 154fc3314..8cee71a78 100644
--- a/src/com/android/services/telephony/TelecomAccountRegistry.java
+++ b/src/com/android/services/telephony/TelecomAccountRegistry.java
@@ -18,6 +18,7 @@ package com.android.services.telephony;
import android.content.ComponentName;
import android.content.Context;
+import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Canvas;
@@ -173,6 +174,12 @@ final class TelecomAccountRegistry {
}
mIsMergeCallSupported = isCarrierMergeCallSupported();
+ if (isEmergency && mContext.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_WATCH)) {
+ // For Wear, we mark the emergency phone account as emergency calls only.
+ capabilities |= PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY;
+ }
+
if (icon == null) {
// TODO: Switch to using Icon.createWithResource() once that supports tinting.
Resources res = mContext.getResources();
@@ -204,6 +211,7 @@ final class TelecomAccountRegistry {
// Register with Telecom and put into the account entry.
mTelecomManager.registerPhoneAccount(account);
+
return account;
}
@@ -435,11 +443,18 @@ final class TelecomAccountRegistry {
// will cause the existing entry to be replaced.
Phone[] phones = PhoneFactory.getPhones();
Log.d(this, "Found %d phones. Attempting to register.", phones.length);
- for (Phone phone : phones) {
- long subscriptionId = phone.getSubId();
- Log.d(this, "Phone with subscription id %d", subscriptionId);
- if (subscriptionId >= 0) {
- mAccounts.add(new AccountEntry(phone, false /* emergency */, false /* isDummy */));
+
+ final boolean phoneAccountsEnabled = mContext.getResources().getBoolean(
+ R.bool.config_pstn_phone_accounts_enabled);
+
+ if (phoneAccountsEnabled) {
+ for (Phone phone : phones) {
+ int subscriptionId = phone.getSubId();
+ Log.d(this, "Phone with subscription id %d", subscriptionId);
+ if (subscriptionId >= 0) {
+ mAccounts.add(new AccountEntry(phone, false /* emergency */,
+ false /* isDummy */));
+ }
}
}