summaryrefslogtreecommitdiff
path: root/telecomm
diff options
context:
space:
mode:
authorShuo Qian <shuoq@google.com>2021-05-05 20:47:23 +0000
committerShuo Qian <shuoq@google.com>2021-05-06 16:26:33 +0000
commit839508eea27126c0df4d2df56b6bfb84c6077d53 (patch)
tree670e3368219d17e98606bde72222b90391755099 /telecomm
parentf94486117fce311d92e37d38e7a639f8ecc67ad3 (diff)
Handles Telephony service not up fatal exception in CallerInfoAsyncQuery
Bug: 181062609 Test: Treehugger Change-Id: I5df03a61f55f863e17594aa3239433a5048a4890
Diffstat (limited to 'telecomm')
-rw-r--r--telecomm/java/android/telecom/CallerInfoAsyncQuery.java11
1 files changed, 10 insertions, 1 deletions
diff --git a/telecomm/java/android/telecom/CallerInfoAsyncQuery.java b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
index a9e1a8fc1952..bf49f3c7b9bf 100644
--- a/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
+++ b/telecomm/java/android/telecom/CallerInfoAsyncQuery.java
@@ -483,7 +483,16 @@ public class CallerInfoAsyncQuery {
// check to see if these are recognized numbers, and use shortcuts if we can.
TelephonyManager tm = context.getSystemService(TelephonyManager.class);
- if (tm.isEmergencyNumber(number)) {
+ boolean isEmergencyNumber = false;
+ try {
+ isEmergencyNumber = tm.isEmergencyNumber(number);
+ } catch (IllegalStateException ise) {
+ // Ignore the exception that Telephony is not up. Use PhoneNumberUtils API now.
+ // Ideally the PhoneNumberUtils API needs to be removed once the
+ // telphony service not up issue can be fixed (b/187412989)
+ isEmergencyNumber = PhoneNumberUtils.isLocalEmergencyNumber(context, number);
+ }
+ if (isEmergencyNumber) {
cw.event = EVENT_EMERGENCY_NUMBER;
} else if (PhoneNumberUtils.isVoiceMailNumber(context, subId, number)) {
cw.event = EVENT_VOICEMAIL_NUMBER;