Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e93d730 authored by Brad Ebinger's avatar Brad Ebinger
Browse files

Add CAPABILITY_EMERGENCY_PREFERRED in PhoneAccount

Allow Telephony to mark a SIM PhoneAccount as
emergency preferred, meaning that Telecom will
override a user's PhoneAccount preference for
emergency calls if the PhoneAccount has the
CAPABILITY_EMERGENCY_PREFERRED capability.

Bug: 131203278
Test: Manual testing, Telecom/Telephony unit testing
Merged-In: If70d917cfb3d825f375d282012b8788d69a2f144
Change-Id: I88b8bbfa444f5445b2f0d6a1542c6406a19b240f
parent f0d921c4
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -52,6 +52,8 @@ import android.provider.DocumentsContract;
import android.provider.DocumentsProvider;
import android.provider.MediaStore;
import android.provider.OpenableColumns;
import android.telecom.PhoneAccount;
import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.util.ArraySet;
import android.util.AttributeSet;
@@ -1108,6 +1110,12 @@ public class Intent implements Parcelable, Cloneable {
     * <p>Input: {@link #getData} is URI of a phone number to be dialed or a
     * tel: URI of an explicit phone number.
     * <p>Output: nothing.
     *
     * <p class="note"><strong>Note:</strong> It is not guaranteed that the call will be placed on
     * the {@link PhoneAccount} provided in the {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE}
     * extra (if specified) and may be placed on another {@link PhoneAccount} with the
     * {@link PhoneAccount#CAPABILITY_PLACE_EMERGENCY_CALLS} capability, depending on external
     * factors, such as network conditions and Modem/SIM status.
     * @hide
     */
    @SystemApi
+20 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package android.telecom;

import android.annotation.SystemApi;
import android.content.Intent;
import android.graphics.drawable.Icon;
import android.net.Uri;
import android.os.Bundle;
@@ -24,7 +25,6 @@ import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;

import java.lang.String;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
@@ -314,7 +314,22 @@ public final class PhoneAccount implements Parcelable {
     */
    public static final int CAPABILITY_RTT = 0x1000;

    /* NEXT CAPABILITY: 0x2000 */
    /**
     * Flag indicating that this {@link PhoneAccount} is the preferred SIM subscription for
     * emergency calls. A {@link PhoneAccount} that sets this capabilitiy must also
     * set the {@link #CAPABILITY_SIM_SUBSCRIPTION} and {@link #CAPABILITY_PLACE_EMERGENCY_CALLS}
     * capabilities. There should only be one emergency preferred {@link PhoneAccount}.
     * <p>
     * When set, Telecom will prefer this {@link PhoneAccount} over others for emergency calling,
     * even if the emergency call was placed with a specific {@link PhoneAccount} set using the
     * extra{@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} in
     * {@link Intent#ACTION_CALL_EMERGENCY} or {@link TelecomManager#placeCall(Uri, Bundle)}.
     *
     * @hide
     */
    public static final int CAPABILITY_EMERGENCY_PREFERRED = 0x2000;

    /* NEXT CAPABILITY: 0x4000 */

    /**
     * URI scheme for telephone number URIs.
@@ -1020,6 +1035,9 @@ public final class PhoneAccount implements Parcelable {
        if (hasCapabilities(CAPABILITY_PLACE_EMERGENCY_CALLS)) {
            sb.append("PlaceEmerg ");
        }
        if (hasCapabilities(CAPABILITY_EMERGENCY_PREFERRED)) {
            sb.append("EmerPrefer ");
        }
        if (hasCapabilities(CAPABILITY_EMERGENCY_VIDEO_CALLING)) {
            sb.append("EmergVideo ");
        }
+7 −0
Original line number Diff line number Diff line
@@ -1800,6 +1800,13 @@ public class TelecomManager {
     * Self-managed {@link ConnectionService}s require permission
     * {@link android.Manifest.permission#MANAGE_OWN_CALLS}.
     *
     * <p class="note"><strong>Note:</strong> If this method is used to place an emergency call, it
     * is not guaranteed that the call will be placed on the {@link PhoneAccount} provided in
     * the {@link #EXTRA_PHONE_ACCOUNT_HANDLE} extra (if specified) and may be placed on another
     * {@link PhoneAccount} with the {@link PhoneAccount#CAPABILITY_PLACE_EMERGENCY_CALLS}
     * capability, depending on external factors, such as network conditions and Modem/SIM status.
     * </p>
     *
     * @param address The address to make the call to.
     * @param extras Bundle of extras to use with the call.
     */