Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bc579d9 authored by Shuo Qian's avatar Shuo Qian Committed by Automerger Merge Worker
Browse files

Merge "Handles Telephony service not up fatal exception in...

Merge "Handles Telephony service not up fatal exception in CallerInfoAsyncQuery" into sc-dev am: f3dc01bf

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14444738

Change-Id: Ib254491be4e430ad7ff508f761555b6f76de470b
parents 6b48cd4b f3dc01bf
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -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;