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