1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.telephony.ims;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.telephony.ims.stub.SipDelegate;
22 
23 /**
24  * Callback interface provided to the SipTransport implementation to notify a remote application of
25  * the following:
26  * <ul>
27  *     <li>A new incoming SIP message associated with the feature tags the SipDelegate registered
28  *     with has been received or an in-dialog request to this SipDelegate has been received.</li>
29  *     <li>Acknowledge that an outgoing SIP message from the RCS application has been sent
30  *     successfully or notify the application of the reason why it was not sent</li>
31  * </ul>
32  * @hide
33  */
34 @SystemApi
35 public interface DelegateMessageCallback {
36 
37     /**
38      * Sends a new incoming SIP message to the remote application for processing.
39      */
onMessageReceived(@onNull SipMessage message)40     void onMessageReceived(@NonNull SipMessage message);
41 
42     /**
43      * Notifies the remote application that a previous request to send a SIP message using
44      * {@link SipDelegate#sendMessage} has succeeded.
45      *
46      * @param viaTransactionId The transaction ID found in the via header field of the
47      *         previously sent {@link SipMessage}.
48      */
onMessageSent(@onNull String viaTransactionId)49     void onMessageSent(@NonNull String viaTransactionId);
50 
51     /**
52      * Notifies the remote application that a previous request to send a SIP message using
53      * {@link SipDelegate#sendMessage} has failed.
54      *
55      * @param viaTransactionId The Transaction ID found in the via header field of the previously
56      *         sent {@link SipMessage}.
57      * @param reason The reason for the failure.
58      */
onMessageSendFailure(@onNull String viaTransactionId, @SipDelegateManager.MessageFailureReason int reason)59     void onMessageSendFailure(@NonNull String viaTransactionId,
60             @SipDelegateManager.MessageFailureReason int reason);
61 }
62