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