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.stub;
18 
19 import android.annotation.NonNull;
20 import android.annotation.SystemApi;
21 import android.telephony.ims.SipDelegateConnection;
22 import android.telephony.ims.SipDelegateManager;
23 import android.telephony.ims.SipMessage;
24 
25 /**
26  * The callback associated with a {@link SipDelegateConnection}, which handles newly received
27  * messages as well as the result of sending a SIP message.
28  * @hide
29  */
30 @SystemApi
31 public interface DelegateConnectionMessageCallback {
32 
33     /**
34      * A new {@link SipMessage} has been received from the delegate.
35      * @param message the {@link SipMessage} routed to this RCS application.
36      */
onMessageReceived(@onNull SipMessage message)37     void onMessageReceived(@NonNull SipMessage message);
38 
39     /**
40      * A message previously sent to the SIP delegate using
41      * {@link SipDelegateConnection#sendMessage} has been successfully sent.
42      * @param viaTransactionId The transaction ID found in the via header field of the
43      *                         previously sent {@link SipMessage}.
44      */
onMessageSent(@onNull String viaTransactionId)45     void onMessageSent(@NonNull String viaTransactionId);
46 
47     /**
48      * A message previously sent to the SIP delegate using
49      * {@link SipDelegateConnection#sendMessage} has failed to be sent.
50      * @param viaTransactionId The Transaction ID found in the via header field of the
51      *                         previously sent {@link SipMessage}.
52      * @param reason The reason for the failure.
53      */
onMessageSendFailure(@onNull String viaTransactionId, @SipDelegateManager.MessageFailureReason int reason)54     void onMessageSendFailure(@NonNull String viaTransactionId,
55             @SipDelegateManager.MessageFailureReason int reason);
56 }
57