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

Commit 7118220c authored by Nancy Chen's avatar Nancy Chen Committed by Android (Google) Code Review
Browse files

Merge "Replace get*PhoneAccounts* public API methods with new method (1/3)" into lmp-dev

parents bf5dbf1c 513c8921
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -28355,11 +28355,9 @@ package android.telecom {
    method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
    method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
    method public void cancelMissedCallsNotification();
    method public void cancelMissedCallsNotification();
    method public void clearAccounts();
    method public void clearAccounts();
    method public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts();
    method public android.telecom.PhoneAccountHandle getConnectionManager();
    method public android.telecom.PhoneAccountHandle getConnectionManager();
    method public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(java.lang.String);
    method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
    method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
    method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsSupportingScheme(java.lang.String);
    method public java.util.List<android.telecom.PhoneAccountHandle> getPhoneAccountsForPackage();
    method public boolean handleMmi(java.lang.String);
    method public boolean handleMmi(java.lang.String);
    method public boolean hasMultipleCallCapableAccounts();
    method public boolean hasMultipleCallCapableAccounts();
    method public boolean isInCall();
    method public boolean isInCall();
+9 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,15 @@ public final class Call {
     */
     */
    public static final int STATE_CONNECTING = 9;
    public static final int STATE_CONNECTING = 9;


    /**
     * The key to retrieve the optional {@code PhoneAccount}s Telecom can bundle with its Call
     * extras. Used to pass the phone accounts to display on the front end to the user in order to
     * select phone accounts to (for example) place a call.
     *
     * @hide
     */
    public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";

    public static class Details {
    public static class Details {
        private final Uri mHandle;
        private final Uri mHandle;
        private final int mHandlePresentation;
        private final int mHandlePresentation;
+45 −30
Original line number Original line Diff line number Diff line
@@ -306,22 +306,16 @@ public class TelecomManager {


    /**
    /**
     * Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone
     * Return the {@link PhoneAccount} which is the user-chosen default for making outgoing phone
     * calls with a specified URI scheme. This {@code PhoneAccount} will always be a member of the
     * calls with a specified URI scheme.
     * list which is returned from calling {@link #getCallCapablePhoneAccounts()}.
     * <p>
     * <p>
     * Apps must be prepared for this method to return {@code null}, indicating that there currently
     * Apps must be prepared for this method to return {@code null}, indicating that there currently
     * exists no user-chosen default {@code PhoneAccount}. In this case, apps wishing to initiate a
     * exists no user-chosen default {@code PhoneAccount}.
     * phone call must either create their {@link android.content.Intent#ACTION_CALL} or
     * {@link android.content.Intent#ACTION_DIAL} {@code Intent} with no
     * {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE}, or present the user with an affordance to
     * select one of the elements of {@link #getCallCapablePhoneAccounts()}.
     * <p>
     * <p>
     * An {@link android.content.Intent#ACTION_CALL} or {@link android.content.Intent#ACTION_DIAL}
     * {@code Intent} with no {@link TelecomManager#EXTRA_PHONE_ACCOUNT_HANDLE} is valid, and
     * subsequent steps in the phone call flow are responsible for presenting the user with an
     * affordance, if necessary, to choose a {@code PhoneAccount}.
     *
     * @param uriScheme The URI scheme.
     * @param uriScheme The URI scheme.
     * @return The {@link PhoneAccountHandle} corresponding to the user-chosen default for outgoing
     * phone calls for a specified URI scheme.
     *
     * @hide
     */
     */
    public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme) {
    public PhoneAccountHandle getDefaultOutgoingPhoneAccount(String uriScheme) {
        try {
        try {
@@ -370,24 +364,6 @@ public class TelecomManager {
        }
        }
    }
    }


    /**
     * Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
     * calls.
     *
     * @see #EXTRA_PHONE_ACCOUNT_HANDLE
     * @return A list of {@code PhoneAccountHandle} objects.
     */
    public List<PhoneAccountHandle> getCallCapablePhoneAccounts() {
        try {
            if (isServiceConnected()) {
                return getTelecomService().getCallCapablePhoneAccounts();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
        }
        return new ArrayList<>();
    }

    /**
    /**
     * Returns the current SIM call manager. Apps must be prepared for this method to return
     * Returns the current SIM call manager. Apps must be prepared for this method to return
     * {@code null}, indicating that there currently exists no user-chosen default
     * {@code null}, indicating that there currently exists no user-chosen default
@@ -459,6 +435,8 @@ public class TelecomManager {
     *
     *
     * @param uriScheme The URI scheme.
     * @param uriScheme The URI scheme.
     * @return A list of {@code PhoneAccountHandle} objects supporting the URI scheme.
     * @return A list of {@code PhoneAccountHandle} objects supporting the URI scheme.
     *
     * @hide
     */
     */
    public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) {
    public List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(String uriScheme) {
        try {
        try {
@@ -471,6 +449,27 @@ public class TelecomManager {
        return new ArrayList<>();
        return new ArrayList<>();
    }
    }



    /**
     * Return a list of {@link PhoneAccountHandle}s which can be used to make and receive phone
     * calls.
     *
     * @see #EXTRA_PHONE_ACCOUNT_HANDLE
     * @return A list of {@code PhoneAccountHandle} objects.
     *
     * @hide
     */
    public List<PhoneAccountHandle> getCallCapablePhoneAccounts() {
        try {
            if (isServiceConnected()) {
                return getTelecomService().getCallCapablePhoneAccounts();
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getCallCapablePhoneAccounts", e);
        }
        return new ArrayList<>();
    }

    /**
    /**
     * Determine whether the device has more than one account registered that can make and receive
     * Determine whether the device has more than one account registered that can make and receive
     * phone calls.
     * phone calls.
@@ -482,6 +481,22 @@ public class TelecomManager {
        return getCallCapablePhoneAccounts().size() > 1;
        return getCallCapablePhoneAccounts().size() > 1;
    }
    }


    /**
     *  Returns a list of all {@link PhoneAccount}s registered for the calling package.
     *
     * @return A list of {@code PhoneAccountHandle} objects.
     */
    public List<PhoneAccountHandle> getPhoneAccountsForPackage() {
        try {
            if (isServiceConnected()) {
                return getTelecomService().getPhoneAccountsForPackage(mContext.getPackageName());
            }
        } catch (RemoteException e) {
            Log.e(TAG, "Error calling ITelecomService#getPhoneAccountsForPackage", e);
        }
        return null;
    }

    /**
    /**
     * Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes
     * Return the {@link PhoneAccount} for a specified {@link PhoneAccountHandle}. Object includes
     * resources which can be used in a user interface.
     * resources which can be used in a user interface.
+5 −0
Original line number Original line Diff line number Diff line
@@ -59,6 +59,11 @@ interface ITelecomService {
     */
     */
    List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme);
    List<PhoneAccountHandle> getPhoneAccountsSupportingScheme(in String uriScheme);


    /**
     * @see TelecomManager#getPhoneAccountsForPackage
     */
    List<PhoneAccountHandle> getPhoneAccountsForPackage(in String packageName);

    /**
    /**
     * @see TelecomManager#getPhoneAccount
     * @see TelecomManager#getPhoneAccount
     */
     */