API changes to Telephony per API review

* Make context the first argument for isLocalEmergencyNumber and
isPotentialLocalEmergencyNumber

* Hide DisconnectCause
Bug: 15432083

Change-Id: I88b5ace925e3704bd032dc9694b0c2dd871b9cf9
This commit is contained in:
Yorke Lee
2014-06-05 08:41:47 -07:00
parent afcece8115
commit d8819baf85
5 changed files with 16 additions and 69 deletions

View File

@ -18,6 +18,8 @@ package android.telephony;
/**
* Contains disconnect call causes generated by the framework and the RIL.
*
* @hide
*/
public class DisconnectCause {

View File

@ -1742,16 +1742,14 @@ public class PhoneNumberUtils
/**
* Checks if a given number is an emergency number for the country that the user is in.
*
* @param number the number to look up.
* @param context the specific context which the number should be checked against
* @param number the number to look up.
*
* @return true if the specified number is an emergency number for the country the user
* is currently in.
*/
public static boolean isLocalEmergencyNumber(String number, Context context) {
return isLocalEmergencyNumberInternal(number,
context,
true /* useExactMatch */);
public static boolean isLocalEmergencyNumber(Context context, String number) {
return isLocalEmergencyNumberInternal(context, number, true /* useExactMatch */);
}
/**
@ -1767,27 +1765,24 @@ public class PhoneNumberUtils
* This method is intended for internal use by the phone app when
* deciding whether to allow ACTION_CALL intents from 3rd party apps
* (where we're required to *not* allow emergency calls to be placed.)
*
* @param number the number to look up.
* @param context the specific context which the number should be checked against
* @param number the number to look up.
*
* @return true if the specified number is an emergency number for a local country, based on the
* CountryDetector.
*
* @see android.location.CountryDetector
* @hide
*/
public static boolean isPotentialLocalEmergencyNumber(String number, Context context) {
return isLocalEmergencyNumberInternal(number,
context,
false /* useExactMatch */);
public static boolean isPotentialLocalEmergencyNumber(Context context, String number) {
return isLocalEmergencyNumberInternal(context, number, false /* useExactMatch */);
}
/**
* Helper function for isLocalEmergencyNumber() and
* isPotentialLocalEmergencyNumber().
*
* @param number the number to look up.
* @param context the specific context which the number should be checked against
* @param number the number to look up.
* @param useExactMatch if true, consider a number to be an emergency
* number only if it *exactly* matches a number listed in
* the RIL / SIM. If false, a number is considered to be an
@ -1799,9 +1794,8 @@ public class PhoneNumberUtils
*
* @see android.location.CountryDetector
*/
private static boolean isLocalEmergencyNumberInternal(String number,
Context context,
boolean useExactMatch) {
private static boolean isLocalEmergencyNumberInternal(Context context, String number,
boolean useExactMatch) {
String countryIso;
CountryDetector detector = (CountryDetector) context.getSystemService(
Context.COUNTRY_DETECTOR);

View File

@ -276,7 +276,7 @@ public class CallerInfo {
// Change the callerInfo number ONLY if it is an emergency number
// or if it is the voicemail number. If it is either, take a
// shortcut and skip the query.
if (PhoneNumberUtils.isLocalEmergencyNumber(number, context)) {
if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
return new CallerInfo().markAsEmergency(context);
} else if (PhoneNumberUtils.isVoiceMailNumber(number)) {
return new CallerInfo().markAsVoiceMail();

View File

@ -399,7 +399,7 @@ public class CallerInfoAsyncQuery {
cw.number = number;
// check to see if these are recognized numbers, and use shortcuts if we can.
if (PhoneNumberUtils.isLocalEmergencyNumber(number, context)) {
if (PhoneNumberUtils.isLocalEmergencyNumber(context, number)) {
cw.event = EVENT_EMERGENCY_NUMBER;
} else if (PhoneNumberUtils.isVoiceMailNumber(number)) {
cw.event = EVENT_VOICEMAIL_NUMBER;