Merge "Introduce telecom api to launch emeregency dialer."

This commit is contained in:
Fan Zhang
2019-12-19 22:07:42 +00:00
committed by Gerrit Code Review
6 changed files with 46 additions and 0 deletions

View File

@@ -1573,6 +1573,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";
@@ -7839,6 +7840,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<android.telecom.PhoneAccountHandle> getAllPhoneAccountHandles();

View File

@@ -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.
* <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.

View File

@@ -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">

View File

@@ -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" />

View File

@@ -2056,6 +2056,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

View File

@@ -266,6 +266,11 @@ interface ITelecomService {
**/
Intent createManageBlockedNumbersIntent();
/**
* @see TelecomServiceImpl#createLaunchEmergencyDialerIntent
*/
Intent createLaunchEmergencyDialerIntent(in String number);
/**
* @see TelecomServiceImpl#isIncomingCallPermitted
*/