ImsServiceBase.java revision 4cf372979cf216972c2182e8e1c75dd1d87136b3
1/*
2 * Copyright (C) 2015 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 android.app.PendingIntent;
20
21import com.android.ims.ImsCallProfile;
22import com.android.ims.internal.IImsCallSession;
23import com.android.ims.internal.IImsCallSessionListener;
24import com.android.ims.internal.IImsConfig;
25import com.android.ims.internal.IImsEcbm;
26import com.android.ims.internal.IImsRegistrationListener;
27import com.android.ims.internal.IImsService;
28import com.android.ims.internal.IImsUt;
29import android.os.Message;
30
31/*
32 * Stub for IImsService interface. To enable forward compatibility during
33 * development - empty APIs should not be deployed.
34 *
35 * @hide
36 */
37public abstract class ImsServiceBase {
38    /**
39     * IImsService stub implementation.
40     */
41    private final class ImsServiceBinder extends IImsService.Stub {
42        @Override
43        public int open(int phoneId, int serviceClass, PendingIntent incomingCallIntent,
44                 IImsRegistrationListener listener) {
45            return onOpen(phoneId, serviceClass, incomingCallIntent, listener);
46        }
47
48        @Override
49        public void close(int serviceId) {
50            onClose(serviceId);
51        }
52
53        @Override
54        public boolean isConnected(int serviceId, int serviceType, int callType) {
55            return onIsConnected(serviceId, serviceType, callType);
56        }
57
58        @Override
59        public boolean isOpened(int serviceId) {
60            return onIsOpened(serviceId);
61        }
62
63        @Override
64        public void setRegistrationListener(int serviceId, IImsRegistrationListener listener) {
65            onSetRegistrationListener(serviceId, listener);
66        }
67
68        @Override
69        public ImsCallProfile createCallProfile(int serviceId, int serviceType, int callType) {
70            return onCreateCallProfile(serviceId, serviceType, callType);
71        }
72
73        @Override
74        public IImsCallSession createCallSession(int serviceId, ImsCallProfile profile,
75                                          IImsCallSessionListener listener) {
76            return onCreateCallSession(serviceId, profile, listener);
77        }
78
79        @Override
80        public IImsCallSession getPendingCallSession(int serviceId, String callId) {
81            return onGetPendingCallSession(serviceId, callId);
82        }
83
84        @Override
85        public IImsUt getUtInterface(int serviceId) {
86            return onGetUtInterface(serviceId);
87        }
88
89        @Override
90        public IImsConfig getConfigInterface(int phoneId) {
91            return onGetConfigInterface(phoneId);
92        }
93
94        @Override
95        public void turnOnIms(int phoneId) {
96            onTurnOnIms(phoneId);
97        }
98
99        @Override
100        public void turnOffIms(int phoneId) {
101            onTurnOffIms(phoneId);
102        }
103
104        @Override
105        public IImsEcbm getEcbmInterface(int serviceId) {
106            return onGetEcbmInterface(serviceId);
107        }
108
109        @Override
110        public void setUiTTYMode(int serviceId, int uiTtyMode, Message onComplete) {
111            onSetUiTTYMode(serviceId, uiTtyMode, onComplete);
112        }
113    }
114
115    private ImsServiceBinder mBinder;
116
117    public ImsServiceBinder getBinder() {
118        if (mBinder == null) {
119            mBinder = new ImsServiceBinder();
120        }
121
122        return mBinder;
123    }
124
125    protected int onOpen(int phoneId, int serviceClass, PendingIntent incomingCallIntent,
126                    IImsRegistrationListener listener) {
127        // no-op
128
129        return 0; // DUMMY VALUE
130    }
131
132    protected void onClose(int serviceId) {
133        // no-op
134    }
135
136    protected boolean onIsConnected(int serviceId, int serviceType, int callType) {
137        // no-op
138
139        return false; // DUMMY VALUE
140    }
141
142    protected boolean onIsOpened(int serviceId) {
143        // no-op
144
145        return false; // DUMMY VALUE
146    }
147
148    protected void onSetRegistrationListener(int serviceId, IImsRegistrationListener listener) {
149        // no-op
150    }
151
152    protected ImsCallProfile onCreateCallProfile(int serviceId, int serviceType, int callType) {
153        // no-op
154
155        return null;
156    }
157
158    protected IImsCallSession onCreateCallSession(int serviceId, ImsCallProfile profile,
159                                             IImsCallSessionListener listener) {
160        // no-op
161
162        return null;
163    }
164
165    protected IImsCallSession onGetPendingCallSession(int serviceId, String callId) {
166        // no-op
167
168        return null;
169    }
170
171    protected IImsUt onGetUtInterface(int serviceId) {
172        // no-op
173
174        return null;
175    }
176
177    protected IImsConfig onGetConfigInterface(int phoneId) {
178        // no-op
179
180        return null;
181    }
182
183    protected void onTurnOnIms(int phoneId) {
184        // no-op
185    }
186
187    protected void onTurnOffIms(int phoneId) {
188        // no-op
189    }
190
191    protected IImsEcbm onGetEcbmInterface(int serviceId) {
192        // no-op
193
194        return null;
195    }
196
197    protected void onSetUiTTYMode(int serviceId, int uiTtyMode, Message onComplete) {
198        // no-op
199    }
200}
201
202