From 117efc3283997aa89dc819fc36ec3c540f25bd17 Mon Sep 17 00:00:00 2001 From: Thomas Nguyen <tnd@google.com> Date: Thu, 19 Oct 2023 09:31:46 -0700 Subject: [PATCH] Add satellite time configs to overlay config and carrier config Bug: 305030915 Test: SMS, MMS, call with live network. atest SatelliteSOSMessageRecommenderTest TelephonyConnectionServiceTest ImsCallingTest CarrierConfigManagerTest Change-Id: Idc5fdffaabd5c2139b90680f628da7afed943fc4 --- core/api/current.txt | 5 +- core/api/lint-baseline.txt | 12 ----- core/api/system-current.txt | 2 + core/res/res/values/config_telephony.xml | 21 ++++++++ .../telephony/CarrierConfigManager.java | 17 +++++++ .../android/telephony/TelephonyManager.java | 50 +++++++++++++++++-- .../telephony/satellite/SatelliteManager.java | 13 +++++ .../internal/telephony/ITelephony.aidl | 15 ++++++ 8 files changed, 119 insertions(+), 16 deletions(-) diff --git a/core/api/current.txt b/core/api/current.txt index 87f5b3c1cb3b..c087ec383567 100644 --- a/core/api/current.txt +++ b/core/api/current.txt @@ -43192,6 +43192,7 @@ package android.telephony { field public static final String KEY_RTT_UPGRADE_SUPPORTED_BOOL = "rtt_upgrade_supported_bool"; field public static final String KEY_RTT_UPGRADE_SUPPORTED_FOR_DOWNGRADED_VT_CALL_BOOL = "rtt_upgrade_supported_for_downgraded_vt_call"; field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final String KEY_SATELLITE_ATTACH_SUPPORTED_BOOL = "satellite_attach_supported_bool"; + field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final String KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT = "satellite_connection_hysteresis_sec_int"; field public static final String KEY_SHOW_4G_FOR_3G_DATA_ICON_BOOL = "show_4g_for_3g_data_icon_bool"; field public static final String KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL = "show_4g_for_lte_data_icon_bool"; field public static final String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool"; @@ -45461,7 +45462,7 @@ package android.telephony { field public static final int ERI_FLASH = 2; // 0x2 field public static final int ERI_OFF = 1; // 0x1 field public static final int ERI_ON = 0; // 0x0 - field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final String EVENT_DISPLAY_SOS_MESSAGE = "android.telephony.event.DISPLAY_SOS_MESSAGE"; + field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final String EVENT_DISPLAY_EMERGENCY_MESSAGE = "android.telephony.event.DISPLAY_EMERGENCY_MESSAGE"; field public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT = "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT"; field public static final String EXTRA_APN_PROTOCOL = "android.telephony.extra.APN_PROTOCOL"; field public static final String EXTRA_APN_TYPE = "android.telephony.extra.APN_TYPE"; @@ -45470,6 +45471,8 @@ package android.telephony { field public static final String EXTRA_CARRIER_NAME = "android.telephony.extra.CARRIER_NAME"; field public static final String EXTRA_DATA_FAIL_CAUSE = "android.telephony.extra.DATA_FAIL_CAUSE"; field public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "android.telephony.extra.DEFAULT_NETWORK_AVAILABLE"; + field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final String EXTRA_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE = "android.telephony.extra.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE"; + field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final String EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT = "android.telephony.extra.EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT"; field public static final String EXTRA_HIDE_PUBLIC_SETTINGS = "android.telephony.extra.HIDE_PUBLIC_SETTINGS"; field @Deprecated public static final String EXTRA_INCOMING_NUMBER = "incoming_number"; field public static final String EXTRA_IS_REFRESH = "android.telephony.extra.IS_REFRESH"; diff --git a/core/api/lint-baseline.txt b/core/api/lint-baseline.txt index 1e6aa498f417..449249e02768 100644 --- a/core/api/lint-baseline.txt +++ b/core/api/lint-baseline.txt @@ -1497,20 +1497,8 @@ UnflaggedApi: android.provider.Settings#ACTION_CREDENTIAL_PROVIDER: New API must be flagged with @FlaggedApi: field android.provider.Settings.ACTION_CREDENTIAL_PROVIDER UnflaggedApi: android.telecom.Call.Details#getId(): New API must be flagged with @FlaggedApi: method android.telecom.Call.Details.getId() -UnflaggedApi: android.telephony.CarrierConfigManager#KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE: - New API must be flagged with @FlaggedApi: field android.telephony.CarrierConfigManager.KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE -UnflaggedApi: android.telephony.DisconnectCause#SATELLITE_ENABLED: - New API must be flagged with @FlaggedApi: field android.telephony.DisconnectCause.SATELLITE_ENABLED -UnflaggedApi: android.telephony.NetworkRegistrationInfo#SERVICE_TYPE_MMS: - New API must be flagged with @FlaggedApi: field android.telephony.NetworkRegistrationInfo.SERVICE_TYPE_MMS -UnflaggedApi: android.telephony.NetworkRegistrationInfo#isNonTerrestrialNetwork(): - New API must be flagged with @FlaggedApi: method android.telephony.NetworkRegistrationInfo.isNonTerrestrialNetwork() UnflaggedApi: android.telephony.PhoneNumberUtils#isWpsCallNumber(String): New API must be flagged with @FlaggedApi: method android.telephony.PhoneNumberUtils.isWpsCallNumber(String) -UnflaggedApi: android.telephony.ServiceState#isUsingNonTerrestrialNetwork(): - New API must be flagged with @FlaggedApi: method android.telephony.ServiceState.isUsingNonTerrestrialNetwork() -UnflaggedApi: android.telephony.TelephonyManager#EVENT_DISPLAY_SOS_MESSAGE: - New API must be flagged with @FlaggedApi: field android.telephony.TelephonyManager.EVENT_DISPLAY_SOS_MESSAGE UnflaggedApi: android.telephony.TelephonyManager#PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_DISABLED: New API must be flagged with @FlaggedApi: field android.telephony.TelephonyManager.PURCHASE_PREMIUM_CAPABILITY_RESULT_USER_DISABLED UnflaggedApi: android.text.DynamicLayout.Builder#setLineBreakConfig(android.graphics.text.LineBreakConfig): diff --git a/core/api/system-current.txt b/core/api/system-current.txt index 739fdc59ed5d..f546633777ee 100644 --- a/core/api/system-current.txt +++ b/core/api/system-current.txt @@ -16881,6 +16881,8 @@ package android.telephony.satellite { field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int DISPLAY_MODE_FIXED = 1; // 0x1 field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int DISPLAY_MODE_OPENED = 2; // 0x2 field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int DISPLAY_MODE_UNKNOWN = 0; // 0x0 + field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS = 1; // 0x1 + field @FlaggedApi("com.android.internal.telephony.flags.carrier_enabled_satellite_flag") public static final int EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911 = 2; // 0x2 field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_EMTC_NTN = 3; // 0x3 field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_NB_IOT_NTN = 1; // 0x1 field @FlaggedApi("com.android.internal.telephony.flags.oem_enabled_satellite_flag") public static final int NT_RADIO_TECHNOLOGY_NR_NTN = 2; // 0x2 diff --git a/core/res/res/values/config_telephony.xml b/core/res/res/values/config_telephony.xml index 3ba150bcdd44..764279490643 100644 --- a/core/res/res/values/config_telephony.xml +++ b/core/res/res/values/config_telephony.xml @@ -172,6 +172,17 @@ <integer name="config_satellite_nb_iot_inactivity_timeout_millis">180000</integer> <java-symbol type="integer" name="config_satellite_nb_iot_inactivity_timeout_millis" /> + <!-- The timeout duration in milliseconds to determine whether to recommend Dialer to show the + emergency messaging option to users. + + The timer is started when there is an ongoing emergency call, and the IMS is not + registered, and cellular service is not available. When the timer expires, + SatelliteSOSMessageRecommender will send the event EVENT_DISPLAY_EMERGENCY_MESSAGE to + Dialer, which will then prompt user to switch to using satellite emergency messaging. + --> + <integer name="config_emergency_call_wait_for_connection_timeout_millis">20000</integer> + <java-symbol type="integer" name="config_emergency_call_wait_for_connection_timeout_millis" /> + <!-- Telephony config for the PLMNs of all satellite providers. This is used by satellite modem to identify providers that should be ignored if the carrier config carrier_supported_satellite_services_per_provider_bundle does not support them. @@ -184,6 +195,16 @@ <string name="config_satellite_sim_identifier" translatable="false"></string> <java-symbol type="string" name="config_satellite_sim_identifier" /> + <!-- The app to which the emergency call will be handed over for OEM-enabled satellite + messaging. The format of the config string is "package_name;class_name". --> + <string name="config_oem_enabled_satellite_sos_handover_app" translatable="false"></string> + <java-symbol type="string" name="config_oem_enabled_satellite_sos_handover_app" /> + + <!-- The action of the intent that Dialer sends to the app to which the emergency call will be + handed over for emergency messaging via satellite. --> + <string name="config_satellite_emergency_handover_intent_action" translatable="false"></string> + <java-symbol type="string" name="config_satellite_emergency_handover_intent_action" /> + <!-- Whether enhanced IWLAN handover check is enabled. If enabled, telephony frameworks will not perform handover if the target transport is out of service, or VoPS not supported. The network will be torn down on the source transport, and will be diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index 4250bd14da52..baeff06a5836 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -9470,6 +9470,22 @@ public class CarrierConfigManager { public static final String KEY_SATELLITE_ATTACH_SUPPORTED_BOOL = "satellite_attach_supported_bool"; + /** + * The carrier-enabled satellite connection hysteresis time in seconds to determine whether to + * recommend Dialer to prompt users to use satellite emergency messaging. + * <p> + * A timer is started when there is an ongoing emergency call, and the IMS is not registered, + * and cellular service is not available, and the device was connected to a satellite network + * within this time in the past. When the timer expires, Telephony will send the event + * {@link TelephonyManager#EVENT_DISPLAY_EMERGENCY_MESSAGE} to Dialer, which will then prompt + * users to switch to using satellite emergency messaging. + * <p> + * The default value is 300 seconds. + */ + @FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) + public static final String KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT = + "satellite_connection_hysteresis_sec_int"; + /** * Indicating whether DUN APN should be disabled when the device is roaming. In that case, * the default APN (i.e. internet) will be used for tethering. @@ -10500,6 +10516,7 @@ public class CarrierConfigManager { KEY_CARRIER_SUPPORTED_SATELLITE_SERVICES_PER_PROVIDER_BUNDLE, PersistableBundle.EMPTY); sDefaults.putBoolean(KEY_SATELLITE_ATTACH_SUPPORTED_BOOL, false); + sDefaults.putInt(KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT, 300); sDefaults.putBoolean(KEY_DISABLE_DUN_APN_WHILE_ROAMING_WITH_PRESET_APN_BOOL, false); sDefaults.putString(KEY_DEFAULT_PREFERRED_APN_NAME_STRING, ""); sDefaults.putBoolean(KEY_SUPPORTS_CALL_COMPOSER_BOOL, false); diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index e9ea5a7c2ce2..1c5761dcebe0 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -1192,14 +1192,58 @@ public class TelephonyManager { /** * Event reported from the Telephony stack to indicate that the {@link Connection} is not * able to find any network and likely will not get connected. Upon receiving this event, - * the dialer app should show satellite SOS button if satellite is provisioned. + * the dialer app should start the app included in the extras bundle of this event if satellite + * is provisioned. * <p> * The dialer app receives this event via * {@link Call.Callback#onConnectionEvent(Call, String, Bundle)}. + * <p> + * The {@link Bundle} parameter is expected to include the following extras: + * <ul> + * <li>{@link #EXTRA_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE} - the recommending handover + * type.</li> + * <li>{@link #EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT} - the {@link PendingIntent} + * which will be launched by the Dialer app when receiving this connection event.</li> + * </ul> + * <p> + * If the device is connected to satellite via carrier within the hysteresis time defined by + * the carrier config + * {@link CarrierConfigManager#KEY_SATELLITE_CONNECTION_HYSTERESIS_SEC_INT}, the component of + * the {@link #EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT} will be set to the default SMS + * app. + * <p> + * Otherwise, if the overlay config {@code config_oem_enabled_satellite_handover_app} is + * present, the app defined by this config will be used as the component of the + * {@link #EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT}. If this overlay config is empty, + * {@link #EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT} will not be included in the event + * {@link #EVENT_DISPLAY_EMERGENCY_MESSAGE}. + */ + @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) + public static final String EVENT_DISPLAY_EMERGENCY_MESSAGE = + "android.telephony.event.DISPLAY_EMERGENCY_MESSAGE"; + + /** + * Integer extra key used with {@link #EVENT_DISPLAY_EMERGENCY_MESSAGE} which indicates + * the type of handover from emergency call to satellite messaging. + * <p> + * Will be either + * android.telephony.satellite.SatelliteManager#EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS + * or + * android.telephony.satellite.SatelliteManager#EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911 + * <p> + * Set in the extras for the {@link #EVENT_DISPLAY_EMERGENCY_MESSAGE} connection event. + */ + @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) + public static final String EXTRA_EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE = + "android.telephony.extra.EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE"; + + /** + * Extra key used with the {@link #EVENT_DISPLAY_EMERGENCY_MESSAGE} for a {@link PendingIntent} + * which will be launched by the Dialer app. */ @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) - public static final String EVENT_DISPLAY_SOS_MESSAGE = - "android.telephony.event.DISPLAY_SOS_MESSAGE"; + public static final String EXTRA_EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT = + "android.telephony.extra.EMERGENCY_CALL_TO_SATELLITE_LAUNCH_INTENT"; /** * Integer extra key used with {@link #EVENT_SUPPLEMENTARY_SERVICE_NOTIFICATION} which indicates diff --git a/telephony/java/android/telephony/satellite/SatelliteManager.java b/telephony/java/android/telephony/satellite/SatelliteManager.java index 21d93bd3077f..f18cbeafe752 100644 --- a/telephony/java/android/telephony/satellite/SatelliteManager.java +++ b/telephony/java/android/telephony/satellite/SatelliteManager.java @@ -444,6 +444,19 @@ public final class SatelliteManager { @Retention(RetentionPolicy.SOURCE) public @interface DisplayMode {} + /** + * The emergency call is handed over to oem-enabled satellite SOS messaging. SOS messages are + * sent to SOS providers, which will then forward the messages to emergency providers. + */ + @FlaggedApi(Flags.FLAG_OEM_ENABLED_SATELLITE_FLAG) + public static final int EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS = 1; + /** + * The emergency call is handed over to carrier-enabled satellite T911 messaging. T911 messages + * are sent directly to local emergency providers. + */ + @FlaggedApi(Flags.FLAG_CARRIER_ENABLED_SATELLITE_FLAG) + public static final int EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911 = 2; + /** * Request to enable or disable the satellite modem and demo mode. * If satellite modem and cellular modem cannot work concurrently, diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 58e702688bd3..c212e3575276 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -3028,6 +3028,21 @@ interface ITelephony { */ boolean setSatelliteDeviceAlignedTimeoutDuration(long timeoutMillis); + /** + * This API can be used in only testing to override connectivity status in monitoring emergency + * calls and sending EVENT_DISPLAY_EMERGENCY_MESSAGE to Dialer. + * + * @param handoverType The type of handover from emergency call to satellite messaging. Use one + * of the following values to enable the override: + * 0 - EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_SOS + * 1 - EMERGENCY_CALL_TO_SATELLITE_HANDOVER_TYPE_T911 + * To disable the override, use -1 for handoverType. + * @param delaySeconds The event EVENT_DISPLAY_EMERGENCY_MESSAGE will be sent to Dialer + * delaySeconds after the emergency call starts. + * @return {@code true} if the handover type is set successfully, {@code false} otherwise. + */ + boolean setEmergencyCallToSatelliteHandoverType(int handoverType, int delaySeconds); + /** * Test method to confirm the file contents are not altered. */ -- GitLab