diff options
author | Bryce Lee <brycelee@google.com> | 2015-10-16 22:26:48 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-10-16 22:26:48 +0000 |
commit | 0f71e9923d645329c15f9473c6aeff418601f392 (patch) | |
tree | f2182cd43ee25e1d622b621c095fe5b497d16cf2 /src | |
parent | d8ee2bfa063e4a9c89f31f4db681335d529bc6f0 (diff) | |
parent | a0bb705db62a254741629942e29c61da663449ff (diff) | |
download | android_packages_services_Telecomm-0f71e9923d645329c15f9473c6aeff418601f392.tar.gz android_packages_services_Telecomm-0f71e9923d645329c15f9473c6aeff418601f392.tar.bz2 android_packages_services_Telecomm-0f71e9923d645329c15f9473c6aeff418601f392.zip |
Merge "Handle emergency only phone accounts." into cw-e-dev
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/server/telecom/PhoneAccountRegistrar.java | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/com/android/server/telecom/PhoneAccountRegistrar.java b/src/com/android/server/telecom/PhoneAccountRegistrar.java index a795d6f0..aab193ee 100644 --- a/src/com/android/server/telecom/PhoneAccountRegistrar.java +++ b/src/com/android/server/telecom/PhoneAccountRegistrar.java @@ -479,7 +479,9 @@ public final class PhoneAccountRegistrar { public List<PhoneAccountHandle> getCallCapablePhoneAccounts( String uriScheme, boolean includeDisabledAccounts) { return getPhoneAccountHandles( - PhoneAccount.CAPABILITY_CALL_PROVIDER, uriScheme, null, includeDisabledAccounts); + PhoneAccount.CAPABILITY_CALL_PROVIDER, + PhoneAccount.CAPABILITY_EMERGENCY_CALLS_ONLY /*excludedCapabilities*/, + uriScheme, null, includeDisabledAccounts); } /** @@ -716,35 +718,58 @@ public final class PhoneAccountRegistrar { return null; } + private List<PhoneAccountHandle> getPhoneAccountHandles( + int capabilities, + String uriScheme, + String packageName, + boolean includeDisabledAccounts) { + return getPhoneAccountHandles(capabilities, 0 /*excludedCapabilities*/, uriScheme, + packageName, includeDisabledAccounts); + } + /** * Returns a list of phone account handles with the specified capabilities, uri scheme, * and package name. */ private List<PhoneAccountHandle> getPhoneAccountHandles( int capabilities, + int excludedCapabilities, String uriScheme, String packageName, boolean includeDisabledAccounts) { List<PhoneAccountHandle> handles = new ArrayList<>(); for (PhoneAccount account : getPhoneAccounts( - capabilities, uriScheme, packageName, includeDisabledAccounts)) { + capabilities, excludedCapabilities, uriScheme, packageName, + includeDisabledAccounts)) { handles.add(account.getAccountHandle()); } return handles; } + private List<PhoneAccount> getPhoneAccounts( + int capabilities, + String uriScheme, + String packageName, + boolean includeDisabledAccounts) { + return getPhoneAccounts(capabilities, 0 /*excludedCapabilities*/, uriScheme, packageName, + includeDisabledAccounts); + } + /** * Returns a list of phone account handles with the specified flag, supporting the specified * URI scheme, within the specified package name. * * @param capabilities Capabilities which the {@code PhoneAccount} must have. Ignored if 0. + * @param excludedCapabilities Capabilities which the {@code PhoneAccount} must not have. + * Ignored if 0. * @param uriScheme URI schemes the PhoneAccount must handle. {@code null} bypasses the * URI scheme check. * @param packageName Package name of the PhoneAccount. {@code null} bypasses packageName check. */ private List<PhoneAccount> getPhoneAccounts( int capabilities, + int excludedCapabilities, String uriScheme, String packageName, boolean includeDisabledAccounts) { @@ -755,6 +780,11 @@ public final class PhoneAccountRegistrar { continue; } + if ((m.getCapabilities() & excludedCapabilities) != 0) { + // If an excluded capability is present, skip. + continue; + } + if (capabilities != 0 && !m.hasCapabilities(capabilities)) { // Account doesn't have the right capabilities; skip this one. continue; |