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.IntDef; 20 import android.annotation.NonNull; 21 import android.annotation.Nullable; 22 import android.annotation.SystemApi; 23 import android.annotation.TestApi; 24 import android.os.Bundle; 25 import android.os.RemoteException; 26 import android.telephony.ims.ImsUtListener; 27 28 import com.android.ims.internal.IImsUt; 29 import com.android.ims.internal.IImsUtListener; 30 31 import java.lang.annotation.Retention; 32 import java.lang.annotation.RetentionPolicy; 33 34 /** 35 * Base implementation of IMS UT interface, which implements stubs. Override these methods to 36 * implement functionality. 37 * 38 * @hide 39 */ 40 // DO NOT remove or change the existing APIs, only add new ones to this Base implementation or you 41 // will break other implementations of ImsUt maintained by other ImsServices. 42 @SystemApi 43 @TestApi 44 public class ImsUtImplBase { 45 /** 46 * Bar all incoming calls. (See 3GPP TS 24.611) 47 */ 48 public static final int CALL_BARRING_ALL_INCOMING = 1; 49 50 /** 51 * Bar all outgoing calls. (See 3GPP TS 24.611) 52 */ 53 public static final int CALL_BARRING_ALL_OUTGOING = 2; 54 55 /** 56 * Bar all outgoing international calls. (See 3GPP TS 24.611) 57 */ 58 public static final int CALL_BARRING_OUTGOING_INTL = 3; 59 60 /** 61 * Bar all outgoing international calls, excluding those to the home PLMN country 62 * (See 3GPP TS 24.611) 63 */ 64 public static final int CALL_BARRING_OUTGOING_INTL_EXCL_HOME = 4; 65 66 /** 67 * Bar all incoming calls when roaming (See 3GPP TS 24.611) 68 */ 69 public static final int CALL_BLOCKING_INCOMING_WHEN_ROAMING = 5; 70 71 /** 72 * Enable Anonymous Communication Rejection (See 3GPP TS 24.611) 73 */ 74 public static final int CALL_BARRING_ANONYMOUS_INCOMING = 6; 75 76 /** 77 * Bar all incoming and outgoing calls. (See 3GPP TS 24.611) 78 */ 79 public static final int CALL_BARRING_ALL = 7; 80 81 /** 82 * Bar all outgoing service requests, including calls. (See 3GPP TS 24.611) 83 */ 84 public static final int CALL_BARRING_OUTGOING_ALL_SERVICES = 8; 85 86 /** 87 * Bar all incoming service requests, including calls. (See 3GPP TS 24.611) 88 */ 89 public static final int CALL_BARRING_INCOMING_ALL_SERVICES = 9; 90 91 /** 92 * Bar specific incoming calls. (See 3GPP TS 24.611) 93 */ 94 public static final int CALL_BARRING_SPECIFIC_INCOMING_CALLS = 10; 95 96 /** @hide */ 97 @Retention(RetentionPolicy.SOURCE) 98 @IntDef(prefix = "CALL_BARRING_", value = {CALL_BARRING_ALL_INCOMING, CALL_BARRING_ALL_OUTGOING, 99 CALL_BARRING_OUTGOING_INTL, CALL_BARRING_OUTGOING_INTL_EXCL_HOME, 100 CALL_BLOCKING_INCOMING_WHEN_ROAMING, CALL_BARRING_ANONYMOUS_INCOMING, 101 CALL_BARRING_ALL, CALL_BARRING_OUTGOING_ALL_SERVICES, 102 CALL_BARRING_INCOMING_ALL_SERVICES, CALL_BARRING_SPECIFIC_INCOMING_CALLS}) 103 public @interface CallBarringMode {} 104 105 /** 106 * Constant used to denote an invalid return value. 107 */ 108 public static final int INVALID_RESULT = -1; 109 110 private IImsUt.Stub mServiceImpl = new IImsUt.Stub() { 111 @Override 112 public void close() throws RemoteException { 113 ImsUtImplBase.this.close(); 114 } 115 116 @Override 117 public int queryCallBarring(int cbType) throws RemoteException { 118 return ImsUtImplBase.this.queryCallBarring(cbType); 119 } 120 121 @Override 122 public int queryCallForward(int condition, String number) throws RemoteException { 123 return ImsUtImplBase.this.queryCallForward(condition, number); 124 } 125 126 @Override 127 public int queryCallWaiting() throws RemoteException { 128 return ImsUtImplBase.this.queryCallWaiting(); 129 } 130 131 @Override 132 public int queryCLIR() throws RemoteException { 133 return ImsUtImplBase.this.queryCLIR(); 134 } 135 136 @Override 137 public int queryCLIP() throws RemoteException { 138 return ImsUtImplBase.this.queryCLIP(); 139 } 140 141 @Override 142 public int queryCOLR() throws RemoteException { 143 return ImsUtImplBase.this.queryCOLR(); 144 } 145 146 @Override 147 public int queryCOLP() throws RemoteException { 148 return ImsUtImplBase.this.queryCOLP(); 149 } 150 151 @Override 152 public int transact(Bundle ssInfo) throws RemoteException { 153 return ImsUtImplBase.this.transact(ssInfo); 154 } 155 156 @Override 157 public int updateCallBarring(int cbType, int action, String[] barrList) throws 158 RemoteException { 159 return ImsUtImplBase.this.updateCallBarring(cbType, action, barrList); 160 } 161 162 @Override 163 public int updateCallForward(int action, int condition, String number, int serviceClass, 164 int timeSeconds) throws RemoteException { 165 return ImsUtImplBase.this.updateCallForward(action, condition, number, serviceClass, 166 timeSeconds); 167 } 168 169 @Override 170 public int updateCallWaiting(boolean enable, int serviceClass) throws RemoteException { 171 return ImsUtImplBase.this.updateCallWaiting(enable, serviceClass); 172 } 173 174 @Override 175 public int updateCLIR(int clirMode) throws RemoteException { 176 return ImsUtImplBase.this.updateCLIR(clirMode); 177 } 178 179 @Override 180 public int updateCLIP(boolean enable) throws RemoteException { 181 return ImsUtImplBase.this.updateCLIP(enable); 182 } 183 184 @Override 185 public int updateCOLR(int presentation) throws RemoteException { 186 return ImsUtImplBase.this.updateCOLR(presentation); 187 } 188 189 @Override 190 public int updateCOLP(boolean enable) throws RemoteException { 191 return ImsUtImplBase.this.updateCOLP(enable); 192 } 193 194 @Override 195 public void setListener(IImsUtListener listener) throws RemoteException { 196 ImsUtImplBase.this.setListener(new ImsUtListener(listener)); 197 } 198 199 @Override 200 public int queryCallBarringForServiceClass(int cbType, int serviceClass) 201 throws RemoteException { 202 return ImsUtImplBase.this.queryCallBarringForServiceClass(cbType, serviceClass); 203 } 204 205 @Override 206 public int updateCallBarringForServiceClass(int cbType, int action, 207 String[] barrList, int serviceClass) throws RemoteException { 208 return ImsUtImplBase.this.updateCallBarringForServiceClass( 209 cbType, action, barrList, serviceClass); 210 } 211 212 @Override 213 public int updateCallBarringWithPassword(int cbType, int action, String[] barrList, 214 int serviceClass, String password) throws RemoteException { 215 return ImsUtImplBase.this.updateCallBarringWithPassword( 216 cbType, action, barrList, serviceClass, password); 217 } 218 }; 219 220 /** 221 * Called when the framework no longer needs to interact with the IMS UT implementation any 222 * longer. 223 */ close()224 public void close() { 225 226 } 227 228 /** 229 * Retrieves the call barring configuration. 230 * @param cbType 231 */ queryCallBarring(int cbType)232 public int queryCallBarring(int cbType) { 233 return -1; 234 } 235 236 /** 237 * Retrieves the configuration of the call barring for specified service class. 238 */ queryCallBarringForServiceClass(int cbType, int serviceClass)239 public int queryCallBarringForServiceClass(int cbType, int serviceClass) { 240 return -1; 241 } 242 243 /** 244 * Retrieves the configuration of the call forward. 245 */ queryCallForward(int condition, String number)246 public int queryCallForward(int condition, String number) { 247 return -1; 248 } 249 250 /** 251 * Retrieves the configuration of the call waiting. 252 */ queryCallWaiting()253 public int queryCallWaiting() { 254 return -1; 255 } 256 257 /** 258 * Retrieves the default CLIR setting. 259 * @hide 260 */ queryCLIR()261 public int queryCLIR() { 262 return queryClir(); 263 } 264 265 /** 266 * Retrieves the CLIP call setting. 267 * @hide 268 */ queryCLIP()269 public int queryCLIP() { 270 return queryClip(); 271 } 272 273 /** 274 * Retrieves the COLR call setting. 275 * @hide 276 */ queryCOLR()277 public int queryCOLR() { 278 return queryColr(); 279 } 280 281 /** 282 * Retrieves the COLP call setting. 283 * @hide 284 */ queryCOLP()285 public int queryCOLP() { 286 return queryColp(); 287 } 288 289 /** 290 * Retrieves the default CLIR setting. 291 */ queryClir()292 public int queryClir() { 293 return -1; 294 } 295 296 /** 297 * Retrieves the CLIP call setting. 298 */ queryClip()299 public int queryClip() { 300 return -1; 301 } 302 303 /** 304 * Retrieves the COLR call setting. 305 */ queryColr()306 public int queryColr() { 307 return -1; 308 } 309 310 /** 311 * Retrieves the COLP call setting. 312 */ queryColp()313 public int queryColp() { 314 return -1; 315 } 316 317 /** 318 * Updates or retrieves the supplementary service configuration. 319 */ transact(Bundle ssInfo)320 public int transact(Bundle ssInfo) { 321 return -1; 322 } 323 324 /** 325 * Updates the configuration of the call barring. 326 */ updateCallBarring(@allBarringMode int cbType, int action, String[] barrList)327 public int updateCallBarring(@CallBarringMode int cbType, int action, String[] barrList) { 328 return -1; 329 } 330 331 /** 332 * Updates the configuration of the call barring for specified service class. 333 */ updateCallBarringForServiceClass(@allBarringMode int cbType, int action, String[] barrList, int serviceClass)334 public int updateCallBarringForServiceClass(@CallBarringMode int cbType, int action, 335 String[] barrList, int serviceClass) { 336 return -1; 337 } 338 339 /** 340 * Updates the configuration of the call barring for specified service class with password. 341 * @hide 342 */ updateCallBarringWithPassword(int cbType, int action, @Nullable String[] barrList, int serviceClass, @NonNull String password)343 public int updateCallBarringWithPassword(int cbType, int action, @Nullable String[] barrList, 344 int serviceClass, @NonNull String password) { 345 return -1; 346 } 347 348 /** 349 * Updates the configuration of the call forward. 350 */ updateCallForward(int action, int condition, String number, int serviceClass, int timeSeconds)351 public int updateCallForward(int action, int condition, String number, int serviceClass, 352 int timeSeconds) { 353 return 0; 354 } 355 356 /** 357 * Updates the configuration of the call waiting. 358 */ updateCallWaiting(boolean enable, int serviceClass)359 public int updateCallWaiting(boolean enable, int serviceClass) { 360 return -1; 361 } 362 363 /** 364 * Updates the configuration of the CLIR supplementary service. 365 * @hide 366 */ updateCLIR(int clirMode)367 public int updateCLIR(int clirMode) { 368 return updateClir(clirMode); 369 } 370 371 /** 372 * Updates the configuration of the CLIP supplementary service. 373 * @hide 374 */ updateCLIP(boolean enable)375 public int updateCLIP(boolean enable) { 376 return updateClip(enable); 377 } 378 379 /** 380 * Updates the configuration of the COLR supplementary service. 381 * @hide 382 */ updateCOLR(int presentation)383 public int updateCOLR(int presentation) { 384 return updateColr(presentation); 385 } 386 387 /** 388 * Updates the configuration of the COLP supplementary service. 389 * @hide 390 */ updateCOLP(boolean enable)391 public int updateCOLP(boolean enable) { 392 return updateColp(enable); 393 } 394 395 /** 396 * Updates the configuration of the CLIR supplementary service. 397 */ updateClir(int clirMode)398 public int updateClir(int clirMode) { 399 return -1; 400 } 401 402 /** 403 * Updates the configuration of the CLIP supplementary service. 404 */ updateClip(boolean enable)405 public int updateClip(boolean enable) { 406 return -1; 407 } 408 409 /** 410 * Updates the configuration of the COLR supplementary service. 411 */ updateColr(int presentation)412 public int updateColr(int presentation) { 413 return -1; 414 } 415 416 /** 417 * Updates the configuration of the COLP supplementary service. 418 */ updateColp(boolean enable)419 public int updateColp(boolean enable) { 420 return -1; 421 } 422 423 /** 424 * Sets the listener. 425 */ setListener(ImsUtListener listener)426 public void setListener(ImsUtListener listener) { 427 } 428 429 /** 430 * @hide 431 */ getInterface()432 public IImsUt getInterface() { 433 return mServiceImpl; 434 } 435 } 436