IConnectionService.aidl revision b340c331bca330e9cb60ce6e398b3c014e1a14c7
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
17bb69b0c2d821a9806fb00037284c399cbc78277dBen Giladpackage android.telecomm;
18bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
19658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordonimport android.telecomm.CallInfo;
20bb69b0c2d821a9806fb00037284c399cbc78277dBen Giladimport android.telecomm.ICallServiceAdapter;
21bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
22bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad/**
23bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * Service interface for services which would like to provide calls to be
24bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * managed by the system in-call UI.
25bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
26bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * This interface provides methods that the android framework can use to deliver commands
27bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * for calls provided by this call service including making new calls and disconnecting
28bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * existing ones. A binding to ICallService implementations exists for two conditions:
29bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * 1) There exists one or more live calls for that call service,
30bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * 2) Prior to an outbound call to test if this call service is compatible with the outgoing call.
31bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad *
32bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad * TODO(santoscordon): Need final public-facing comments in this file.
33bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad */
34bb69b0c2d821a9806fb00037284c399cbc78277dBen Giladoneway interface ICallService {
35bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
36bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    /**
37e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     * Sets an implementation of ICallServiceAdapter which the call service can use to add new calls
38e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     * and communicate state changes of existing calls. This is the first method that is called
39e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     * after a the framework binds to the call service.
403784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
413784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     * @param callServiceAdapter Interface to CallsManager for adding and updating calls.
42e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad     */
433784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon    void setCallServiceAdapter(in ICallServiceAdapter callServiceAdapter);
44e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad
45e57944dd55f72aa1b9fc04c6b6bc48992076fdf6Ben Gilad    /**
46658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * Determines if the ICallService can place the specified call. Response is sent via
478986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * {@link ICallServiceAdapter#setCompatibleWith}.  When responding, the correct call ID must be
48658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * specified. It is expected that the call service respond within 500 milliseconds. Any response
49658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * that takes longer than 500 milliseconds will be treated as being incompatible.
508986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * TODO(santoscordon): 500 ms was arbitrarily chosen and must be confirmed before this
518986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * API is made public.
523784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
53658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * @param callInfo The details of the relevant call.
54bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     */
55658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon    void isCompatibleWith(in CallInfo callInfo);
56bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
57bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    /**
58658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * Attempts to call the relevant party using the specified call's handle, be it a phone number,
59bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     * SIP address, or some other kind of user ID.  Note that the set of handle types is
60bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     * dynamically extensible since call providers should be able to implement arbitrary
618986ef460188805a1af21ee5d8cd49a57d725d5eSantos Cordon     * handle-calling systems.  See {@link #isCompatibleWith}. It is expected that the
62832ddb3fe66a73cdf383ea2700ae48f88ad9ded0Evan Charlton     * call service respond via {@link ICallServiceAdapter#handleSuccessfulOutgoingCall} if it can
63832ddb3fe66a73cdf383ea2700ae48f88ad9ded0Evan Charlton     * successfully make the call.
64b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * TODO(santoscordon): Figure out how a call service can short-circuit a failure to the adapter.
653784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
66658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon     * @param callInfo The details of the relevant call.
67bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     */
68658c0cf6c3140b5cafc4e8880e08a7dead39d24aSantos Cordon    void call(in CallInfo callInfo);
69bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad
70bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    /**
71bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     * Disconnects the call identified by callId.
723784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     *
733784133b95f1206c0c6bbbddb5921ef396b5b941Santos Cordon     * @param callId The identifier of the call to disconnect.
74bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad     */
75bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad    void disconnect(String callId);
76bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon
77bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon    /**
78b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Receives a new call ID to use with an incoming call. Invoked by Telecomm after it is notified
79b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * that this call service has a pending incoming call, see
80b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * {@link TelecommConstants#ACTION_INCOMING_CALL}. The call service must first give Telecomm
81b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * additional information of the call through {@link ICallServiceAdapter#handleIncomingCall}.
82b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Following that, the call service can update the call at will using the specified call ID.
83bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon     *
84bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon     * @param callId The ID of the call.
85bd63f90a789bfb608dbd036d60c4d08f9fd1f2d9Santos Cordon     */
86b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    void setIncomingCallId(String callId);
87b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon
88b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    /**
89b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Answers a ringing call identified by callId. Telecomm invokes this method as a result of the
90b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * user hitting the "answer" button in the incoming call screen.
91b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     *
92b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * @param callId The ID of the call.
93b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     */
94b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    void answer(String callId);
95b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon
96b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    /**
97b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * Rejects a ringing call identified by callId. Telecomm invokes this method as a result of the
98b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * user hitting the "reject" button in the incoming call screen.
99b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     *
100b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     * @param callId The ID of the call.
101b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon     */
102b340c331bca330e9cb60ce6e398b3c014e1a14c7Santos Cordon    void reject(String callId);
103bb69b0c2d821a9806fb00037284c399cbc78277dBen Gilad}
104