/* * Copyright (C) 2020 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.bluetooth.hfp; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothHeadset; import java.util.List; /** * A proxy class that facilitates testing of the BluetoothInCallService class. * * This is necessary due to the "final" attribute of the BluetoothHeadset class. In order to * test the correct functioning of the BluetoothInCallService class, the final class must be put * into a container that can be mocked correctly. */ public class BluetoothHeadsetProxy { private BluetoothHeadset mBluetoothHeadset; public BluetoothHeadsetProxy(BluetoothHeadset headset) { mBluetoothHeadset = headset; } public void clccResponse(int index, int direction, int status, int mode, boolean mpty, String number, int type) { mBluetoothHeadset.clccResponse(index, direction, status, mode, mpty, number, type); } public void phoneStateChanged(int numActive, int numHeld, int callState, String number, int type, String name) { mBluetoothHeadset.phoneStateChanged(numActive, numHeld, callState, number, type, name); } public List getConnectedDevices() { return mBluetoothHeadset.getConnectedDevices(); } public int getConnectionState(BluetoothDevice device) { return mBluetoothHeadset.getConnectionState(device); } public int getAudioState(BluetoothDevice device) { return mBluetoothHeadset.getAudioState(device); } public boolean connectAudio() { return mBluetoothHeadset.connectAudio(); } public boolean setActiveDevice(BluetoothDevice device) { return mBluetoothHeadset.setActiveDevice(device); } public BluetoothDevice getActiveDevice() { return mBluetoothHeadset.getActiveDevice(); } public boolean isAudioOn() { return mBluetoothHeadset.isAudioOn(); } public boolean disconnectAudio() { return mBluetoothHeadset.disconnectAudio(); } public boolean isInbandRingingEnabled() { return mBluetoothHeadset.isInbandRingingEnabled(); } }