summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Nate Myren <ntmyren@google.com> 2024-11-25 14:54:33 -0800
committer Nate Myren <ntmyren@google.com> 2024-11-25 15:09:26 -0800
commit313830cc236fcd220b6a2b4963b24d1593e683f0 (patch)
tree05e38a088e03cbdce120f2e7815148c6a195c417
parente88c565f7274465f941a1add6410a8b9db6ac326 (diff)
Catch errors related to Telephony being unavailable in ECMService
On some devices, like tablets, there may be telecom calls (from things like VOIP apps), but not telephony (sim cards). These exceptions should be caught when checking for emergency numbers Fixes: 380718851 Test: manual Flag: none Change-Id: I1a6de95b114d7d206d583f2d79f6ab34011e9220
-rw-r--r--service/java/com/android/ecm/EnhancedConfirmationService.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/service/java/com/android/ecm/EnhancedConfirmationService.java b/service/java/com/android/ecm/EnhancedConfirmationService.java
index 1bbba1079..dde9fe2fd 100644
--- a/service/java/com/android/ecm/EnhancedConfirmationService.java
+++ b/service/java/com/android/ecm/EnhancedConfirmationService.java
@@ -158,9 +158,16 @@ public class EnhancedConfirmationService extends SystemService {
private @CallType int getCallType(Call call) {
String number = getPhoneNumber(call);
- if (number != null && mTelephonyManager.isEmergencyNumber(number)) {
- return CALL_TYPE_EMERGENCY;
- } else if (number != null) {
+ try {
+ if (number != null && mTelephonyManager.isEmergencyNumber(number)) {
+ return CALL_TYPE_EMERGENCY;
+ }
+ } catch (IllegalStateException | UnsupportedOperationException e) {
+ // If either of these are thrown, the telephony service is not available on the current
+ // device, either because the device lacks telephony calling, or the telephony service
+ // is unavailable.
+ }
+ if (number != null) {
return hasContactWithPhoneNumber(number) ? CALL_TYPE_TRUSTED : CALL_TYPE_UNTRUSTED;
} else {
return hasContactWithDisplayName(call.getDetails().getCallerDisplayName())