diff options
author | Nancy Chen <nancychen@google.com> | 2014-10-17 21:21:43 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-10-17 21:21:43 +0000 |
commit | f21271db705a10eadae869b24deb00265a5a48dd (patch) | |
tree | 8f2714d78de1b85ae4b33c8ce5caffb2a6e8a6f9 /InCallUI | |
parent | aec501c9c29db2ef2f2ac885da1462a5916e32b7 (diff) | |
parent | 49243b1425c0de41ce86685208192c4f93789b05 (diff) |
am 04318a39: Use the phone account when checking if a number is a voicemail number.
* commit '04318a393b5492fb72d6edafca588e6b25ad752c':
Use the phone account when checking if a number is a voicemail number.
Diffstat (limited to 'InCallUI')
3 files changed, 17 insertions, 7 deletions
diff --git a/InCallUI/src/com/android/incallui/CallButtonPresenter.java b/InCallUI/src/com/android/incallui/CallButtonPresenter.java index ca4eb8838..0d7d88fcf 100644 --- a/InCallUI/src/com/android/incallui/CallButtonPresenter.java +++ b/InCallUI/src/com/android/incallui/CallButtonPresenter.java @@ -20,6 +20,7 @@ import android.content.Context; import android.telecom.AudioState; import android.telecom.InCallService.VideoCall; import android.telecom.PhoneCapabilities; +import android.telecom.TelecomManager; import android.telecom.VideoProfile; @@ -83,9 +84,10 @@ public class CallButtonPresenter extends Presenter<CallButtonPresenter.CallButto // OUTGOING. We may want to do that once we start showing "Voice mail" label on // the dialpad too.) if (ui != null) { - if (oldState == InCallState.OUTGOING && mCall != null - && PhoneNumberUtils.isVoiceMailNumber(mCall.getNumber())) { - ui.displayDialpad(true /* show */, true /* animate */); + if (oldState == InCallState.OUTGOING && mCall != null) { + if (CallerInfoUtils.isVoiceMailNumber(ui.getContext(), mCall)) { + ui.displayDialpad(true /* show */, true /* animate */); + } } } } else if (newState == InCallState.INCOMING) { diff --git a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java index 9a675c132..bd766d675 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java +++ b/InCallUI/src/com/android/incallui/CallerInfoAsyncQuery.java @@ -365,8 +365,7 @@ public class CallerInfoAsyncQuery { // check to see if these are recognized numbers, and use shortcuts if we can. if (PhoneNumberUtils.isLocalEmergencyNumber(context, info.phoneNumber)) { cw.event = EVENT_EMERGENCY_NUMBER; - } else if (info.isVoiceMailNumber() - || PhoneNumberUtils.isVoiceMailNumber(info.phoneNumber)) { + } else if (info.isVoiceMailNumber()) { cw.event = EVENT_VOICEMAIL_NUMBER; } else { cw.event = EVENT_NEW_QUERY; diff --git a/InCallUI/src/com/android/incallui/CallerInfoUtils.java b/InCallUI/src/com/android/incallui/CallerInfoUtils.java index 9fd45e413..5693db092 100644 --- a/InCallUI/src/com/android/incallui/CallerInfoUtils.java +++ b/InCallUI/src/com/android/incallui/CallerInfoUtils.java @@ -6,6 +6,7 @@ import android.content.Loader.OnLoadCompleteListener; import android.net.Uri; import android.telecom.PhoneAccount; import android.telecom.TelecomManager; +import android.telephony.PhoneNumberUtils; import android.text.TextUtils; import android.util.Log; @@ -74,14 +75,22 @@ public class CallerInfoUtils { // Because the InCallUI is immediately launched before the call is connected, occasionally // a voicemail call will be passed to InCallUI as a "voicemail:" URI without a number. // This call should still be handled as a voicemail call. - if (call.getHandle() != null && - PhoneAccount.SCHEME_VOICEMAIL.equals(call.getHandle().getScheme())) { + if ((call.getHandle() != null && + PhoneAccount.SCHEME_VOICEMAIL.equals(call.getHandle().getScheme())) || + isVoiceMailNumber(context, call)) { info.markAsVoiceMail(context); } return info; } + public static boolean isVoiceMailNumber(Context context, Call call) { + TelecomManager telecomManager = + (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); + return telecomManager.isVoiceMailNumber( + call.getTelecommCall().getDetails().getAccountHandle(), call.getNumber()); + } + /** * Handles certain "corner cases" for CNAP. When we receive weird phone numbers * from the network to indicate different number presentations, convert them to |