diff options
| author | 2017-02-16 16:21:14 -0800 | |
|---|---|---|
| committer | 2017-02-28 13:08:22 -0800 | |
| commit | ef5a401b7e3a68b0411886572c1a18b948f00c3d (patch) | |
| tree | 6d614f28800fa9ab04d6c2298fc63464c46b744f | |
| parent | 924878a75258c02ab006d8e30a2dc09974e546e4 (diff) | |
Support confirmation of international calls while on WFC only.
Add new carrier config which enables a confirmation message when the user
dials an international number while on WFC only.
Add new @hide PhoneNumberUtils method which is used to determine if a
number dialed is an international number.
Test: Manual, unit.
Bug: 33272455
Merged-In: Ia7ffe10eee7d782ddc3355db616af0a48f19556e
Change-Id: Ia7ffe10eee7d782ddc3355db616af0a48f19556e
3 files changed, 48 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 02774b319625..1076afc30192 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -1127,6 +1127,14 @@ public class CarrierConfigManager { public static final String KEY_SUPPORT_3GPP_CALL_FORWARDING_WHILE_ROAMING_BOOL = "support_3gpp_call_forwarding_while_roaming_bool"; + /** + * 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; @@ -1332,6 +1340,7 @@ public class CarrierConfigManager { sDefaults.putStringArray(KEY_FILTERED_CNAP_NAMES_STRING_ARRAY, null); sDefaults.putBoolean(KEY_EDITABLE_WFC_ROAMING_MODE_BOOL, false); sDefaults.putBoolean(KEY_SUPPORT_3GPP_CALL_FORWARDING_WHILE_ROAMING_BOOL, true); + 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 38cffae96132..2eba4021a2a7 100644 --- a/telephony/java/android/telephony/PhoneNumberUtils.java +++ b/telephony/java/android/telephony/PhoneNumberUtils.java @@ -1439,6 +1439,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 8479f88a8217..20aa5ef743fb 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 */ |