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

Commit 879d8b33 authored by Ihab Awad's avatar Ihab Awad Committed by Android (Google) Code Review
Browse files

Merge "DO NOT MERGE. Port "respond via SMS message" feature to new Telecomm....

Merge "DO NOT MERGE. Port "respond via SMS message" feature to new Telecomm. (1/4)" into lmp-preview-dev
parents 4a1ca967 d76faab7
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -107,6 +107,13 @@ public abstract class Connection {
    protected Connection() {}
    protected Connection() {}


    /**
    /**
     * The handle (e.g., phone number) to which this Connection is currently communicating.
     *
     * IMPORTANT: If an incoming connection has a phone number (or other handle) that the user
     * is not supposed to be able to see (e.g. it is PRESENTATION_RESTRICTED), then a compliant
     * ConnectionService implementation MUST NOT reveal this phone number and MUST return
     * {@code null} from this method.
     *
     * @return The handle (e.g., phone number) to which this Connection
     * @return The handle (e.g., phone number) to which this Connection
     *         is currently communicating.
     *         is currently communicating.
     */
     */
+5 −0
Original line number Original line Diff line number Diff line
@@ -386,6 +386,11 @@ public abstract class ConnectionService extends CallService {
    /**
    /**
     * Create a Connection to match an incoming connection notification.
     * Create a Connection to match an incoming connection notification.
     *
     *
     * IMPORTANT: If the incoming connection has a phone number (or other handle) that the user
     * is not supposed to be able to see (e.g. it is PRESENTATION_RESTRICTED), then a compliant
     * ConnectionService implementation MUST NOT reveal this phone number as part of the Intent
     * it sends to notify Telecomm of an incoming connection.
     *
     * @param request Data encapsulating details of the desired Connection.
     * @param request Data encapsulating details of the desired Connection.
     * @param callback A callback for providing the result.
     * @param callback A callback for providing the result.
     */
     */
+4 −2
Original line number Original line Diff line number Diff line
@@ -59,10 +59,12 @@ public final class InCallAdapter {
     * is ported over.
     * is ported over.
     *
     *
     * @param callId The identifier of the call to reject.
     * @param callId The identifier of the call to reject.
     * @param rejectWithMessage Whether to reject with a text message.
     * @param textMessage An optional text message with which to respond.
     */
     */
    public void rejectCall(String callId) {
    public void rejectCall(String callId, boolean rejectWithMessage, String textMessage) {
        try {
        try {
            mAdapter.rejectCall(callId);
            mAdapter.rejectCall(callId, rejectWithMessage, textMessage);
        } catch (RemoteException e) {
        } catch (RemoteException e) {
        }
        }
    }
    }
+21 −6
Original line number Original line Diff line number Diff line
@@ -33,6 +33,7 @@ public final class InCallCall implements Parcelable {
    private final CallState mState;
    private final CallState mState;
    private final int mDisconnectCauseCode;
    private final int mDisconnectCauseCode;
    private final String mDisconnectCauseMsg;
    private final String mDisconnectCauseMsg;
    private final List<String> mCannedSmsResponses;
    private final int mCapabilities;
    private final int mCapabilities;
    private final long mConnectTimeMillis;
    private final long mConnectTimeMillis;
    private final Uri mHandle;
    private final Uri mHandle;
@@ -49,14 +50,16 @@ public final class InCallCall implements Parcelable {
            CallState state,
            CallState state,
            int disconnectCauseCode,
            int disconnectCauseCode,
            String disconnectCauseMsg,
            String disconnectCauseMsg,
            List<String> cannedSmsResponses,
            int capabilities,
            int capabilities,
            long connectTimeMillis,
            long connectTimeMillis,
            Uri handle,
            Uri handle,
            GatewayInfo gatewayInfo,
            GatewayInfo gatewayInfo,
            CallServiceDescriptor descriptor,
            CallServiceDescriptor descriptor,
            CallServiceDescriptor handoffDescriptor) {
            CallServiceDescriptor handoffDescriptor) {
        this(id, state, disconnectCauseCode, disconnectCauseMsg, capabilities, connectTimeMillis,
        this(id, state, disconnectCauseCode, disconnectCauseMsg, cannedSmsResponses,
                handle, gatewayInfo, descriptor, handoffDescriptor, null, Collections.EMPTY_LIST);
                capabilities, connectTimeMillis, handle, gatewayInfo, descriptor, handoffDescriptor,
                null, Collections.EMPTY_LIST);
    }
    }


    /** @hide */
    /** @hide */
@@ -65,6 +68,7 @@ public final class InCallCall implements Parcelable {
            CallState state,
            CallState state,
            int disconnectCauseCode,
            int disconnectCauseCode,
            String disconnectCauseMsg,
            String disconnectCauseMsg,
            List<String> cannedSmsResponses,
            int capabilities,
            int capabilities,
            long connectTimeMillis,
            long connectTimeMillis,
            Uri handle,
            Uri handle,
@@ -77,6 +81,7 @@ public final class InCallCall implements Parcelable {
        mState = state;
        mState = state;
        mDisconnectCauseCode = disconnectCauseCode;
        mDisconnectCauseCode = disconnectCauseCode;
        mDisconnectCauseMsg = disconnectCauseMsg;
        mDisconnectCauseMsg = disconnectCauseMsg;
        mCannedSmsResponses = cannedSmsResponses;
        mCapabilities = capabilities;
        mCapabilities = capabilities;
        mConnectTimeMillis = connectTimeMillis;
        mConnectTimeMillis = connectTimeMillis;
        mHandle = handle;
        mHandle = handle;
@@ -113,6 +118,13 @@ public final class InCallCall implements Parcelable {
        return mDisconnectCauseMsg;
        return mDisconnectCauseMsg;
    }
    }


    /**
     * The set of possible text message responses when this call is incoming.
     */
    public List<String> getCannedSmsResponses() {
        return mCannedSmsResponses;
    }

    // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
    // Bit mask of actions a call supports, values are defined in {@link CallCapabilities}.
    public int getCapabilities() {
    public int getCapabilities() {
        return mCapabilities;
        return mCapabilities;
@@ -168,13 +180,15 @@ public final class InCallCall implements Parcelable {
            new Parcelable.Creator<InCallCall> () {
            new Parcelable.Creator<InCallCall> () {
        @Override
        @Override
        public InCallCall createFromParcel(Parcel source) {
        public InCallCall createFromParcel(Parcel source) {
            ClassLoader classLoader = InCallCall.class.getClassLoader();
            String id = source.readString();
            String id = source.readString();
            CallState state = CallState.valueOf(source.readString());
            CallState state = CallState.valueOf(source.readString());
            int disconnectCauseCode = source.readInt();
            int disconnectCauseCode = source.readInt();
            String disconnectCauseMsg = source.readString();
            String disconnectCauseMsg = source.readString();
            List<String> cannedSmsResponses = new ArrayList<>();
            source.readList(cannedSmsResponses, classLoader);
            int capabilities = source.readInt();
            int capabilities = source.readInt();
            long connectTimeMillis = source.readLong();
            long connectTimeMillis = source.readLong();
            ClassLoader classLoader = InCallCall.class.getClassLoader();
            Uri handle = source.readParcelable(classLoader);
            Uri handle = source.readParcelable(classLoader);
            GatewayInfo gatewayInfo = source.readParcelable(classLoader);
            GatewayInfo gatewayInfo = source.readParcelable(classLoader);
            CallServiceDescriptor descriptor = source.readParcelable(classLoader);
            CallServiceDescriptor descriptor = source.readParcelable(classLoader);
@@ -182,9 +196,9 @@ public final class InCallCall implements Parcelable {
            String parentCallId = source.readString();
            String parentCallId = source.readString();
            List<String> childCallIds = new ArrayList<>();
            List<String> childCallIds = new ArrayList<>();
            source.readList(childCallIds, classLoader);
            source.readList(childCallIds, classLoader);
            return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg, capabilities,
            return new InCallCall(id, state, disconnectCauseCode, disconnectCauseMsg,
                    connectTimeMillis, handle, gatewayInfo, descriptor, handoffDescriptor,
                    cannedSmsResponses, capabilities, connectTimeMillis, handle, gatewayInfo,
                    parentCallId, childCallIds);
                    descriptor, handoffDescriptor, parentCallId, childCallIds);
        }
        }


        @Override
        @Override
@@ -206,6 +220,7 @@ public final class InCallCall implements Parcelable {
        destination.writeString(mState.name());
        destination.writeString(mState.name());
        destination.writeInt(mDisconnectCauseCode);
        destination.writeInt(mDisconnectCauseCode);
        destination.writeString(mDisconnectCauseMsg);
        destination.writeString(mDisconnectCauseMsg);
        destination.writeList(mCannedSmsResponses);
        destination.writeInt(mCapabilities);
        destination.writeInt(mCapabilities);
        destination.writeLong(mConnectTimeMillis);
        destination.writeLong(mConnectTimeMillis);
        destination.writeParcelable(mHandle, 0);
        destination.writeParcelable(mHandle, 0);
+1 −1
Original line number Original line Diff line number Diff line
@@ -28,7 +28,7 @@ import android.telecomm.CallAudioState;
oneway interface IInCallAdapter {
oneway interface IInCallAdapter {
    void answerCall(String callId);
    void answerCall(String callId);


    void rejectCall(String callId);
    void rejectCall(String callId, boolean rejectWithMessage, String textMessage);


    void disconnectCall(String callId);
    void disconnectCall(String callId);