diff options
author | 2024-11-26 02:38:52 +0000 | |
---|---|---|
committer | 2024-11-26 02:38:52 +0000 | |
commit | 729f23b81dac3ff612dd0c092141032d65d77510 (patch) | |
tree | e61d74a7f787521d3daa5b22f8a1b863621c53fb /service | |
parent | 869c0c8f19f73171681c03690f33c86de2793b91 (diff) | |
parent | 313830cc236fcd220b6a2b4963b24d1593e683f0 (diff) |
Merge "Catch errors related to Telephony being unavailable in ECMService" into main
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/ecm/EnhancedConfirmationService.java | 13 |
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()) |