Merge "Introduce telecom api to launch emeregency dialer."
am: c55310438b
Change-Id: I2b4d4d6b160afab0e97600b057367b2b889a795a
diff --git a/api/system-current.txt b/api/system-current.txt
index 77cf0a7..01cab53 100755
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -1573,6 +1573,7 @@
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";
@@ -7839,6 +7840,7 @@
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<android.telecom.PhoneAccountHandle> getAllPhoneAccountHandles();
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index e9a4762..a6867ff 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -1134,6 +1134,18 @@
@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.
+ * <p>Input: If nothing, an empty emergency dialer is started; else {@link #getData}
+ * is a tel: URI of an explicit emergency phone number.
+ * <p>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.
* <p>Input: {@link #getData} is URI of a phone number to be dialed or a
diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml
index b516c41..a404e2e 100644
--- a/core/res/res/values/config.xml
+++ b/core/res/res/values/config.xml
@@ -3538,6 +3538,9 @@
<!-- emergency call number for the emergency affordance -->
<string name="config_emergency_call_number" translatable="false">112</string>
+ <!-- Package name that provides Emergency Dialer -->
+ <string name="config_emergency_dialer_package">com.android.phone</string>
+
<!-- Do not translate. Mcc codes whose existence trigger the presence of emergency
affordances-->
<integer-array name="config_emergency_mcc_codes" translatable="false">
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 5cd5c8c..2507787 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -3153,6 +3153,7 @@
<java-symbol type="string" name="global_action_emergency" />
<java-symbol type="string" name="config_emergency_call_number" />
+ <java-symbol type="string" name="config_emergency_dialer_package" />
<java-symbol type="array" name="config_emergency_mcc_codes" />
<java-symbol type="string" name="config_dozeDoubleTapSensorType" />
diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java
index 8f62bcb..af3c55a 100644
--- a/telecomm/java/android/telecom/TelecomManager.java
+++ b/telecomm/java/android/telecom/TelecomManager.java
@@ -2056,6 +2056,29 @@
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 cedc4b9..204c37e 100644
--- a/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
+++ b/telecomm/java/com/android/internal/telecom/ITelecomService.aidl
@@ -266,6 +266,11 @@
**/
Intent createManageBlockedNumbersIntent();
+ /**
+ * @see TelecomServiceImpl#createLaunchEmergencyDialerIntent
+ */
+ Intent createLaunchEmergencyDialerIntent(in String number);
+
/**
* @see TelecomServiceImpl#isIncomingCallPermitted
*/