Merge "Use TelephonyManager#isEmergencyNumber() instead" am: 1963c4b1c6 am: e931ca461e
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1454556 Change-Id: I1e36efb6b69535e2d3afc0e5b5650b372d9bd1a1
This commit is contained in:
@@ -28,7 +28,6 @@ import android.location.LocationManager;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.telephony.PhoneNumberUtils;
|
|
||||||
import android.telephony.PhoneStateListener;
|
import android.telephony.PhoneStateListener;
|
||||||
import android.telephony.TelephonyManager;
|
import android.telephony.TelephonyManager;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
@@ -161,7 +160,7 @@ public class GpsNetInitiatedHandler {
|
|||||||
be set to true when the phone is having emergency call, and then will
|
be set to true when the phone is having emergency call, and then will
|
||||||
be set to false by mPhoneStateListener when the emergency call ends.
|
be set to false by mPhoneStateListener when the emergency call ends.
|
||||||
*/
|
*/
|
||||||
mIsInEmergencyCall = PhoneNumberUtils.isEmergencyNumber(phoneNumber);
|
mIsInEmergencyCall = mTelephonyManager.isEmergencyNumber(phoneNumber);
|
||||||
if (DEBUG) Log.v(TAG, "ACTION_NEW_OUTGOING_CALL - " + getInEmergency());
|
if (DEBUG) Log.v(TAG, "ACTION_NEW_OUTGOING_CALL - " + getInEmergency());
|
||||||
} else if (action.equals(LocationManager.MODE_CHANGED_ACTION)) {
|
} else if (action.equals(LocationManager.MODE_CHANGED_ACTION)) {
|
||||||
updateLocationMode();
|
updateLocationMode();
|
||||||
|
|||||||
@@ -405,7 +405,8 @@ public class CallerInfo {
|
|||||||
// Change the callerInfo number ONLY if it is an emergency number
|
// Change the callerInfo number ONLY if it is an emergency number
|
||||||
// or if it is the voicemail number. If it is either, take a
|
// or if it is the voicemail number. If it is either, take a
|
||||||
// shortcut and skip the query.
|
// shortcut and skip the query.
|
||||||
if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
|
TelephonyManager tm = context.getSystemService(TelephonyManager.class);
|
||||||
|
if (tm.isEmergencyNumber(number)) {
|
||||||
return new CallerInfo().markAsEmergency(context);
|
return new CallerInfo().markAsEmergency(context);
|
||||||
} else if (PhoneNumberUtils.isVoiceMailNumber(null, subId, number)) {
|
} else if (PhoneNumberUtils.isVoiceMailNumber(null, subId, number)) {
|
||||||
return new CallerInfo().markAsVoiceMail(context, subId);
|
return new CallerInfo().markAsVoiceMail(context, subId);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import android.os.UserManager;
|
|||||||
import android.provider.ContactsContract.PhoneLookup;
|
import android.provider.ContactsContract.PhoneLookup;
|
||||||
import android.telephony.PhoneNumberUtils;
|
import android.telephony.PhoneNumberUtils;
|
||||||
import android.telephony.SubscriptionManager;
|
import android.telephony.SubscriptionManager;
|
||||||
|
import android.telephony.TelephonyManager;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -481,7 +482,8 @@ public class CallerInfoAsyncQuery {
|
|||||||
cw.subId = subId;
|
cw.subId = subId;
|
||||||
|
|
||||||
// check to see if these are recognized numbers, and use shortcuts if we can.
|
// 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;
|
cw.event = EVENT_EMERGENCY_NUMBER;
|
||||||
} else if (PhoneNumberUtils.isVoiceMailNumber(context, subId, number)) {
|
} else if (PhoneNumberUtils.isVoiceMailNumber(context, subId, number)) {
|
||||||
cw.event = EVENT_VOICEMAIL_NUMBER;
|
cw.event = EVENT_VOICEMAIL_NUMBER;
|
||||||
|
|||||||
Reference in New Issue
Block a user