1 /* 2 * Copyright (C) 2019 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.cts.externalimsservice; 18 19 import android.content.Intent; 20 import android.os.IBinder; 21 import android.telephony.ims.cts.ImsUtils; 22 import android.telephony.ims.cts.TestImsService; 23 import android.telephony.ims.stub.ImsFeatureConfiguration; 24 import android.util.Log; 25 26 /** 27 * A test ImsService that is used for GTS Testing. This package is separate from the main test 28 * package because we need to have two packages available. 29 */ 30 31 public class TestExternalImsService extends TestImsService { 32 private static final String TAG = "GtsImsTestDeviceImsService"; 33 // TODO: Use ImsService.SERVICE_INTERFACE definition when it becomes public. 34 private static final String ACTION_BIND_IMS_SERVICE = "android.telephony.ims.ImsService"; 35 36 private final TestFrameworkConnection mBinder = new TestFrameworkConnection(); 37 38 // For local access of this Service. 39 public class TestFrameworkConnection extends ITestExternalImsService.Stub { waitForLatchCountdown(int latchIndex)40 public boolean waitForLatchCountdown(int latchIndex) { 41 return TestExternalImsService.this.waitForLatchCountdown(latchIndex); 42 } 43 setFeatureConfig(ImsFeatureConfiguration f)44 public void setFeatureConfig(ImsFeatureConfiguration f) { 45 TestExternalImsService.this.setFeatureConfig(f); 46 } 47 isRcsFeatureCreated()48 public boolean isRcsFeatureCreated() { 49 return (getRcsFeature() != null); 50 } 51 isMmTelFeatureCreated()52 public boolean isMmTelFeatureCreated() { 53 return (getMmTelFeature() != null); 54 } 55 resetState()56 public void resetState() { 57 TestExternalImsService.this.resetState(); 58 } 59 } 60 61 @Override onBind(Intent intent)62 public IBinder onBind(Intent intent) { 63 if (ACTION_BIND_IMS_SERVICE.equals(intent.getAction())) { 64 if (ImsUtils.VDBG) { 65 Log.i(TAG, "onBind-Remote"); 66 } 67 return super.onBind(intent); 68 } 69 if (ImsUtils.VDBG) { 70 Log.i(TAG, "onBind-Local"); 71 } 72 return mBinder; 73 } 74 } 75