1 /*
2  * Copyright (C) 2017 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.SystemApi;
20 import android.os.Bundle;
21 import android.os.RemoteException;
22 import android.telephony.ims.ImsUtListener;
23 
24 import com.android.ims.internal.IImsUt;
25 import com.android.ims.internal.IImsUtListener;
26 
27 /**
28  * Base implementation of IMS UT interface, which implements stubs. Override these methods to
29  * implement functionality.
30  *
31  * @hide
32  */
33 // DO NOT remove or change the existing APIs, only add new ones to this Base implementation or you
34 // will break other implementations of ImsUt maintained by other ImsServices.
35 @SystemApi
36 public class ImsUtImplBase {
37 
38     private IImsUt.Stub mServiceImpl = new IImsUt.Stub() {
39         @Override
40         public void close() throws RemoteException {
41             ImsUtImplBase.this.close();
42         }
43 
44         @Override
45         public int queryCallBarring(int cbType) throws RemoteException {
46             return ImsUtImplBase.this.queryCallBarring(cbType);
47         }
48 
49         @Override
50         public int queryCallForward(int condition, String number) throws RemoteException {
51             return ImsUtImplBase.this.queryCallForward(condition, number);
52         }
53 
54         @Override
55         public int queryCallWaiting() throws RemoteException {
56             return ImsUtImplBase.this.queryCallWaiting();
57         }
58 
59         @Override
60         public int queryCLIR() throws RemoteException {
61             return ImsUtImplBase.this.queryCLIR();
62         }
63 
64         @Override
65         public int queryCLIP() throws RemoteException {
66             return ImsUtImplBase.this.queryCLIP();
67         }
68 
69         @Override
70         public int queryCOLR() throws RemoteException {
71             return ImsUtImplBase.this.queryCOLR();
72         }
73 
74         @Override
75         public int queryCOLP() throws RemoteException {
76             return ImsUtImplBase.this.queryCOLP();
77         }
78 
79         @Override
80         public int transact(Bundle ssInfo) throws RemoteException {
81             return ImsUtImplBase.this.transact(ssInfo);
82         }
83 
84         @Override
85         public int updateCallBarring(int cbType, int action, String[] barrList) throws
86                 RemoteException {
87             return ImsUtImplBase.this.updateCallBarring(cbType, action, barrList);
88         }
89 
90         @Override
91         public int updateCallForward(int action, int condition, String number, int serviceClass,
92                 int timeSeconds) throws RemoteException {
93             return ImsUtImplBase.this.updateCallForward(action, condition, number, serviceClass,
94                     timeSeconds);
95         }
96 
97         @Override
98         public int updateCallWaiting(boolean enable, int serviceClass) throws RemoteException {
99             return ImsUtImplBase.this.updateCallWaiting(enable, serviceClass);
100         }
101 
102         @Override
103         public int updateCLIR(int clirMode) throws RemoteException {
104             return ImsUtImplBase.this.updateCLIR(clirMode);
105         }
106 
107         @Override
108         public int updateCLIP(boolean enable) throws RemoteException {
109             return ImsUtImplBase.this.updateCLIP(enable);
110         }
111 
112         @Override
113         public int updateCOLR(int presentation) throws RemoteException {
114             return ImsUtImplBase.this.updateCOLR(presentation);
115         }
116 
117         @Override
118         public int updateCOLP(boolean enable) throws RemoteException {
119             return ImsUtImplBase.this.updateCOLP(enable);
120         }
121 
122         @Override
123         public void setListener(IImsUtListener listener) throws RemoteException {
124             ImsUtImplBase.this.setListener(new ImsUtListener(listener));
125         }
126 
127         @Override
128         public int queryCallBarringForServiceClass(int cbType, int serviceClass)
129                 throws RemoteException {
130             return ImsUtImplBase.this.queryCallBarringForServiceClass(cbType, serviceClass);
131         }
132 
133         @Override
134         public int updateCallBarringForServiceClass(int cbType, int action,
135                 String[] barrList, int serviceClass) throws RemoteException {
136             return ImsUtImplBase.this.updateCallBarringForServiceClass(
137                     cbType, action, barrList, serviceClass);
138         }
139     };
140 
141     /**
142      * Called when the framework no longer needs to interact with the IMS UT implementation any
143      * longer.
144      */
close()145     public void close() {
146 
147     }
148 
149     /**
150      * Retrieves the call barring configuration.
151      * @param cbType
152      */
queryCallBarring(int cbType)153     public int queryCallBarring(int cbType) {
154         return -1;
155     }
156 
157     /**
158      * Retrieves the configuration of the call barring for specified service class.
159      */
queryCallBarringForServiceClass(int cbType, int serviceClass)160     public int queryCallBarringForServiceClass(int cbType, int serviceClass) {
161         return -1;
162     }
163 
164     /**
165      * Retrieves the configuration of the call forward.
166      */
queryCallForward(int condition, String number)167     public int queryCallForward(int condition, String number) {
168         return -1;
169     }
170 
171     /**
172      * Retrieves the configuration of the call waiting.
173      */
queryCallWaiting()174     public int queryCallWaiting() {
175         return -1;
176     }
177 
178     /**
179      * Retrieves the default CLIR setting.
180      * @hide
181      */
queryCLIR()182     public int queryCLIR() {
183         return queryClir();
184     }
185 
186     /**
187      * Retrieves the CLIP call setting.
188      * @hide
189      */
queryCLIP()190     public int queryCLIP() {
191         return queryClip();
192     }
193 
194     /**
195      * Retrieves the COLR call setting.
196      * @hide
197      */
queryCOLR()198     public int queryCOLR() {
199         return queryColr();
200     }
201 
202     /**
203      * Retrieves the COLP call setting.
204      * @hide
205      */
queryCOLP()206     public int queryCOLP() {
207         return queryColp();
208     }
209 
210     /**
211      * Retrieves the default CLIR setting.
212      */
queryClir()213     public int queryClir() {
214         return -1;
215     }
216 
217     /**
218      * Retrieves the CLIP call setting.
219      */
queryClip()220     public int queryClip() {
221         return -1;
222     }
223 
224     /**
225      * Retrieves the COLR call setting.
226      */
queryColr()227     public int queryColr() {
228         return -1;
229     }
230 
231     /**
232      * Retrieves the COLP call setting.
233      */
queryColp()234     public int queryColp() {
235         return -1;
236     }
237 
238     /**
239      * Updates or retrieves the supplementary service configuration.
240      */
transact(Bundle ssInfo)241     public int transact(Bundle ssInfo) {
242         return -1;
243     }
244 
245     /**
246      * Updates the configuration of the call barring.
247      */
updateCallBarring(int cbType, int action, String[] barrList)248     public int updateCallBarring(int cbType, int action, String[] barrList) {
249         return -1;
250     }
251 
252     /**
253      * Updates the configuration of the call barring for specified service class.
254      */
updateCallBarringForServiceClass(int cbType, int action, String[] barrList, int serviceClass)255     public int updateCallBarringForServiceClass(int cbType, int action, String[] barrList,
256             int serviceClass) {
257         return -1;
258     }
259 
260     /**
261      * Updates the configuration of the call forward.
262      */
updateCallForward(int action, int condition, String number, int serviceClass, int timeSeconds)263     public int updateCallForward(int action, int condition, String number, int serviceClass,
264             int timeSeconds) {
265         return 0;
266     }
267 
268     /**
269      * Updates the configuration of the call waiting.
270      */
updateCallWaiting(boolean enable, int serviceClass)271     public int updateCallWaiting(boolean enable, int serviceClass) {
272         return -1;
273     }
274 
275     /**
276      * Updates the configuration of the CLIR supplementary service.
277      * @hide
278      */
updateCLIR(int clirMode)279     public int updateCLIR(int clirMode) {
280         return updateClir(clirMode);
281     }
282 
283     /**
284      * Updates the configuration of the CLIP supplementary service.
285      * @hide
286      */
updateCLIP(boolean enable)287     public int updateCLIP(boolean enable) {
288         return updateClip(enable);
289     }
290 
291     /**
292      * Updates the configuration of the COLR supplementary service.
293      * @hide
294      */
updateCOLR(int presentation)295     public int updateCOLR(int presentation) {
296         return updateColr(presentation);
297     }
298 
299     /**
300      * Updates the configuration of the COLP supplementary service.
301      * @hide
302      */
updateCOLP(boolean enable)303     public int updateCOLP(boolean enable) {
304         return updateColp(enable);
305     }
306 
307     /**
308      * Updates the configuration of the CLIR supplementary service.
309      */
updateClir(int clirMode)310     public int updateClir(int clirMode) {
311         return -1;
312     }
313 
314     /**
315      * Updates the configuration of the CLIP supplementary service.
316      */
updateClip(boolean enable)317     public int updateClip(boolean enable) {
318         return -1;
319     }
320 
321     /**
322      * Updates the configuration of the COLR supplementary service.
323      */
updateColr(int presentation)324     public int updateColr(int presentation) {
325         return -1;
326     }
327 
328     /**
329      * Updates the configuration of the COLP supplementary service.
330      */
updateColp(boolean enable)331     public int updateColp(boolean enable) {
332         return -1;
333     }
334 
335     /**
336      * Sets the listener.
337      */
setListener(ImsUtListener listener)338     public void setListener(ImsUtListener listener) {
339     }
340 
341     /**
342      * @hide
343      */
getInterface()344     public IImsUt getInterface() {
345         return mServiceImpl;
346     }
347 }
348