Use TelephonyManager#isEmergencyNumber() instead

Replace deprecated PhoneNumberUtils#isLocalEmergencyNumber() and
isEmergencyNumber() with TelephonyManager#isEmergencyNumber().

Test: Build
Bug: 132703886

Signed-off-by: Taesu Lee <taesu82.lee@samsung.com>
Change-Id: I232d7f7d23efd963b6d30938f0fa304c90fca8a8
This commit is contained in:
Taesu Lee
2020-10-07 14:55:25 +09:00
committed by Shuo Qian
parent 7c4bea4b70
commit 902b89d936
3 changed files with 6 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ import android.os.UserManager;
import android.provider.ContactsContract.PhoneLookup;
import android.telephony.PhoneNumberUtils;
import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import java.util.ArrayList;
@@ -481,7 +482,8 @@ public class CallerInfoAsyncQuery {
cw.subId = subId;
// check to see if these are recognized numbers, and use shortcuts if we can.
if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
TelephonyManager tm = context.getSystemService(TelephonyManager.class);
if (tm.isEmergencyNumber(number)) {
cw.event = EVENT_EMERGENCY_NUMBER;
} else if (PhoneNumberUtils.isVoiceMailNumber(context, subId, number)) {
cw.event = EVENT_VOICEMAIL_NUMBER;