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