1 /* 2 * Copyright (C) 2020 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.cts.verifier.telecom; 18 19 import android.telecom.Call; 20 21 import com.android.compatibility.common.util.ApiTest; 22 23 @ApiTest(apis={"android.telecom.ConnectionService"}) 24 public class CtsIncomingCall { 25 private static final CtsIncomingCall INSTANCE = new CtsIncomingCall(); 26 private Call mCall; 27 private boolean mAcceptWhenLocked; 28 getInstance()29 public static CtsIncomingCall getInstance() { 30 return INSTANCE; 31 } 32 setCall(Call call)33 public void setCall(Call call) { 34 mCall = call; 35 mAcceptWhenLocked = false; 36 } 37 disconnectCall()38 public void disconnectCall() { 39 if (mCall != null) { 40 mCall.disconnect(); 41 mCall = null; 42 } 43 } 44 setAcceptWhenLocked(boolean acceptWhenLocked)45 public void setAcceptWhenLocked(boolean acceptWhenLocked) { 46 if (mCall != null) { 47 mAcceptWhenLocked = acceptWhenLocked; 48 } 49 } 50 isAcceptWhenLocked()51 public boolean isAcceptWhenLocked() { 52 return mAcceptWhenLocked; 53 } 54 } 55