From 2b2458e094ea84ca2f1be66ef44c1c24fa364204 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Mon, 14 Oct 2019 13:43:46 -0700 Subject: [PATCH] Introduce telecom api to launch emeregency dialer. Test: manual Bug: 136194151 Change-Id: I5c9732062e5123539343843fb9a9ae3ca7111890 Merged-In: I5c9732062e5123539343843fb9a9ae3ca7111890 --- api/system-current.txt | 2 ++ core/java/android/content/Intent.java | 12 ++++++++++ core/res/res/values/config.xml | 3 +++ core/res/res/values/symbols.xml | 1 + .../java/android/telecom/TelecomManager.java | 23 +++++++++++++++++++ .../internal/telecom/ITelecomService.aidl | 5 ++++ 6 files changed, 46 insertions(+) diff --git a/api/system-current.txt b/api/system-current.txt index a41564e37cc31..bfbc7061215fb 100755 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -1559,6 +1559,7 @@ package android.content { field public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY"; field public static final String ACTION_CALL_PRIVILEGED = "android.intent.action.CALL_PRIVILEGED"; field public static final String ACTION_DEVICE_CUSTOMIZATION_READY = "android.intent.action.DEVICE_CUSTOMIZATION_READY"; + field public static final String ACTION_DIAL_EMERGENCY = "android.intent.action.DIAL_EMERGENCY"; field public static final String ACTION_FACTORY_RESET = "android.intent.action.FACTORY_RESET"; field public static final String ACTION_GLOBAL_BUTTON = "android.intent.action.GLOBAL_BUTTON"; field public static final String ACTION_INCIDENT_REPORT_READY = "android.intent.action.INCIDENT_REPORT_READY"; @@ -7808,6 +7809,7 @@ package android.telecom { method public void addNewUnknownCall(android.telecom.PhoneAccountHandle, android.os.Bundle); method @Deprecated public void clearAccounts(); method public void clearPhoneAccounts(); + method @NonNull public android.content.Intent createLaunchEmergencyDialerIntent(@Nullable String); method @RequiresPermission(android.Manifest.permission.DUMP) public android.telecom.TelecomAnalytics dumpAnalytics(); method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void enablePhoneAccount(android.telecom.PhoneAccountHandle, boolean); method public java.util.List getAllPhoneAccountHandles(); diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java index e9a476211f1e6..a6867ff209e48 100644 --- a/core/java/android/content/Intent.java +++ b/core/java/android/content/Intent.java @@ -1133,6 +1133,18 @@ public class Intent implements Parcelable, Cloneable { @SystemApi @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) public static final String ACTION_CALL_EMERGENCY = "android.intent.action.CALL_EMERGENCY"; + /** + * Activity Action: Dial a emergency number specified by the data. This shows a + * UI with the number being dialed, allowing the user to explicitly + * initiate the call. + *

Input: If nothing, an empty emergency dialer is started; else {@link #getData} + * is a tel: URI of an explicit emergency phone number. + *

Output: nothing. + * @hide + */ + @SystemApi + @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION) + public static final String ACTION_DIAL_EMERGENCY = "android.intent.action.DIAL_EMERGENCY"; /** * Activity action: Perform a call to any number (emergency or not) * specified by the data. diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 4b5840e691037..0cec16cb57535 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -3542,6 +3542,9 @@ 112 + + com.android.phone + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 04b86a8fee0f5..26bebb94a34ce 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3154,6 +3154,7 @@ + diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 20862c525b553..39d741c3d3bfa 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -1959,6 +1959,29 @@ public class TelecomManager { return result; } + + /** + * Creates the {@link Intent} which can be used with {@link Context#startActivity(Intent)} to + * launch the activity for emergency dialer. + * + * @param number Optional number to call in emergency dialer + * @hide + */ + @SystemApi + @NonNull + public Intent createLaunchEmergencyDialerIntent(@Nullable String number) { + ITelecomService service = getTelecomService(); + Intent result = null; + if (service != null) { + try { + result = service.createLaunchEmergencyDialerIntent(number); + } catch (RemoteException e) { + Log.e(TAG, "Error createLaunchEmergencyDialerIntent", e); + } + } + return result; + } + /** * Determines whether Telecom would permit an incoming call to be added via the * {@link #addNewIncomingCall(PhoneAccountHandle, Bundle)} API for the specified diff --git a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl index cedc4b9c036f1..204c37e9aa38b 100644 --- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl +++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl @@ -266,6 +266,11 @@ interface ITelecomService { **/ Intent createManageBlockedNumbersIntent(); + /** + * @see TelecomServiceImpl#createLaunchEmergencyDialerIntent + */ + Intent createLaunchEmergencyDialerIntent(in String number); + /** * @see TelecomServiceImpl#isIncomingCallPermitted */