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

Commit 29738688 authored by Yorke Lee's avatar Yorke Lee Committed by Android (Google) Code Review
Browse files

Merge "Add TelecomManager.placeCall"

parents 9e29086d 3e56ba14
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -30609,6 +30609,7 @@ package android.telecom {
    method public boolean handleMmi(java.lang.String, android.telecom.PhoneAccountHandle);
    method public boolean isInCall();
    method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String);
    method public void placeCall(android.net.Uri, android.os.Bundle);
    method public void registerPhoneAccount(android.telecom.PhoneAccount);
    method public void showInCallScreen(boolean);
    method public void silenceRinger();
+1 −0
Original line number Diff line number Diff line
@@ -32758,6 +32758,7 @@ package android.telecom {
    method public boolean isRinging();
    method public boolean isTtySupported();
    method public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, java.lang.String);
    method public void placeCall(android.net.Uri, android.os.Bundle);
    method public void registerPhoneAccount(android.telecom.PhoneAccount);
    method public void showInCallScreen(boolean);
    method public void silenceRinger();
+34 −0
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@ package android.telecom;
import android.annotation.SystemApi;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.RemoteException;
@@ -1057,6 +1058,39 @@ public class TelecomManager {
        }
    }

    /**
     * Places a new outgoing call to the provided address using the system telecom service with
     * the specified extras.
     *
     * This method is equivalent to placing an outgoing call using {@link Intent#ACTION_CALL},
     * except that the outgoing call will always be sent via the system telecom service. If
     * method-caller is either the user selected default dialer app or preloaded system dialer
     * app, then emergency calls will also be allowed.
     *
     * Requires permission: {@link android.Manifest.permission#CALL_PHONE}
     *
     * Usage example:
     * <pre>
     * Uri uri = Uri.fromParts("tel", "12345", null);
     * Bundle extras = new Bundle();
     * extras.putBoolean(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, true);
     * telecomManager.placeCall(uri, extras);
     * </pre>
     *
     * @param address The address to make the call to.
     * @param extras Bundle of extras to use with the call.
     */
    public void placeCall(Uri address, Bundle extras) {
        ITelecomService service = getTelecomService();
        if (service != null) {
            try {
                service.placeCall(address, extras, mContext.getOpPackageName());
            } catch (RemoteException e) {
                Log.e(TAG, "Error calling ITelecomService#placeCall", e);
            }
        }
    }

    private ITelecomService getTelecomService() {
        return ITelecomService.Stub.asInterface(ServiceManager.getService(Context.TELECOM_SERVICE));
    }
+5 −0
Original line number Diff line number Diff line
@@ -210,4 +210,9 @@ interface ITelecomService {
     * @see TelecomServiceImpl#addNewUnknownCall
     */
    void addNewUnknownCall(in PhoneAccountHandle phoneAccount, in Bundle extras);

    /**
     * @see TelecomServiceImpl#placeCall
     */
    void placeCall(in Uri handle, in Bundle extras, String callingPackage);
}