From 443e501c46f57b4189c4ae943d989b24366ef9d8 Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Wed, 15 Oct 2014 15:48:21 -0700 Subject: Use Telecom API for checking if a number is voicemail (1/2) Since we don't want to communicate directly with Telephony in dialer, call PhoneNumberUtils.isVoiceMailNumber (a Telephony method) through the Telecom API. Add a method in TelecomManager to do this. Bug: 17925501 Change-Id: Iecea82a0e5f0b106eaf105e9026d606110acf122 --- telecomm/java/android/telecom/TelecomManager.java | 21 +++++++++++++++++++++ .../android/internal/telecom/ITelecomService.aidl | 5 +++++ 2 files changed, 26 insertions(+) (limited to 'telecomm') diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index f3358f8..e87615e 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -656,6 +656,27 @@ public class TelecomManager { } /** + * Return whether a given phone number is the configured voicemail number for a + * particular phone account. + * + * @param accountHandle The handle for the account to check the voicemail number against + * @param number The number to look up. + * + * @hide + */ + @SystemApi + public boolean isVoiceMailNumber(PhoneAccountHandle accountHandle, String number) { + try { + if (isServiceConnected()) { + return getTelecomService().isVoiceMailNumber(accountHandle, number); + } + } catch (RemoteException e) { + Log.e(TAG, "RemoteException calling isInCall().", e); + } + return false; + } + + /** * Returns whether there is an ongoing phone call (can be in dialing, ringing, active or holding * states). *

diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index f1cf885..91f44b9 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -115,6 +115,11 @@ interface ITelecomService { void clearAccounts(String packageName); /** + * @see TelecomServiceImpl#isVoiceMailNumber + */ + boolean isVoiceMailNumber(in PhoneAccountHandle accountHandle, String number); + + /** * @see TelecomServiceImpl#getDefaultPhoneApp */ ComponentName getDefaultPhoneApp(); -- cgit v1.1