From 5bd90853a5a700e932b97e1abdedca5ffdf07d82 Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 21 Sep 2018 09:37:07 -0700 Subject: [PATCH] Add support for network identified emergency calls. Add support for the IMS call profile to indicate that a call is an emergency call. Add supporting connection and call properties so that this can be propagated to Telecom and ultimately the Dialer app. Add System API to determine if the device is in a network IDed or dialed emergency call (used in Telephony). Test: Manual test using test intents and ecclist property. Test: Added new telecom unit tests. Bug: 77565333 Change-Id: I769e7b5000b10662c08fe53c91ef99edc685d2b1 --- api/current.txt | 1 + api/system-current.txt | 2 ++ telecomm/java/android/telecom/Call.java | 12 ++++++++++- telecomm/java/android/telecom/Connection.java | 11 ++++++++++ .../java/android/telecom/TelecomManager.java | 21 +++++++++++++++++++ .../internal/telecom/ITelecomService.aidl | 5 +++++ .../android/telephony/ims/ImsCallProfile.java | 4 +++- 7 files changed, 54 insertions(+), 2 deletions(-) diff --git a/api/current.txt b/api/current.txt index 955b13b8c018e..521a5cafa48f2 100755 --- a/api/current.txt +++ b/api/current.txt @@ -40925,6 +40925,7 @@ package android.telecom { field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 128; // 0x80 field public static final int PROPERTY_HIGH_DEF_AUDIO = 16; // 0x10 field public static final int PROPERTY_IS_EXTERNAL_CALL = 64; // 0x40 + field public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 2048; // 0x800 field public static final int PROPERTY_RTT = 1024; // 0x400 field public static final int PROPERTY_SELF_MANAGED = 256; // 0x100 field public static final int PROPERTY_WIFI = 8; // 0x8 diff --git a/api/system-current.txt b/api/system-current.txt index 1df9a466ddc7c..6cae9b82107ce 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -5048,6 +5048,7 @@ package android.telecom { method public deprecated android.content.ComponentName getDefaultPhoneApp(); method public java.util.List getPhoneAccountsForPackage(); method public java.util.List getPhoneAccountsSupportingScheme(java.lang.String); + method public boolean isInEmergencyCall(); method public boolean isRinging(); method public boolean isTtySupported(); field public static final java.lang.String EXTRA_CALL_BACK_INTENT = "android.telecom.extra.CALL_BACK_INTENT"; @@ -5632,6 +5633,7 @@ package android.telephony.ims { field public static final java.lang.String EXTRA_CODEC = "Codec"; field public static final java.lang.String EXTRA_DIALSTRING = "dialstring"; field public static final java.lang.String EXTRA_DISPLAY_TEXT = "DisplayText"; + field public static final java.lang.String EXTRA_E_CALL = "e_call"; field public static final java.lang.String EXTRA_IS_CALL_PULL = "CallPull"; field public static final java.lang.String EXTRA_OI = "oi"; field public static final java.lang.String EXTRA_OIR = "oir"; diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 096cf37d4c65f..26bd4a106ca63 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -434,8 +434,15 @@ public final class Call { */ public static final int PROPERTY_RTT = 0x00000400; + /** + * Indicates that the call has been identified as the network as an emergency call. This + * property may be set for both incoming and outgoing calls which the network identifies as + * emergency calls. + */ + public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 0x00000800; + //****************************************************************************************** - // Next PROPERTY value: 0x00000800 + // Next PROPERTY value: 0x00001000 //****************************************************************************************** private final String mTelecomCallId; @@ -601,6 +608,9 @@ public final class Call { if(hasProperty(properties, PROPERTY_ASSISTED_DIALING_USED)) { builder.append(" PROPERTY_ASSISTED_DIALING_USED"); } + if (hasProperty(properties, PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL)) { + builder.append(" PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL"); + } builder.append("]"); return builder.toString(); } diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 5d5b15d346d38..8bc83c276a3e4 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -411,6 +411,13 @@ public abstract class Connection extends Conferenceable { */ public static final int PROPERTY_ASSISTED_DIALING_USED = 1 << 9; + /** + * Set by the framework to indicate that the network has identified a Connection as an emergency + * call. + * @hide + */ + public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 1 << 10; + //********************************************************************************************** // Next PROPERTY value: 1<<10 //********************************************************************************************** @@ -800,6 +807,10 @@ public abstract class Connection extends Conferenceable { builder.append(isLong ? " PROPERTY_IS_RTT" : " rtt"); } + if (can(properties, PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL)) { + builder.append(isLong ? " PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL" : " ecall"); + } + builder.append("]"); return builder.toString(); } diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 4e2282337ccde..fdb5e64b1d999 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -1875,6 +1875,27 @@ public class TelecomManager { } } + /** + * Determines if there is an ongoing emergency call. This can be either an outgoing emergency + * call, as identified by the dialed number, or because a call was identified by the network + * as an emergency call. + * @return {@code true} if there is an ongoing emergency call, {@code false} otherwise. + * @hide + */ + @SystemApi + @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) + public boolean isInEmergencyCall() { + try { + if (isServiceConnected()) { + return getTelecomService().isInEmergencyCall(); + } + } catch (RemoteException e) { + Log.e(TAG, "RemoteException isInEmergencyCall: " + e); + return false; + } + return false; + } + private ITelecomService getTelecomService() { if (mTelecomServiceOverride != null) { return mTelecomServiceOverride; diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index b4e7d56bc642c..38247bc80e5c1 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -279,4 +279,9 @@ interface ITelecomService { * @see TelecomServiceImpl#acceptHandover */ void acceptHandover(in Uri srcAddr, int videoState, in PhoneAccountHandle destAcct); + + /** + * @see TelecomServiceImpl#isInEmergencyCall + */ + boolean isInEmergencyCall(); } diff --git a/telephony/java/android/telephony/ims/ImsCallProfile.java b/telephony/java/android/telephony/ims/ImsCallProfile.java index f0d3c8956962e..fea982e26a9e6 100644 --- a/telephony/java/android/telephony/ims/ImsCallProfile.java +++ b/telephony/java/android/telephony/ims/ImsCallProfile.java @@ -118,7 +118,9 @@ public final class ImsCallProfile implements Parcelable { */ public static final String EXTRA_CONFERENCE = "conference"; /** - * @hide + * Boolean extra property set on an {@link ImsCallProfile} to indicate that this call is an + * emergency call. The {@link ImsService} sets this on a call to indicate that the network has + * identified the call as an emergency call. */ public static final String EXTRA_E_CALL = "e_call"; /**