diff options
| author | 2017-03-01 08:44:32 -0800 | |
|---|---|---|
| committer | 2017-03-01 08:44:32 -0800 | |
| commit | b455f0deed3dd38dea5c89984d1c0e47f17cbf08 (patch) | |
| tree | b5b063f15e04f37198acd3d8a94374a6f67f7253 | |
| parent | 0a6305d5ddf7ca628b36bb65077d44e3ea139be4 (diff) | |
| parent | 81a28efd1b16cf908b308265aa75d17fece17a11 (diff) | |
resolve merge conflicts of 81a28efd1b16 to stage-aosp-master
Change-Id: Ic4c1ca055db8e70db49d9fc91dfc705da6136a5d
3 files changed, 48 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 37e09b8136b8..308ed333a26e 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1214,6 +1214,14 @@ public class CarrierConfigManager { public static final String KEY_CALL_FORWARDING_BLOCKS_WHILE_ROAMING_STRING_ARRAY = "call_forwarding_blocks_while_roaming_string_array"; + /** + * When {@code true}, the user will be notified when they attempt to place an international call + * when the call is placed using wifi calling. + * @hide + */ + public static final String KEY_NOTIFY_INTERNATIONAL_CALL_ON_WFC_BOOL = + "notify_international_call_on_wfc_bool"; + /** The default value for every variable. */ private final static PersistableBundle sDefaults; @@ -1428,6 +1436,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_EDITABLE_TETHER_APN_BOOL, false); sDefaults.putBoolean(KEY_SUPPORT_3GPP_CALL_FORWARDING_WHILE_ROAMING_BOOL, true); sDefaults.putStringArray(KEY_CALL_FORWARDING_BLOCKS_WHILE_ROAMING_STRING_ARRAY, null); + sDefaults.putBoolean(KEY_NOTIFY_INTERNATIONAL_CALL_ON_WFC_BOOL, false); } /** diff --git a/telephony/java/android/telephony/PhoneNumberUtils.java b/telephony/java/android/telephony/PhoneNumberUtils.java index cc21b5ec116d..a3e11c8c99f8 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1440,6 +1440,30 @@ public class PhoneNumberUtils } /** + * Determines if a {@param phoneNumber} is international if dialed from + * {@param defaultCountryIso}. + * + * @param phoneNumber The phone number. + * @param defaultCountryIso The current country ISO. + * @return {@code true} if the number is international, {@code false} otherwise. + * @hide + */ + public static boolean isInternationalNumber(String phoneNumber, String defaultCountryIso) { + // If it starts with # or * its not international. + if (phoneNumber.startsWith("#") || phoneNumber.startsWith("*")) { + return false; + } + + PhoneNumberUtil util = PhoneNumberUtil.getInstance(); + try { + PhoneNumber pn = util.parseAndKeepRawInput(phoneNumber, defaultCountryIso); + return pn.getCountryCode() != util.getCountryCodeForRegion(defaultCountryIso); + } catch (NumberParseException e) { + return false; + } + } + + /** * Format a phone number. * <p> * If the given number doesn't have the country code, the phone will be diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 0571ded46a4b..54194597c00c 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -780,6 +780,21 @@ public class TelephonyManager { "android.telephony.event.EVENT_DOWNGRADE_DATA_DISABLED"; /** + * {@link android.telecom.Connection} event used to indicate that the InCall UI should notify + * the user when an international call is placed while on WFC only. + * <p> + * Used when the carrier config value + * {@link CarrierConfigManager#KEY_NOTIFY_INTERNATIONAL_CALL_ON_WFC_BOOL} is true, the device + * is on WFC (VoLTE not available) and an international number is dialed. + * <p> + * Sent via {@link android.telecom.Connection#sendConnectionEvent(String, Bundle)}. + * The {@link Bundle} parameter is expected to be null when this connection event is used. + * @hide + */ + public static final String EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC = + "android.telephony.event.EVENT_NOTIFY_INTERNATIONAL_CALL_ON_WFC"; + + /** * Response codes for sim activation. Activation completed successfully. * @hide */ |