summaryrefslogtreecommitdiffstats
path: root/src/com/android/incallui/CallerInfoUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/incallui/CallerInfoUtils.java')
-rw-r--r--src/com/android/incallui/CallerInfoUtils.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/incallui/CallerInfoUtils.java b/src/com/android/incallui/CallerInfoUtils.java
index 9fd45e41..5693db09 100644
--- a/src/com/android/incallui/CallerInfoUtils.java
+++ b/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