IConnectionService.aidl revision ab5d282dd6f487578ae86b2d53d0d8edc9b71747
1bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad/*
2bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * Copyright (C) 2013 The Android Open Source Project
3bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
4bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * Licensed under the Apache License, Version 2.0 (the "License");
5bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * you may not use this file except in compliance with the License.
6bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * You may obtain a copy of the License at
7bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
8bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *      http://www.apache.org/licenses/LICENSE-2.0
9bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
10bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * Unless required by applicable law or agreed to in writing, software
11bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * distributed under the License is distributed on an "AS IS" BASIS,
12bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * See the License for the specific language governing permissions and
14bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * limitations under the License.
15bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad */
16bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
17ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepalpackage com.android.internal.telecomm;
18bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
1974f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charltonimport android.os.Bundle;
20658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordonimport android.telecomm.CallInfo;
21ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal
22ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepalimport com.android.internal.telecomm.ICallServiceAdapter;
23bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
24bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad/**
25bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * Service interface for services which would like to provide calls to be
26bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * managed by the system in-call UI.
27bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
28bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * This interface provides methods that the android framework can use to deliver commands
29bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * for calls provided by this call service including making new calls and disconnecting
30bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * existing ones. A binding to ICallService implementations exists for two conditions:
31bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * 1) There exists one or more live calls for that call service,
32bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call.
33bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
34bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * TODO(santoscordon): Need final public-facing comments in this file.
35ab5d282dd6f487578ae86b2d53d0d8edc9b71747Sailesh Nepal * {@hide}
36bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad */
37bb69b0c2d821a9806fb00037284c399cbc78277dBen Giladoneway interface ICallService {
38bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
39bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    /**
40e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls
41e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     * and communicate state changes of existing calls. This is the first method that is called
42e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     * after a the framework binds to the call service.
433784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
443784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     * @param callServiceAdapter Interface to CallsManager for adding and updating calls.
45e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     */
463784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon    void setCallServiceAdapter(in ICallServiceAdapter callServiceAdapter);
47e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad
48e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad    /**
49658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * Determines if the ICallService can place the specified call. Response is sent via
508986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * {@link ICallServiceAdapter#setCompatibleWith}.  When responding, the correct call ID must be
51658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * specified. It is expected that the call service respond within 500 milliseconds. Any response
52658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * that takes longer than 500 milliseconds will be treated as being incompatible.
538986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * TODO(santoscordon): 500 ms was arbitrarily chosen and must be confirmed before this
543fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * API is made public.  Only used in the context of outgoing calls and call switching (handoff).
553784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
56658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * @param callInfo The details of the relevant call.
57bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     */
58658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon    void isCompatibleWith(in CallInfo callInfo);
59bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
60bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    /**
61658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * Attempts to call the relevant party using the specified call's handle, be it a phone number,
62bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     * SIP address, or some other kind of user ID.  Note that the set of handle types is
63bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     * dynamically extensible since call providers should be able to implement arbitrary
648986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * handle-calling systems.  See {@link #isCompatibleWith}. It is expected that the
65832ddb3fe66a73cdf383ea2700ae48f88ad9ded0Evan Charlton     * call service respond via {@link ICallServiceAdapter#handleSuccessfulOutgoingCall} if it can
663fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * successfully make the call.  Only used in the context of outgoing calls.
67b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * TODO(santoscordon): Figure out how a call service can short-circuit a failure to the adapter.
683784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
69658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * @param callInfo The details of the relevant call.
70bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     */
71658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon    void call(in CallInfo callInfo);
72bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
73bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    /**
743fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * Aborts the outgoing call attempt. Invoked in the unlikely event that Telecomm decides to
753fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * abort an attempt to place a call.  Only ever be invoked after {@link #call} invocations.
763fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * After this is invoked, Telecomm does not expect any more updates about the call and will
773fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * actively ignore any such update. This is different from {@link #disconnect} where Telecomm
78971e9a40a97eee7b6b0aa230034c04d2fb4fef8fBen Gilad     * expects confirmation via ICallServiceAdapter.markCallAsDisconnected.
793784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
803fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * @param callId The identifier of the call to abort.
81bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     */
823fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad    void abort(String callId);
83bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon
84bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon    /**
85b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Receives a new call ID to use with an incoming call. Invoked by Telecomm after it is notified
86b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * that this call service has a pending incoming call, see
87b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * {@link TelecommConstants#ACTION_INCOMING_CALL}. The call service must first give Telecomm
88b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * additional information of the call through {@link ICallServiceAdapter#handleIncomingCall}.
89b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Following that, the call service can update the call at will using the specified call ID.
90bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon     *
9174f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton     * As part of the {@link TelecommConstants#ACTION_INCOMING_CALL} Intent, a  Bundle of extra
9274f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton     * data could be sent via {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}, which is
9374f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton     * returned through this method. If no data was given, an empty Bundle will be returned.
9474f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton     *
95bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon     * @param callId The ID of the call.
9674f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton     * @param extras The Bundle of extra information passed via
9774f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton     *     {@link TelecommConstants#EXTRA_INCOMING_CALL_EXTRAS}.
98bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon     */
9974f6bf88eb0247b25caa8be9d170be6ba4cf5d28Evan Charlton    void setIncomingCallId(String callId, in Bundle extras);
100b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon
101b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    /**
102b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
103b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * user hitting the "answer" button in the incoming call screen.
104b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     *
105b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * @param callId The ID of the call.
106b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     */
107b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    void answer(String callId);
108b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon
109b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    /**
110b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Rejects a ringing call identified by callId. Telecomm invokes this method as a result of the
111b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * user hitting the "reject" button in the incoming call screen.
112b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     *
113b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * @param callId The ID of the call.
114b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     */
115b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    void reject(String callId);
1163fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad
1173fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad    /**
1183fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * Disconnects the call identified by callId.  Used for outgoing and incoming calls.
1193fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     *
1203fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     * @param callId The identifier of the call to disconnect.
1213fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad     */
1223fadaa923272675d841eda3d46b3e1d9dc08c819Ben Gilad    void disconnect(String callId);
123bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad}
124