TestImsServiceControllerAdapter.java revision 7bccdcbcf8619b3629032481d456aefc4871fb81
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 17package com.android.internal.telephony.ims; 18 19import android.app.PendingIntent; 20import android.os.Message; 21import android.os.RemoteException; 22import android.telephony.ims.feature.ImsFeature; 23 24import com.android.ims.ImsCallProfile; 25import com.android.ims.internal.IImsCallSession; 26import com.android.ims.internal.IImsCallSessionListener; 27import com.android.ims.internal.IImsConfig; 28import com.android.ims.internal.IImsEcbm; 29import com.android.ims.internal.IImsFeatureStatusCallback; 30import com.android.ims.internal.IImsMultiEndpoint; 31import com.android.ims.internal.IImsRegistrationListener; 32import com.android.ims.internal.IImsServiceController; 33import com.android.ims.internal.IImsUt; 34 35import static org.mockito.Mockito.spy; 36 37/** 38 * Test base implementation of the ImsServiceController, which is used as a mockito spy. 39 */ 40 41public class TestImsServiceControllerAdapter { 42 43 public IImsFeatureStatusCallback mStatusCallback; 44 45 public class ImsServiceControllerBinder extends IImsServiceController.Stub { 46 47 @Override 48 public void createImsFeature(int slotId, int feature, IImsFeatureStatusCallback c) 49 throws RemoteException { 50 TestImsServiceControllerAdapter.this.createImsFeature(slotId, feature); 51 mStatusCallback = c; 52 } 53 54 @Override 55 public void removeImsFeature(int slotId, int feature, IImsFeatureStatusCallback c) 56 throws RemoteException { 57 TestImsServiceControllerAdapter.this.removeImsFeature(slotId, feature); 58 } 59 60 @Override 61 public int startSession(int slotId, int featureType, PendingIntent incomingCallIntent, 62 IImsRegistrationListener listener) throws RemoteException { 63 return 0; 64 } 65 66 @Override 67 public void endSession(int slotId, int featureType, int sessionId) throws RemoteException { 68 69 } 70 71 @Override 72 public boolean isConnected(int slotId, int featureType, int callSessionType, int callType) 73 throws RemoteException { 74 return false; 75 } 76 77 @Override 78 public boolean isOpened(int slotId, int featureType) throws RemoteException { 79 return false; 80 } 81 82 @Override 83 public int getFeatureStatus(int slotId, int featureType) throws RemoteException { 84 return ImsFeature.STATE_NOT_AVAILABLE; 85 } 86 87 @Override 88 public void addRegistrationListener(int slotId, int featureType, 89 IImsRegistrationListener listener) throws RemoteException { 90 91 } 92 93 @Override 94 public void removeRegistrationListener(int slotId, int featureType, 95 IImsRegistrationListener listener) throws RemoteException { 96 97 } 98 99 @Override 100 public ImsCallProfile createCallProfile(int slotId, int featureType, int sessionId, 101 int callSessionType, int callType) throws RemoteException { 102 return null; 103 } 104 105 @Override 106 public IImsCallSession createCallSession(int slotId, int featureType, int sessionId, 107 ImsCallProfile profile, IImsCallSessionListener listener) throws RemoteException { 108 return null; 109 } 110 111 @Override 112 public IImsCallSession getPendingCallSession(int slotId, int featureType, int sessionId, 113 String callId) throws RemoteException { 114 return null; 115 } 116 117 @Override 118 public IImsUt getUtInterface(int slotId, int featureType) 119 throws RemoteException { 120 return null; 121 } 122 123 @Override 124 public IImsConfig getConfigInterface(int slotId, int featureType) 125 throws RemoteException { 126 return null; 127 } 128 129 @Override 130 public void turnOnIms(int slotId, int featureType) 131 throws RemoteException { 132 133 } 134 135 @Override 136 public void turnOffIms(int slotId, int featureType) throws RemoteException { 137 138 } 139 140 @Override 141 public IImsEcbm getEcbmInterface(int slotId, int featureType) 142 throws RemoteException { 143 return null; 144 } 145 146 @Override 147 public void setUiTTYMode(int slotId, int featureType, int uiTtyMode, Message onComplete) 148 throws RemoteException { 149 150 } 151 152 @Override 153 public IImsMultiEndpoint getMultiEndpointInterface(int slotId, int featureType) 154 throws RemoteException { 155 return null; 156 } 157 } 158 159 private ImsServiceControllerBinder mBinder; 160 161 public IImsServiceController getBinder() { 162 if (mBinder == null) { 163 mBinder = spy(new ImsServiceControllerBinder()); 164 } 165 166 return mBinder; 167 } 168 169 // Used by Mockito for verification that this method is being called in spy 170 public void createImsFeature(int subId, int feature) throws RemoteException { 171 } 172 173 // Used by Mockito for verification that this method is being called in spy 174 public void removeImsFeature(int subId, int feature) throws RemoteException { 175 } 176} 177