From 13b21caf8bb3af9fd064ea8ae1f3fb4a50734d60 Mon Sep 17 00:00:00 2001 From: Hunsuk Choi <forestchoi@google.com> Date: Fri, 3 Nov 2023 12:08:06 +0000 Subject: [PATCH] Add SystemApis for AP domain selection service plug-in Bug: 258112541 Bug: 309361563 Test: atest DomainSelectionServiceTestOnMockModem Change-Id: Idcdd2e604b09227089361260c676026eac97554d --- core/api/current.txt | 31 ++ core/api/system-current.txt | 82 ++++++ core/api/test-current.txt | 1 - .../telephony/CarrierConfigManager.java | 95 +++--- .../telephony/DomainSelectionService.java | 275 ++++++++++-------- .../android/telephony/DomainSelector.java | 15 +- .../android/telephony/EmergencyRegResult.java | 30 +- .../telephony/PreciseDisconnectCause.java | 11 +- .../android/telephony/TelephonyManager.java | 6 +- .../telephony/TransportSelectorCallback.java | 25 +- .../telephony/WwanSelectorCallback.java | 21 +- .../internal/telephony/IDomainSelector.aidl | 1 - .../internal/telephony/ITelephony.aidl | 12 + .../telephony/ITransportSelectorCallback.aidl | 11 +- 14 files changed, 405 insertions(+), 211 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index e957676507b7..bdc02ff91c0e 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -43466,13 +43466,44 @@ package android.telephony { } public static final class CarrierConfigManager.ImsEmergency { + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int DOMAIN_CS = 1; // 0x1 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int DOMAIN_PS_3GPP = 2; // 0x2 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int DOMAIN_PS_NON_3GPP = 3; // 0x3 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_CROSS_STACK_REDIAL_TIMER_SEC_INT = "imsemergency.cross_stack_redial_timer_sec_int"; field public static final String KEY_EMERGENCY_CALLBACK_MODE_SUPPORTED_BOOL = "imsemergency.emergency_callback_mode_supported_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_CALL_SETUP_TIMER_ON_CURRENT_NETWORK_SEC_INT = "imsemergency.emergency_call_setup_timer_on_current_network_sec_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_CDMA_PREFERRED_NUMBERS_STRING_ARRAY = "imsemergency.emergency_cdma_preferred_numbers_string_array"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_DOMAIN_PREFERENCE_INT_ARRAY = "imsemergency.emergency_domain_preference_int_array"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_DOMAIN_PREFERENCE_ROAMING_INT_ARRAY = "imsemergency.emergency_domain_preference_roaming_int_array"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_LTE_PREFERRED_AFTER_NR_FAILED_BOOL = "imsemergency.emergency_lte_preferred_after_nr_failed_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_NETWORK_SCAN_TYPE_INT = "imsemergency.emergency_network_scan_type_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_OVER_CS_ROAMING_SUPPORTED_ACCESS_NETWORK_TYPES_INT_ARRAY = "imsemergency.emergency_over_cs_roaming_supported_access_network_types_int_array"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_OVER_CS_SUPPORTED_ACCESS_NETWORK_TYPES_INT_ARRAY = "imsemergency.emergency_over_cs_supported_access_network_types_int_array"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_OVER_IMS_ROAMING_SUPPORTED_3GPP_NETWORK_TYPES_INT_ARRAY = "imsemergency.emergency_over_ims_roaming_supported_3gpp_network_types_int_array"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_OVER_IMS_SUPPORTED_3GPP_NETWORK_TYPES_INT_ARRAY = "imsemergency.emergency_over_ims_supported_3gpp_network_types_int_array"; field public static final String KEY_EMERGENCY_OVER_IMS_SUPPORTED_RATS_INT_ARRAY = "imsemergency.emergency_over_ims_supported_rats_int_array"; field public static final String KEY_EMERGENCY_QOS_PRECONDITION_SUPPORTED_BOOL = "imsemergency.emergency_qos_precondition_supported_bool"; field public static final String KEY_EMERGENCY_REGISTRATION_TIMER_MILLIS_INT = "imsemergency.emergency_registration_timer_millis_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_REQUIRES_IMS_REGISTRATION_BOOL = "imsemergency.emergency_requires_ims_registration_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_REQUIRES_VOLTE_ENABLED_BOOL = "imsemergency.emergency_requires_volte_enabled_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_SCAN_TIMER_SEC_INT = "imsemergency.emergency_scan_timer_sec_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_EMERGENCY_VOWIFI_REQUIRES_CONDITION_INT = "imsemergency.emergency_vowifi_requires_condition_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_MAXIMUM_CELLULAR_SEARCH_TIMER_SEC_INT = "imsemergency.maximum_cellular_search_timer_sec_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_MAXIMUM_NUMBER_OF_EMERGENCY_TRIES_OVER_VOWIFI_INT = "imsemergency.maximum_number_of_emergency_tries_over_vowifi_int"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_PREFER_IMS_EMERGENCY_WHEN_VOICE_CALLS_ON_CS_BOOL = "imsemergency.prefer_ims_emergency_when_voice_calls_on_cs_bool"; field public static final String KEY_PREFIX = "imsemergency."; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_QUICK_CROSS_STACK_REDIAL_TIMER_SEC_INT = "imsemergency.quick_cross_stack_redial_timer_sec_int"; field public static final String KEY_REFRESH_GEOLOCATION_TIMEOUT_MILLIS_INT = "imsemergency.refresh_geolocation_timeout_millis_int"; field public static final String KEY_RETRY_EMERGENCY_ON_IMS_PDN_BOOL = "imsemergency.retry_emergency_on_ims_pdn_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_SCAN_LIMITED_SERVICE_AFTER_VOLTE_FAILURE_BOOL = "imsemergency.scan_limited_service_after_volte_failure_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final String KEY_START_QUICK_CROSS_STACK_REDIAL_TIMER_WHEN_REGISTERED_BOOL = "imsemergency.start_quick_cross_stack_redial_timer_when_registered_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int REDIAL_TIMER_DISABLED = 0; // 0x0 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int SCAN_TYPE_FULL_SERVICE = 1; // 0x1 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int SCAN_TYPE_FULL_SERVICE_FOLLOWED_BY_LIMITED_SERVICE = 2; // 0x2 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int SCAN_TYPE_NO_PREFERENCE = 0; // 0x0 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int VOWIFI_REQUIRES_NONE = 0; // 0x0 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int VOWIFI_REQUIRES_SETTING_ENABLED = 1; // 0x1 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int VOWIFI_REQUIRES_VALID_EID = 2; // 0x2 } public static final class CarrierConfigManager.ImsRtt { diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 6afc9483af53..d1ca15c75fbc 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -14055,6 +14055,73 @@ package android.telephony { method @NonNull public android.telephony.DataThrottlingRequest.Builder setDataThrottlingAction(int); } + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public class DomainSelectionService extends android.app.Service { + ctor public DomainSelectionService(); + method public void onBarringInfoUpdated(int, int, @NonNull android.telephony.BarringInfo); + method @Nullable public android.os.IBinder onBind(@Nullable android.content.Intent); + method @NonNull public java.util.concurrent.Executor onCreateExecutor(); + method public void onDomainSelection(@NonNull android.telephony.DomainSelectionService.SelectionAttributes, @NonNull android.telephony.TransportSelectorCallback); + method public void onServiceStateUpdated(int, int, @NonNull android.telephony.ServiceState); + field public static final int SCAN_TYPE_FULL_SERVICE = 2; // 0x2 + field public static final int SCAN_TYPE_LIMITED_SERVICE = 1; // 0x1 + field public static final int SCAN_TYPE_NO_PREFERENCE = 0; // 0x0 + field public static final int SELECTOR_TYPE_CALLING = 1; // 0x1 + field public static final int SELECTOR_TYPE_SMS = 2; // 0x2 + } + + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final class DomainSelectionService.SelectionAttributes implements android.os.Parcelable { + method public int describeContents(); + method @Nullable public android.net.Uri getAddress(); + method @Nullable public String getCallId(); + method public int getCsDisconnectCause(); + method @Nullable public android.telephony.EmergencyRegResult getEmergencyRegResult(); + method @Nullable public android.telephony.ims.ImsReasonInfo getPsDisconnectCause(); + method public int getSelectorType(); + method public int getSlotIndex(); + method public int getSubscriptionId(); + method public boolean isEmergency(); + method public boolean isExitedFromAirplaneMode(); + method public boolean isTestEmergencyNumber(); + method public boolean isVideoCall(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.DomainSelectionService.SelectionAttributes> CREATOR; + } + + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final class DomainSelectionService.SelectionAttributes.Builder { + ctor public DomainSelectionService.SelectionAttributes.Builder(int, int, int); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes build(); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setAddress(@NonNull android.net.Uri); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setCallId(@NonNull String); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setCsDisconnectCause(int); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setEmergency(boolean); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setEmergencyRegResult(@NonNull android.telephony.EmergencyRegResult); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setExitedFromAirplaneMode(boolean); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setPsDisconnectCause(@NonNull android.telephony.ims.ImsReasonInfo); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setTestEmergencyNumber(boolean); + method @NonNull public android.telephony.DomainSelectionService.SelectionAttributes.Builder setVideoCall(boolean); + } + + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public interface DomainSelector { + method public void finishSelection(); + method public void reselectDomain(@NonNull android.telephony.DomainSelectionService.SelectionAttributes); + } + + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public final class EmergencyRegResult implements android.os.Parcelable { + method public int describeContents(); + method public int getAccessNetwork(); + method @NonNull public String getCountryIso(); + method public int getDomain(); + method @NonNull public String getMcc(); + method @NonNull public String getMnc(); + method public int getNwProvidedEmc(); + method public int getNwProvidedEmf(); + method public int getRegState(); + method public boolean isEmcBearerSupported(); + method public boolean isVopsSupported(); + method public void writeToParcel(@NonNull android.os.Parcel, int); + field @NonNull public static final android.os.Parcelable.Creator<android.telephony.EmergencyRegResult> CREATOR; + } + public final class ImsiEncryptionInfo implements android.os.Parcelable { method public int describeContents(); method @Nullable public String getKeyIdentifier(); @@ -14325,6 +14392,8 @@ package android.telephony { field public static final int CHANNEL_UNACCEPTABLE = 6; // 0x6 field public static final int CONDITIONAL_IE_ERROR = 100; // 0x64 field public static final int DESTINATION_OUT_OF_ORDER = 27; // 0x1b + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int EMERGENCY_PERM_FAILURE = 326; // 0x146 + field @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public static final int EMERGENCY_TEMP_FAILURE = 325; // 0x145 field public static final int ERROR_UNSPECIFIED = 65535; // 0xffff field public static final int FACILITY_REJECTED = 29; // 0x1d field public static final int FDN_BLOCKED = 241; // 0xf1 @@ -14807,6 +14876,7 @@ package android.telephony { method @FlaggedApi("com.android.internal.telephony.flags.enable_identifier_disclosure_transparency") @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isCellularIdentifierDisclosureNotificationsEnabled(); method public boolean isDataConnectivityPossible(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDataEnabledForApn(int); + method @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDomainSelectionSupported(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isEmergencyAssistanceEnabled(); method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @WorkerThread public boolean isIccLockEnabled(); method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isIdle(); @@ -15052,6 +15122,13 @@ package android.telephony { method @NonNull public android.telephony.ThermalMitigationRequest.Builder setThermalMitigationAction(int); } + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public interface TransportSelectorCallback { + method public void onCreated(@NonNull android.telephony.DomainSelector); + method public void onSelectionTerminated(int); + method public void onWlanSelected(boolean); + method public void onWwanSelected(@NonNull java.util.function.Consumer<android.telephony.WwanSelectorCallback>); + } + public final class UiccAccessRule implements android.os.Parcelable { ctor public UiccAccessRule(byte[], @Nullable String, long); method public int describeContents(); @@ -15107,6 +15184,11 @@ package android.telephony { field @NonNull public static final android.os.Parcelable.Creator<android.telephony.VopsSupportInfo> CREATOR; } + @FlaggedApi("com.android.internal.telephony.flags.use_oem_domain_selection_service") public interface WwanSelectorCallback { + method public void onDomainSelected(int, boolean); + method public void onRequestEmergencyNetworkScan(@NonNull java.util.List<java.lang.Integer>, int, boolean, @NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<android.telephony.EmergencyRegResult>); + } + } package android.telephony.cdma { diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 77add41f6805..d98c30e15a33 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3309,7 +3309,6 @@ package android.telephony { method @NonNull public android.util.Pair<java.lang.Integer,java.lang.Integer> getHalVersion(int); method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag(); method @Deprecated public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion(); - method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean isDomainSelectionSupported(); method public boolean modifyDevicePolicyOverrideApn(@NonNull android.content.Context, int, @NonNull android.telephony.data.ApnSetting); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile(); method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String); diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index e5a94c302c89..00a2b6b26213 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -7517,8 +7517,8 @@ public class CarrierConfigManager { * * The default value for this key is * {{@link AccessNetworkConstants.AccessNetworkType#EUTRAN}, - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_OVER_IMS_SUPPORTED_3GPP_NETWORK_TYPES_INT_ARRAY = KEY_PREFIX + "emergency_over_ims_supported_3gpp_network_types_int_array"; @@ -7535,8 +7535,8 @@ public class CarrierConfigManager { * * The default value for this key is * {{@link AccessNetworkConstants.AccessNetworkType#EUTRAN}, - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_OVER_IMS_ROAMING_SUPPORTED_3GPP_NETWORK_TYPES_INT_ARRAY = KEY_PREFIX + "emergency_over_ims_roaming_supported_3gpp_network_types_int_array"; @@ -7555,8 +7555,8 @@ public class CarrierConfigManager { * The default value for this key is * {{@link AccessNetworkConstants.AccessNetworkType#UTRAN}, * {@link AccessNetworkConstants.AccessNetworkType#GERAN}}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_OVER_CS_SUPPORTED_ACCESS_NETWORK_TYPES_INT_ARRAY = KEY_PREFIX + "emergency_over_cs_supported_access_network_types_int_array"; @@ -7574,8 +7574,8 @@ public class CarrierConfigManager { * The default value for this key is * {{@link AccessNetworkConstants.AccessNetworkType#UTRAN}, * {@link AccessNetworkConstants.AccessNetworkType#GERAN}}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_OVER_CS_ROAMING_SUPPORTED_ACCESS_NETWORK_TYPES_INT_ARRAY = KEY_PREFIX + "emergency_over_cs_roaming_supported_access_network_types_int_array"; @@ -7590,20 +7590,20 @@ public class CarrierConfigManager { /** * Circuit switched domain. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int DOMAIN_CS = 1; /** * Packet switched domain over 3GPP networks. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int DOMAIN_PS_3GPP = 2; /** * Packet switched domain over non-3GPP networks such as Wi-Fi. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int DOMAIN_PS_NON_3GPP = 3; /** @@ -7620,8 +7620,8 @@ public class CarrierConfigManager { * {{@link #DOMAIN_PS_3GPP}, * {@link #DOMAIN_CS}, * {@link #DOMAIN_PS_NON_3GPP}}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_DOMAIN_PREFERENCE_INT_ARRAY = KEY_PREFIX + "emergency_domain_preference_int_array"; @@ -7639,18 +7639,22 @@ public class CarrierConfigManager { * {{@link #DOMAIN_PS_3GPP}, * {@link #DOMAIN_CS}, * {@link #DOMAIN_PS_NON_3GPP}}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_DOMAIN_PREFERENCE_ROAMING_INT_ARRAY = KEY_PREFIX + "emergency_domain_preference_roaming_int_array"; /** - * Specifies if emergency call shall be attempted on IMS, if PS is attached even though IMS - * is not registered and normal calls fallback to the CS networks. + * Specifies whether the emergency call shall be preferred over IMS or not + * irrespective of IMS registration status. + * If the value of the config is {@code true} then emergency calls shall prefer IMS + * when device is combined-attached in LTE network and IMS is not registered. + * If the value of the config is {@code false} then emergency calls use CS domain + * in the same scenario. * * The default value for this key is {@code false}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_PREFER_IMS_EMERGENCY_WHEN_VOICE_CALLS_ON_CS_BOOL = KEY_PREFIX + "prefer_ims_emergency_when_voice_calls_on_cs_bool"; @@ -7667,32 +7671,39 @@ public class CarrierConfigManager { * If {@link ImsWfc#KEY_EMERGENCY_CALL_OVER_EMERGENCY_PDN_BOOL} is {@code true}, * VoWi-Fi emergency call shall be attempted if Wi-Fi network is connected. * Otherwise, it shall be attempted if IMS is registered over Wi-Fi. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int VOWIFI_REQUIRES_NONE = 0; /** * VoWi-Fi emergency call shall be attempted on IMS over Wi-Fi if Wi-Fi network is connected * and Wi-Fi calling setting is enabled. This value is applicable if the value of * {@link ImsWfc#KEY_EMERGENCY_CALL_OVER_EMERGENCY_PDN_BOOL} is {@code true}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int VOWIFI_REQUIRES_SETTING_ENABLED = 1; /** * VoWi-Fi emergency call shall be attempted on IMS over Wi-Fi if Wi-Fi network is connected - * and Wi-Fi calling is activated successfully. This value is applicable if the value of + * and Wi-Fi calling is activated successfully. The device shall have the valid + * Entitlement ID if the user activates VoWi-Fi emergency calling successfully. + * This value is applicable if the value of * {@link ImsWfc#KEY_EMERGENCY_CALL_OVER_EMERGENCY_PDN_BOOL} is {@code true}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int VOWIFI_REQUIRES_VALID_EID = 2; /** * Specifies the condition when emergency call shall be attempted on IMS over Wi-Fi. * - * The default value for this key is {@code #VOWIFI_REQUIRES_NONE}. - * @hide + * <p>Possible values are, + * {@link #VOWIFI_REQUIRES_NONE} + * {@link #VOWIFI_REQUIRES_SETTING_ENABLED} + * {@link #VOWIFI_REQUIRES_VALID_EID} + * + * The default value for this key is {@link #VOWIFI_REQUIRES_NONE}. */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_VOWIFI_REQUIRES_CONDITION_INT = KEY_PREFIX + "emergency_vowifi_requires_condition_int"; @@ -7703,8 +7714,8 @@ public class CarrierConfigManager { * {@link #KEY_EMERGENCY_DOMAIN_PREFERENCE_ROAMING_INT_ARRAY}. * * The default value for this key is 1. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_MAXIMUM_NUMBER_OF_EMERGENCY_TRIES_OVER_VOWIFI_INT = KEY_PREFIX + "maximum_number_of_emergency_tries_over_vowifi_int"; @@ -7712,14 +7723,14 @@ public class CarrierConfigManager { * Emergency scan timer to wait for scan results from radio before attempting the call * over Wi-Fi. On timer expiry, if emergency call on Wi-Fi is allowed and possible, * telephony shall cancel the scan and place the call on Wi-Fi. If emergency call on Wi-Fi - * is not possible, then domain seleciton continues to wait for the scan result from the + * is not possible, then domain selection continues to wait for the scan result from the * radio. If an emergency scan result is received before the timer expires, the timer shall * be stopped and no dialing over Wi-Fi will be tried. If this value is set to 0, then * the timer is never started and domain selection waits for the scan result from the radio. * * The default value for the timer is 10 seconds. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_SCAN_TIMER_SEC_INT = KEY_PREFIX + "emergency_scan_timer_sec_int"; @@ -7737,8 +7748,8 @@ public class CarrierConfigManager { * started. * * The default value for the timer is {@link #REDIAL_TIMER_DISABLED}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_MAXIMUM_CELLULAR_SEARCH_TIMER_SEC_INT = KEY_PREFIX + "maximum_cellular_search_timer_sec_int"; @@ -7753,21 +7764,21 @@ public class CarrierConfigManager { /** * No specific preference given to the modem. Modem can return an emergency * capable network either with limited service or full service. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int SCAN_TYPE_NO_PREFERENCE = 0; /** * Modem will attempt to camp on a network with full service only. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int SCAN_TYPE_FULL_SERVICE = 1; /** * Telephony shall attempt full service scan first. * If a full service network is not found, telephony shall attempt a limited service scan. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int SCAN_TYPE_FULL_SERVICE_FOLLOWED_BY_LIMITED_SERVICE = 2; /** @@ -7779,8 +7790,8 @@ public class CarrierConfigManager { * {@link #SCAN_TYPE_FULL_SERVICE_FOLLOWED_BY_LIMITED_SERVICE} * * The default value for this key is {@link #SCAN_TYPE_NO_PREFERENCE}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_NETWORK_SCAN_TYPE_INT = KEY_PREFIX + "emergency_network_scan_type_int"; @@ -7791,8 +7802,8 @@ public class CarrierConfigManager { * If this value is set to 0, the timer shall be disabled. * * The default value for this key is 0. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_CALL_SETUP_TIMER_ON_CURRENT_NETWORK_SEC_INT = KEY_PREFIX + "emergency_call_setup_timer_on_current_network_sec_int"; @@ -7801,8 +7812,8 @@ public class CarrierConfigManager { * This is applicable only for the case PS is in service. * * The default value for this key is {@code false}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_REQUIRES_IMS_REGISTRATION_BOOL = KEY_PREFIX + "emergency_requires_ims_registration_bool"; @@ -7811,8 +7822,8 @@ public class CarrierConfigManager { * over NR. If not, CS will be preferred. * * The default value for this key is {@code false}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_LTE_PREFERRED_AFTER_NR_FAILED_BOOL = KEY_PREFIX + "emergency_lte_preferred_after_nr_failed_bool"; @@ -7820,8 +7831,8 @@ public class CarrierConfigManager { * Specifies the numbers to be dialed over CDMA network in case of dialing over CS network. * * The default value for this key is an empty string array. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_CDMA_PREFERRED_NUMBERS_STRING_ARRAY = KEY_PREFIX + "emergency_cdma_preferred_numbers_string_array"; @@ -7830,8 +7841,8 @@ public class CarrierConfigManager { * only when VoLTE is enabled. * * The default value for this key is {@code false}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_EMERGENCY_REQUIRES_VOLTE_ENABLED_BOOL = KEY_PREFIX + "emergency_requires_volte_enabled_bool"; @@ -7842,8 +7853,8 @@ public class CarrierConfigManager { * @see #KEY_CROSS_STACK_REDIAL_TIMER_SEC_INT * @see #KEY_QUICK_CROSS_STACK_REDIAL_TIMER_SEC_INT * @see #KEY_MAXIMUM_CELLULAR_SEARCH_TIMER_SEC_INT - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int REDIAL_TIMER_DISABLED = 0; /** @@ -7855,8 +7866,8 @@ public class CarrierConfigManager { * This value should be greater than the value of {@link #KEY_EMERGENCY_SCAN_TIMER_SEC_INT}. * * The default value for the timer is 120 seconds. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_CROSS_STACK_REDIAL_TIMER_SEC_INT = KEY_PREFIX + "cross_stack_redial_timer_sec_int"; @@ -7871,8 +7882,8 @@ public class CarrierConfigManager { * in the roaming networks and non-domestic networks. * * The default value for the timer is {@link #REDIAL_TIMER_DISABLED}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_QUICK_CROSS_STACK_REDIAL_TIMER_SEC_INT = KEY_PREFIX + "quick_cross_stack_redial_timer_sec_int"; @@ -7881,11 +7892,24 @@ public class CarrierConfigManager { * the device is registered to the network. * * The default value is {@code true}. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final String KEY_START_QUICK_CROSS_STACK_REDIAL_TIMER_WHEN_REGISTERED_BOOL = KEY_PREFIX + "start_quick_cross_stack_redial_timer_when_registered_bool"; + /** + * Indicates whether limited service only scanning will be requested after VoLTE fails. + * This value is applicable if the value of + * {@link #KEY_EMERGENCY_NETWORK_SCAN_TYPE_INT} is any of {@link #SCAN_TYPE_NO_PREFERENCE} + * or {@link #SCAN_TYPE_FULL_SERVICE_FOLLOWED_BY_LIMITED_SERVICE}. + * + * The default value is {@code false}. + */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) + public static final String + KEY_SCAN_LIMITED_SERVICE_AFTER_VOLTE_FAILURE_BOOL = + KEY_PREFIX + "scan_limited_service_after_volte_failure_bool"; + private static PersistableBundle getDefaults() { PersistableBundle defaults = new PersistableBundle(); defaults.putBoolean(KEY_RETRY_EMERGENCY_ON_IMS_PDN_BOOL, false); @@ -7957,6 +7981,7 @@ public class CarrierConfigManager { defaults.putInt(KEY_QUICK_CROSS_STACK_REDIAL_TIMER_SEC_INT, REDIAL_TIMER_DISABLED); defaults.putBoolean(KEY_START_QUICK_CROSS_STACK_REDIAL_TIMER_WHEN_REGISTERED_BOOL, true); + defaults.putBoolean(KEY_SCAN_LIMITED_SERVICE_AFTER_VOLTE_FAILURE_BOOL, false); return defaults; } diff --git a/telephony/java/android/telephony/DomainSelectionService.java b/telephony/java/android/telephony/DomainSelectionService.java index abcce5f61aee..5ada975bbb48 100644 --- a/telephony/java/android/telephony/DomainSelectionService.java +++ b/telephony/java/android/telephony/DomainSelectionService.java @@ -16,12 +16,14 @@ package android.telephony; +import android.annotation.FlaggedApi; import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; -import android.annotation.SuppressLint; +import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; +import android.net.Uri; import android.os.Build; import android.os.CancellationSignal; import android.os.IBinder; @@ -40,6 +42,7 @@ import com.android.internal.telephony.ITransportSelectorCallback; import com.android.internal.telephony.ITransportSelectorResultCallback; import com.android.internal.telephony.IWwanSelectorCallback; import com.android.internal.telephony.IWwanSelectorResultCallback; +import com.android.internal.telephony.flags.Flags; import com.android.internal.telephony.util.TelephonyUtils; import com.android.telephony.Rlog; @@ -55,12 +58,38 @@ import java.util.concurrent.Executor; import java.util.function.Consumer; /** - * Main domain selection implementation for various telephony features. - * - * The telephony framework will bind to the {@link DomainSelectionService}. + * Base domain selection implementation. + * <p> + * Services that extend {@link DomainSelectionService} must register the service in their + * AndroidManifest.xml to be detected by the framework. + * <p> + * 1) The application must declare that they use the + * android.permission.BIND_DOMAIN_SELECTION_SERVICE permission. + * <p> + * 2) The DomainSelectionService definition in the manifest must follow this format: + * <pre> + * {@code + * ... + * <service android:name=".EgDomainSelectionService" + * android:permission="android.permission.BIND_DOMAIN_SELECTION_SERVICE" > + * <intent-filter> + * <action android:name="android.telephony.DomainSelectionService" /> + * </intent-filter> + * </service> + * ... + * } + * </pre> + * <p> + * The ComponentName corresponding to this DomainSelectionService component MUST also be set + * as the system domain selection implementation in order to be bound. + * The system domain selection implementation is set in the device overlay for + * {@code config_domain_selection_service_component_name} + * in {@code packages/services/Telephony/res/values/config.xml}. * * @hide */ +@SystemApi +@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public class DomainSelectionService extends Service { private static final String LOG_TAG = "DomainSelectionService"; @@ -78,16 +107,13 @@ public class DomainSelectionService extends Service { @IntDef(prefix = "SELECTOR_TYPE_", value = { SELECTOR_TYPE_CALLING, - SELECTOR_TYPE_SMS, - SELECTOR_TYPE_UT}) + SELECTOR_TYPE_SMS}) public @interface SelectorType {} /** Indicates the domain selector type for calling. */ public static final int SELECTOR_TYPE_CALLING = 1; /** Indicates the domain selector type for sms. */ public static final int SELECTOR_TYPE_SMS = 2; - /** Indicates the domain selector type for supplementary services. */ - public static final int SELECTOR_TYPE_UT = 3; /** Indicates that the modem can scan for emergency service as per modem’s implementation. */ public static final int SCAN_TYPE_NO_PREFERENCE = 0; @@ -110,51 +136,52 @@ public class DomainSelectionService extends Service { /** * Contains attributes required to determine the domain for a telephony service. */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final class SelectionAttributes implements Parcelable { private static final String TAG = "SelectionAttributes"; - private int mSlotId; + private int mSlotIndex; private int mSubId; private @Nullable String mCallId; - private @Nullable String mNumber; + private @Nullable Uri mAddress; private @SelectorType int mSelectorType; private boolean mIsVideoCall; private boolean mIsEmergency; + private boolean mIsTestEmergencyNumber; private boolean mIsExitedFromAirplaneMode; - //private @Nullable UtAttributes mUtAttributes; private @Nullable ImsReasonInfo mImsReasonInfo; private @PreciseDisconnectCauses int mCause; private @Nullable EmergencyRegResult mEmergencyRegResult; /** - * @param slotId The slot identifier. - * @param subId The subscription identifier. + * @param slotIndex The logical slot index. + * @param subscriptionId The subscription identifier. * @param callId The call identifier. - * @param number The dialed number. + * @param address The dialed address. * @param selectorType Indicates the requested domain selector type. * @param video Indicates it's a video call. * @param emergency Indicates it's emergency service. + * @param isTest Indicates it's a test emergency number. * @param exited {@code true} if the request caused the device to move out of airplane mode. * @param imsReasonInfo The reason why the last PS attempt failed. * @param cause The reason why the last CS attempt failed. * @param regResult The current registration result for emergency services. */ - private SelectionAttributes(int slotId, int subId, @Nullable String callId, - @Nullable String number, @SelectorType int selectorType, - boolean video, boolean emergency, boolean exited, - /*UtAttributes attr,*/ + private SelectionAttributes(int slotIndex, int subscriptionId, @Nullable String callId, + @Nullable Uri address, @SelectorType int selectorType, + boolean video, boolean emergency, boolean isTest, boolean exited, @Nullable ImsReasonInfo imsReasonInfo, @PreciseDisconnectCauses int cause, @Nullable EmergencyRegResult regResult) { - mSlotId = slotId; - mSubId = subId; + mSlotIndex = slotIndex; + mSubId = subscriptionId; mCallId = callId; - mNumber = number; + mAddress = address; mSelectorType = selectorType; mIsVideoCall = video; mIsEmergency = emergency; + mIsTestEmergencyNumber = isTest; mIsExitedFromAirplaneMode = exited; - //mUtAttributes = attr; mImsReasonInfo = imsReasonInfo; mCause = cause; mEmergencyRegResult = regResult; @@ -167,14 +194,14 @@ public class DomainSelectionService extends Service { * @hide */ public SelectionAttributes(@NonNull SelectionAttributes s) { - mSlotId = s.mSlotId; + mSlotIndex = s.mSlotIndex; mSubId = s.mSubId; mCallId = s.mCallId; - mNumber = s.mNumber; + mAddress = s.mAddress; mSelectorType = s.mSelectorType; mIsEmergency = s.mIsEmergency; + mIsTestEmergencyNumber = s.mIsTestEmergencyNumber; mIsExitedFromAirplaneMode = s.mIsExitedFromAirplaneMode; - //mUtAttributes = s.mUtAttributes; mImsReasonInfo = s.mImsReasonInfo; mCause = s.mCause; mEmergencyRegResult = s.mEmergencyRegResult; @@ -188,16 +215,16 @@ public class DomainSelectionService extends Service { } /** - * @return The slot identifier. + * @return The logical slot index. */ - public int getSlotId() { - return mSlotId; + public int getSlotIndex() { + return mSlotIndex; } /** * @return The subscription identifier. */ - public int getSubId() { + public int getSubscriptionId() { return mSubId; } @@ -209,10 +236,10 @@ public class DomainSelectionService extends Service { } /** - * @return The dialed number. + * @return The dialed address. */ - public @Nullable String getNumber() { - return mNumber; + public @Nullable Uri getAddress() { + return mAddress; } /** @@ -236,6 +263,13 @@ public class DomainSelectionService extends Service { return mIsEmergency; } + /** + * @return {@code true} if the dialed number is a test emergency number. + */ + public boolean isTestEmergencyNumber() { + return mIsTestEmergencyNumber; + } + /** * @return {@code true} if the request caused the device to move out of airplane mode. */ @@ -243,12 +277,6 @@ public class DomainSelectionService extends Service { return mIsExitedFromAirplaneMode; } - /* - public @Nullable UtAttributes getUtAttributes(); - return mUtAttributes; - } - */ - /** * @return The PS disconnect cause if trying over PS resulted in a failure and * reselection is required. @@ -274,13 +302,14 @@ public class DomainSelectionService extends Service { @Override public @NonNull String toString() { - return "{ slotId=" + mSlotId + return "{ slotIndex=" + mSlotIndex + ", subId=" + mSubId + ", callId=" + mCallId - + ", number=" + (Build.IS_DEBUGGABLE ? mNumber : "***") + + ", address=" + (Build.IS_DEBUGGABLE ? mAddress : "***") + ", type=" + mSelectorType + ", videoCall=" + mIsVideoCall + ", emergency=" + mIsEmergency + + ", isTest=" + mIsTestEmergencyNumber + ", airplaneMode=" + mIsExitedFromAirplaneMode + ", reasonInfo=" + mImsReasonInfo + ", cause=" + mCause @@ -293,13 +322,13 @@ public class DomainSelectionService extends Service { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; SelectionAttributes that = (SelectionAttributes) o; - return mSlotId == that.mSlotId && mSubId == that.mSubId + return mSlotIndex == that.mSlotIndex && mSubId == that.mSubId && TextUtils.equals(mCallId, that.mCallId) - && TextUtils.equals(mNumber, that.mNumber) + && equalsHandlesNulls(mAddress, that.mAddress) && mSelectorType == that.mSelectorType && mIsVideoCall == that.mIsVideoCall && mIsEmergency == that.mIsEmergency + && mIsTestEmergencyNumber == that.mIsTestEmergencyNumber && mIsExitedFromAirplaneMode == that.mIsExitedFromAirplaneMode - //&& equalsHandlesNulls(mUtAttributes, that.mUtAttributes) && equalsHandlesNulls(mImsReasonInfo, that.mImsReasonInfo) && mCause == that.mCause && equalsHandlesNulls(mEmergencyRegResult, that.mEmergencyRegResult); @@ -307,9 +336,9 @@ public class DomainSelectionService extends Service { @Override public int hashCode() { - return Objects.hash(mCallId, mNumber, mImsReasonInfo, - mIsVideoCall, mIsEmergency, mIsExitedFromAirplaneMode, mEmergencyRegResult, - mSlotId, mSubId, mSelectorType, mCause); + return Objects.hash(mCallId, mAddress, mImsReasonInfo, + mIsVideoCall, mIsEmergency, mIsTestEmergencyNumber, mIsExitedFromAirplaneMode, + mEmergencyRegResult, mSlotIndex, mSubId, mSelectorType, mCause); } @Override @@ -319,30 +348,31 @@ public class DomainSelectionService extends Service { @Override public void writeToParcel(@NonNull Parcel out, int flags) { - out.writeInt(mSlotId); + out.writeInt(mSlotIndex); out.writeInt(mSubId); out.writeString8(mCallId); - out.writeString8(mNumber); + out.writeParcelable(mAddress, 0); out.writeInt(mSelectorType); out.writeBoolean(mIsVideoCall); out.writeBoolean(mIsEmergency); + out.writeBoolean(mIsTestEmergencyNumber); out.writeBoolean(mIsExitedFromAirplaneMode); - //out.writeParcelable(mUtAttributes, 0); out.writeParcelable(mImsReasonInfo, 0); out.writeInt(mCause); out.writeParcelable(mEmergencyRegResult, 0); } private void readFromParcel(@NonNull Parcel in) { - mSlotId = in.readInt(); + mSlotIndex = in.readInt(); mSubId = in.readInt(); mCallId = in.readString8(); - mNumber = in.readString8(); + mAddress = in.readParcelable(Uri.class.getClassLoader(), + android.net.Uri.class); mSelectorType = in.readInt(); mIsVideoCall = in.readBoolean(); mIsEmergency = in.readBoolean(); + mIsTestEmergencyNumber = in.readBoolean(); mIsExitedFromAirplaneMode = in.readBoolean(); - //mUtAttributes = s.mUtAttributes; mImsReasonInfo = in.readParcelable(ImsReasonInfo.class.getClassLoader(), android.telephony.ims.ImsReasonInfo.class); mCause = in.readInt(); @@ -370,16 +400,17 @@ public class DomainSelectionService extends Service { /** * Builder class creating a new instance. */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final class Builder { - private final int mSlotId; + private final int mSlotIndex; private final int mSubId; private @Nullable String mCallId; - private @Nullable String mNumber; + private @Nullable Uri mAddress; private final @SelectorType int mSelectorType; private boolean mIsVideoCall; private boolean mIsEmergency; + private boolean mIsTestEmergencyNumber; private boolean mIsExitedFromAirplaneMode; - //private @Nullable UtAttributes mUtAttributes; private @Nullable ImsReasonInfo mImsReasonInfo; private @PreciseDisconnectCauses int mCause; private @Nullable EmergencyRegResult mEmergencyRegResult; @@ -387,9 +418,9 @@ public class DomainSelectionService extends Service { /** * Default constructor for Builder. */ - public Builder(int slotId, int subId, @SelectorType int selectorType) { - mSlotId = slotId; - mSubId = subId; + public Builder(int slotIndex, int subscriptionId, @SelectorType int selectorType) { + mSlotIndex = slotIndex; + mSubId = subscriptionId; mSelectorType = selectorType; } @@ -405,63 +436,60 @@ public class DomainSelectionService extends Service { } /** - * Sets the dialed number. + * Sets the dialed address. * - * @param number The dialed number. + * @param address The dialed address. * @return The same instance of the builder. */ - public @NonNull Builder setNumber(@NonNull String number) { - mNumber = number; + public @NonNull Builder setAddress(@NonNull Uri address) { + mAddress = address; return this; } /** * Sets whether it's a video call or not. * - * @param video Indicates it's a video call. + * @param isVideo Indicates it's a video call. * @return The same instance of the builder. */ - public @NonNull Builder setVideoCall(boolean video) { - mIsVideoCall = video; + public @NonNull Builder setVideoCall(boolean isVideo) { + mIsVideoCall = isVideo; return this; } /** * Sets whether it's an emergency service or not. * - * @param emergency Indicates it's emergency service. + * @param isEmergency Indicates it's emergency service. * @return The same instance of the builder. */ - public @NonNull Builder setEmergency(boolean emergency) { - mIsEmergency = emergency; + public @NonNull Builder setEmergency(boolean isEmergency) { + mIsEmergency = isEmergency; return this; } /** - * Sets whether the request caused the device to move out of airplane mode. + * Sets whether it's a test emergency number or not. * - * @param exited {@code true} if the request caused the device to move out of - * airplane mode. + * @param isTest Indicates it's a test emergency number. * @return The same instance of the builder. */ - public @NonNull Builder setExitedFromAirplaneMode(boolean exited) { - mIsExitedFromAirplaneMode = exited; + public @NonNull Builder setTestEmergencyNumber(boolean isTest) { + mIsTestEmergencyNumber = isTest; return this; } /** - * Sets the Ut service attributes. - * Only applicable for SELECTOR_TYPE_UT + * Sets whether the request caused the device to move out of airplane mode. * - * @param attr Ut services attributes. + * @param exited {@code true} if the request caused the device to move out of + * airplane mode. * @return The same instance of the builder. */ - /* - public @NonNull Builder setUtAttributes(@NonNull UtAttributes attr); - mUtAttributes = attr; + public @NonNull Builder setExitedFromAirplaneMode(boolean exited) { + mIsExitedFromAirplaneMode = exited; return this; } - */ /** * Sets an optional reason why the last PS attempt failed. @@ -501,9 +529,10 @@ public class DomainSelectionService extends Service { * @return The SelectionAttributes object. */ public @NonNull SelectionAttributes build() { - return new SelectionAttributes(mSlotId, mSubId, mCallId, mNumber, mSelectorType, - mIsVideoCall, mIsEmergency, mIsExitedFromAirplaneMode, /*mUtAttributes,*/ - mImsReasonInfo, mCause, mEmergencyRegResult); + return new SelectionAttributes(mSlotIndex, mSubId, mCallId, mAddress, + mSelectorType, mIsVideoCall, mIsEmergency, mIsTestEmergencyNumber, + mIsExitedFromAirplaneMode, mImsReasonInfo, + mCause, mEmergencyRegResult); } } } @@ -545,19 +574,6 @@ public class DomainSelectionService extends Service { } } - @Override - public @NonNull WwanSelectorCallback onWwanSelected() { - WwanSelectorCallback callback = null; - try { - IWwanSelectorCallback cb = mCallback.onWwanSelected(); - callback = new WwanSelectorCallbackWrapper(cb, mExecutor); - } catch (Exception e) { - Rlog.e(TAG, "onWwanSelected e=" + e); - } - - return callback; - } - @Override public void onWwanSelected(Consumer<WwanSelectorCallback> consumer) { try { @@ -626,15 +642,6 @@ public class DomainSelectionService extends Service { mExecutor = executor; } - @Override - public void cancelSelection() { - final DomainSelector domainSelector = mDomainSelectorWeakRef.get(); - if (domainSelector == null) return; - - executeMethodAsyncNoException(mExecutor, - () -> domainSelector.cancelSelection(), TAG, "cancelSelection"); - } - @Override public void reselectDomain(@NonNull SelectionAttributes attr) { final DomainSelector domainSelector = mDomainSelectorWeakRef.get(); @@ -688,7 +695,8 @@ public class DomainSelectionService extends Service { @Override public void onRequestEmergencyNetworkScan(@NonNull List<Integer> preferredNetworks, - @EmergencyScanType int scanType, @NonNull CancellationSignal signal, + @EmergencyScanType int scanType, boolean resetScan, + @NonNull CancellationSignal signal, @NonNull Consumer<EmergencyRegResult> consumer) { try { if (signal != null) signal.setOnCancelListener(this); @@ -738,7 +746,15 @@ public class DomainSelectionService extends Service { private @NonNull Executor mExecutor; /** - * Selects a domain for the given operation. + * Selects a calling domain given the SelectionAttributes of the call request. + * <p> + * When the framework generates a request to place a call, {@link #onDomainSelection} + * will be called in order to determine the domain (CS or PS). For PS calls, the transport + * (WWAN or WLAN) will also need to be determined. + * <p> + * Once the domain/transport has been selected or an error has occurred, + * {@link TransportSelectorCallback} must be used to communicate the result back + * to the framework. * * @param attr Required to determine the domain. * @param callback The callback instance being registered. @@ -748,23 +764,24 @@ public class DomainSelectionService extends Service { } /** - * Notifies the change in {@link ServiceState} for a specific slot. + * Notifies the change in {@link ServiceState} for a specific logical slot index. * - * @param slotId For which the state changed. - * @param subId For which the state changed. + * @param slotIndex For which the state changed. + * @param subscriptionId For which the state changed. * @param serviceState Updated {@link ServiceState}. */ - public void onServiceStateUpdated(int slotId, int subId, @NonNull ServiceState serviceState) { + public void onServiceStateUpdated(int slotIndex, int subscriptionId, + @NonNull ServiceState serviceState) { } /** - * Notifies the change in {@link BarringInfo} for a specific slot. + * Notifies the change in {@link BarringInfo} for a specific logical slot index. * - * @param slotId For which the state changed. - * @param subId For which the state changed. + * @param slotIndex For which the state changed. + * @param subscriptionId For which the state changed. * @param info Updated {@link BarringInfo}. */ - public void onBarringInfoUpdated(int slotId, int subId, @NonNull BarringInfo info) { + public void onBarringInfoUpdated(int slotIndex, int subscriptionId, @NonNull BarringInfo info) { } private final IBinder mDomainSelectionServiceController = @@ -779,16 +796,19 @@ public class DomainSelectionService extends Service { } @Override - public void updateServiceState(int slotId, int subId, @NonNull ServiceState serviceState) { + public void updateServiceState(int slotIndex, int subscriptionId, + @NonNull ServiceState serviceState) { executeMethodAsyncNoException(getCachedExecutor(), - () -> DomainSelectionService.this.onServiceStateUpdated(slotId, - subId, serviceState), LOG_TAG, "onServiceStateUpdated"); + () -> DomainSelectionService.this.onServiceStateUpdated(slotIndex, + subscriptionId, serviceState), LOG_TAG, "onServiceStateUpdated"); } @Override - public void updateBarringInfo(int slotId, int subId, @NonNull BarringInfo info) { + public void updateBarringInfo(int slotIndex, int subscriptionId, + @NonNull BarringInfo info) { executeMethodAsyncNoException(getCachedExecutor(), - () -> DomainSelectionService.this.onBarringInfoUpdated(slotId, subId, info), + () -> DomainSelectionService.this.onBarringInfoUpdated(slotIndex, + subscriptionId, info), LOG_TAG, "onBarringInfoUpdated"); } }; @@ -816,7 +836,8 @@ public class DomainSelectionService extends Service { /** @hide */ @Override - public IBinder onBind(Intent intent) { + public @Nullable IBinder onBind(@Nullable Intent intent) { + if (intent == null) return null; if (SERVICE_INTERFACE.equals(intent.getAction())) { Log.i(LOG_TAG, "DomainSelectionService Bound."); return mDomainSelectionServiceController; @@ -825,13 +846,13 @@ public class DomainSelectionService extends Service { } /** - * The DomainSelectionService will be able to define an {@link Executor} that the service - * can use to execute the methods. It has set the default executor as Runnable::run, + * The Executor to use when calling callback methods from the framework. + * <p> + * By default, calls from the framework will use Binder threads to call these methods. * - * @return An {@link Executor} to be used. + * @return an {@link Executor} used to execute methods called remotely by the framework. */ - @SuppressLint("OnNameExpected") - public @NonNull Executor getExecutor() { + public @NonNull Executor onCreateExecutor() { return Runnable::run; } @@ -845,7 +866,7 @@ public class DomainSelectionService extends Service { public @NonNull Executor getCachedExecutor() { synchronized (mExecutorLock) { if (mExecutor == null) { - Executor e = getExecutor(); + Executor e = onCreateExecutor(); mExecutor = (e != null) ? e : Runnable::run; } return mExecutor; diff --git a/telephony/java/android/telephony/DomainSelector.java b/telephony/java/android/telephony/DomainSelector.java index 087183122670..5d25d3a8037b 100644 --- a/telephony/java/android/telephony/DomainSelector.java +++ b/telephony/java/android/telephony/DomainSelector.java @@ -16,21 +16,22 @@ package android.telephony; +import android.annotation.FlaggedApi; import android.annotation.NonNull; +import android.annotation.SystemApi; import android.telephony.DomainSelectionService.SelectionAttributes; +import com.android.internal.telephony.flags.Flags; + /** * Implemented as part of the {@link DomainSelectionService} to implement domain selection - * for a specific use case. + * for a specific use case and receive signals from the framework to reselect a new domain + * when a previous domain selection fails or finish a selection when the call connects successfully. * @hide */ +@SystemApi +@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public interface DomainSelector { - /** - * Cancel an ongoing selection operation. It is up to the DomainSelectionService - * to clean up all ongoing operations with the framework. - */ - void cancelSelection(); - /** * Reselect a domain due to the call not setting up properly. * diff --git a/telephony/java/android/telephony/EmergencyRegResult.java b/telephony/java/android/telephony/EmergencyRegResult.java index 5aed41254cf6..15579be2d786 100644 --- a/telephony/java/android/telephony/EmergencyRegResult.java +++ b/telephony/java/android/telephony/EmergencyRegResult.java @@ -16,17 +16,25 @@ package android.telephony; +import android.annotation.FlaggedApi; import android.annotation.NonNull; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; +import com.android.internal.telephony.flags.Flags; + import java.util.Objects; /** - * Contains attributes required to determine the domain for a telephony service + * Contains attributes required to determine the domain for a telephony service, including + * the network registration state. + * * @hide */ +@SystemApi +@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public final class EmergencyRegResult implements Parcelable { /** @@ -77,7 +85,7 @@ public final class EmergencyRegResult implements Parcelable { * The ISO-3166-1 alpha-2 country code equivalent for the network's country code, * empty string if unknown. */ - private @NonNull String mIso; + private @NonNull String mCountryIso; /** * Constructor @@ -108,7 +116,7 @@ public final class EmergencyRegResult implements Parcelable { mNwProvidedEmf = emf; mMcc = mcc; mMnc = mnc; - mIso = iso; + mCountryIso = iso; } /** @@ -127,7 +135,7 @@ public final class EmergencyRegResult implements Parcelable { mNwProvidedEmf = s.mNwProvidedEmf; mMcc = s.mMcc; mMnc = s.mMnc; - mIso = s.mIso; + mCountryIso = s.mCountryIso; } /** @@ -226,8 +234,8 @@ public final class EmergencyRegResult implements Parcelable { * * @return Country code. */ - public @NonNull String getIso() { - return mIso; + public @NonNull String getCountryIso() { + return mCountryIso; } @Override @@ -242,7 +250,7 @@ public final class EmergencyRegResult implements Parcelable { + ", emf=" + mNwProvidedEmf + ", mcc=" + mMcc + ", mnc=" + mMnc - + ", iso=" + mIso + + ", iso=" + mCountryIso + " }"; } @@ -260,7 +268,7 @@ public final class EmergencyRegResult implements Parcelable { && mNwProvidedEmf == that.mNwProvidedEmf && TextUtils.equals(mMcc, that.mMcc) && TextUtils.equals(mMnc, that.mMnc) - && TextUtils.equals(mIso, that.mIso); + && TextUtils.equals(mCountryIso, that.mCountryIso); } @Override @@ -268,7 +276,7 @@ public final class EmergencyRegResult implements Parcelable { return Objects.hash(mAccessNetworkType, mRegState, mDomain, mIsVopsSupported, mIsEmcBearerSupported, mNwProvidedEmc, mNwProvidedEmf, - mMcc, mMnc, mIso); + mMcc, mMnc, mCountryIso); } @Override @@ -287,7 +295,7 @@ public final class EmergencyRegResult implements Parcelable { out.writeInt(mNwProvidedEmf); out.writeString8(mMcc); out.writeString8(mMnc); - out.writeString8(mIso); + out.writeString8(mCountryIso); } private void readFromParcel(@NonNull Parcel in) { @@ -300,7 +308,7 @@ public final class EmergencyRegResult implements Parcelable { mNwProvidedEmf = in.readInt(); mMcc = in.readString8(); mMnc = in.readString8(); - mIso = in.readString8(); + mCountryIso = in.readString8(); } public static final @NonNull Creator<EmergencyRegResult> CREATOR = diff --git a/telephony/java/android/telephony/PreciseDisconnectCause.java b/telephony/java/android/telephony/PreciseDisconnectCause.java index 1cfd22cc4d65..d9437ab29881 100644 --- a/telephony/java/android/telephony/PreciseDisconnectCause.java +++ b/telephony/java/android/telephony/PreciseDisconnectCause.java @@ -16,8 +16,11 @@ package android.telephony; +import android.annotation.FlaggedApi; import android.annotation.SystemApi; +import com.android.internal.telephony.flags.Flags; + /** * Contains precise disconnect call causes generated by the framework and the RIL. * @hide @@ -238,18 +241,18 @@ public final class PreciseDisconnectCause { /** * Dialing emergency calls is currently unavailable. * The call should be redialed on the other subscription silently. - * If there is no other subscription available, the call may be redialed + * If there are no other subscriptions available then the call may be redialed * on this subscription again. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int EMERGENCY_TEMP_FAILURE = 325; /** * Dialing emergency calls is currently unavailable. * The call should be redialed on the other subscription silently. - * Even if there is no other subscription available, the call should not + * If there are no other subscriptions available then the call should not * be redialed on this subscription again. - * @hide */ + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public static final int EMERGENCY_PERM_FAILURE = 326; /** Mobile station (MS) is locked until next power cycle. */ diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index 89661a4368ec..606212cc5d27 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -19207,13 +19207,11 @@ public class TelephonyManager { /** * Returns whether the domain selection service is supported. * - * <p>Requires Permission: - * {@link android.Manifest.permission#READ_PRIVILEGED_PHONE_STATE READ_PRIVILEGED_PHONE_STATE}. - * * @return {@code true} if the domain selection service is supported. * @hide */ - @TestApi + @SystemApi + @FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) @RequiresFeature(PackageManager.FEATURE_TELEPHONY_CALLING) public boolean isDomainSelectionSupported() { diff --git a/telephony/java/android/telephony/TransportSelectorCallback.java b/telephony/java/android/telephony/TransportSelectorCallback.java index 04752e418466..0f5dd27120e3 100644 --- a/telephony/java/android/telephony/TransportSelectorCallback.java +++ b/telephony/java/android/telephony/TransportSelectorCallback.java @@ -16,18 +16,28 @@ package android.telephony; +import android.annotation.FlaggedApi; import android.annotation.NonNull; +import android.annotation.SystemApi; import android.telephony.Annotation.DisconnectCauses; +import com.android.internal.telephony.flags.Flags; + import java.util.function.Consumer; /** - * A callback class used to receive the transport selection result. + * A callback class used by the domain selection module to notify the framework of the result of + * selecting a domain for a call. * @hide */ +@SystemApi +@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public interface TransportSelectorCallback { /** * Notify that {@link DomainSelector} instance has been created for the selection request. + * <p> + * DomainSelector callbacks run using the executor specified in + * {@link DomainSelectionService#onCreateExecutor}. * * @param selector the {@link DomainSelector} instance created. */ @@ -41,16 +51,13 @@ public interface TransportSelectorCallback { void onWlanSelected(boolean useEmergencyPdn); /** - * Notify that WWAN transport has been selected. - */ - @NonNull WwanSelectorCallback onWwanSelected(); - - /** - * Notify that WWAN transport has been selected. + * Notify that WWAN transport has been selected and the next phase of selecting + * the PS or CS domain is starting. * - * @param consumer The callback to receive the result. + * @param consumer The callback used by the {@link DomainSelectionService} to optionally run + * emergency network scans and notify the framework of the WWAN transport result. */ - void onWwanSelected(Consumer<WwanSelectorCallback> consumer); + void onWwanSelected(@NonNull Consumer<WwanSelectorCallback> consumer); /** * Notify that selection has terminated because there is no decision that can be made diff --git a/telephony/java/android/telephony/WwanSelectorCallback.java b/telephony/java/android/telephony/WwanSelectorCallback.java index f9c2620cfaf8..ea83815c146d 100644 --- a/telephony/java/android/telephony/WwanSelectorCallback.java +++ b/telephony/java/android/telephony/WwanSelectorCallback.java @@ -16,29 +16,38 @@ package android.telephony; +import android.annotation.FlaggedApi; import android.annotation.NonNull; +import android.annotation.SystemApi; import android.os.CancellationSignal; import android.telephony.DomainSelectionService.EmergencyScanType; +import com.android.internal.telephony.flags.Flags; + import java.util.List; import java.util.function.Consumer; /** - * A callback class used to receive the domain selection result. + * A callback class used to communicate with the framework to request network scans + * and notify the framework when a WWAN domain has been selected. * @hide */ +@SystemApi +@FlaggedApi(Flags.FLAG_USE_OEM_DOMAIN_SELECTION_SERVICE) public interface WwanSelectorCallback { /** * Notify the framework that the {@link DomainSelectionService} has requested an emergency * network scan as part of selection. * - * @param preferredNetworks the ordered list of preferred networks to scan. - * @param scanType indicates the scan preference, such as full service or limited service. - * @param signal notifies when the operation is canceled. - * @param consumer the handler of the response. + * @param preferredNetworks The ordered list of preferred networks to scan. + * @param scanType Indicates the scan preference, such as full service or limited service. + * @param resetScan Indicates that the previous scan result shall be reset before scanning. + * @param signal Notifies when the operation is canceled. + * @param consumer The handler of the response, which will contain a one-shot result + * of the network scan. */ void onRequestEmergencyNetworkScan(@NonNull List<Integer> preferredNetworks, - @EmergencyScanType int scanType, + @EmergencyScanType int scanType, boolean resetScan, @NonNull CancellationSignal signal, @NonNull Consumer<EmergencyRegResult> consumer); /** diff --git a/telephony/java/com/android/internal/telephony/IDomainSelector.aidl b/telephony/java/com/android/internal/telephony/IDomainSelector.aidl index d94840b112ee..0eeadee78abd 100644 --- a/telephony/java/com/android/internal/telephony/IDomainSelector.aidl +++ b/telephony/java/com/android/internal/telephony/IDomainSelector.aidl @@ -19,7 +19,6 @@ package com.android.internal.telephony; import android.telephony.DomainSelectionService.SelectionAttributes; oneway interface IDomainSelector { - void cancelSelection(); void reselectDomain(in SelectionAttributes attr); void finishSelection(); } diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index a1fc064d0d81..213fbc55d597 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -3202,6 +3202,18 @@ interface ITelephony { */ boolean setShouldSendDatagramToModemInDemoMode(boolean shouldSendToModemInDemoMode); + /** + * @return {@code true} if the DomainSelectionService is set, + * {@code false} otherwise. + */ + boolean setDomainSelectionServiceOverride(in ComponentName componentName); + + /** + * @return {@code true} if the DomainSelectionService override is cleared, + * {@code false} otherwise. + */ + boolean clearDomainSelectionServiceOverride(); + /** * Enable or disable notifications sent for cellular identifier disclosure events. * diff --git a/telephony/java/com/android/internal/telephony/ITransportSelectorCallback.aidl b/telephony/java/com/android/internal/telephony/ITransportSelectorCallback.aidl index 6777256d171e..26daacdeca43 100644 --- a/telephony/java/com/android/internal/telephony/ITransportSelectorCallback.aidl +++ b/telephony/java/com/android/internal/telephony/ITransportSelectorCallback.aidl @@ -20,10 +20,9 @@ import com.android.internal.telephony.IDomainSelector; import com.android.internal.telephony.ITransportSelectorResultCallback; import com.android.internal.telephony.IWwanSelectorCallback; -interface ITransportSelectorCallback { - oneway void onCreated(in IDomainSelector selector); - oneway void onWlanSelected(boolean useEmergencyPdn); - IWwanSelectorCallback onWwanSelected(); - oneway void onWwanSelectedAsync(in ITransportSelectorResultCallback cb); - oneway void onSelectionTerminated(int cause); +oneway interface ITransportSelectorCallback { + void onCreated(in IDomainSelector selector); + void onWlanSelected(boolean useEmergencyPdn); + void onWwanSelectedAsync(in ITransportSelectorResultCallback cb); + void onSelectionTerminated(int cause); } -- GitLab