blob: 96926960229d3a06805c882d672cbdffbefacc34 [file] [log] [blame]
Tyler Gunn4d128b62016-04-13 15:44:38 -07001/*
2 * Copyright (C) 2016 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
17package com.android.ims;
18
19import com.android.ims.internal.IImsMultiEndpoint;
20import com.android.ims.internal.IImsExternalCallStateListener;
21
22import android.os.RemoteException;
23import android.telephony.Rlog;
24
25import java.util.List;
26
27/**
28 * Provides APIs for the IMS multi-endpoint functionality. Specifically, provides a means for IMS
29 * to subscribe to dialog event packages issued by the network.
30 *
31 * @hide
32 */
33public class ImsMultiEndpoint {
34 /**
35 * Adapter class for {@link IImsExternalCallStateListener}.
36 */
37 private class ImsExternalCallStateListenerProxy extends IImsExternalCallStateListener.Stub {
38 private ImsExternalCallStateListener mListener;
39
40 public ImsExternalCallStateListenerProxy(ImsExternalCallStateListener listener) {
41 mListener = listener;
42 }
43
44
45 /**
46 * Notifies client when Dialog Event Package update is received
47 *
48 * @param externalCallState the external call state.
49 */
50 @Override
51 public void onImsExternalCallStateUpdate(List<ImsExternalCallState> externalCallState) {
52 if (DBG) Rlog.d(TAG, "onImsExternalCallStateUpdate");
53
54 if (mListener != null) {
55 mListener.onImsExternalCallStateUpdate(externalCallState);
56 }
57 }
58 }
59
60 private static final String TAG = "ImsMultiEndpoint";
61 private static final boolean DBG = true;
62
63 private final IImsMultiEndpoint mImsMultiendpoint;
64
65 public ImsMultiEndpoint(IImsMultiEndpoint iImsMultiEndpoint) {
66 if (DBG) Rlog.d(TAG, "ImsMultiEndpoint created");
67 mImsMultiendpoint = iImsMultiEndpoint;
68 }
69
70 public void setExternalCallStateListener(ImsExternalCallStateListener externalCallStateListener)
71 throws ImsException {
72 try {
73 if (DBG) Rlog.d(TAG, "setExternalCallStateListener");
74 mImsMultiendpoint.setListener(new ImsExternalCallStateListenerProxy(
75 externalCallStateListener));
76 } catch (RemoteException e) {
77 throw new ImsException("setExternalCallStateListener could not be set.", e,
78 ImsReasonInfo.CODE_LOCAL_IMS_SERVICE_DOWN);
79 }
80 }
Brad Ebingerf68247f2017-06-20 16:29:50 -070081
82 public boolean isBinderAlive() {
83 return mImsMultiendpoint.asBinder().isBinderAlive();
84 }
Tyler Gunn4d128b62016-04-13 15:44:38 -070085}