@Implements(value=android.bluetooth.BluetoothHeadset.class) public class ShadowBluetoothHeadset extends Object
Shadow for BluetoothHeadset
Constructor and Description |
---|
ShadowBluetoothHeadset() |
Modifier and Type | Method and Description |
---|---|
void |
addConnectedDevice(BluetoothDevice device)
Adds the given BluetoothDevice to the shadow’s list of “connected devices”
|
protected List<BluetoothDevice> |
getConnectedDevices()
Overrides behavior of
getConnectedDevices . |
protected int |
getConnectionState(BluetoothDevice device)
Overrides behavior of
getConnectionState . |
protected boolean |
sendVendorSpecificResultCode(BluetoothDevice device,
String command,
String arg)
Overrides behavior of
sendVendorSpecificResultCode . |
void |
setAllowsSendVendorSpecificResultCode(boolean allowsSendVendorSpecificResultCode)
|
@Implementation protected List<BluetoothDevice> getConnectedDevices()
Overrides behavior of getConnectedDevices
. Returns list of devices that is set up by call(s) to addConnectedDevice(android.bluetooth.BluetoothDevice)
. Returns an empty list by default.
public void addConnectedDevice(BluetoothDevice device)
Adds the given BluetoothDevice to the shadow’s list of “connected devices”
@Implementation protected int getConnectionState(BluetoothDevice device)
Overrides behavior of getConnectionState
.
BluetoothProfile.STATE_CONNECTED
if the given device has been previously added by a call to addConnectedDevice(android.bluetooth.BluetoothDevice)
, and BluetoothProfile.STATE_DISCONNECTED
otherwise.@Implementation(minSdk=19) protected boolean sendVendorSpecificResultCode(BluetoothDevice device, String command, String arg)
Overrides behavior of sendVendorSpecificResultCode
.
addConnectedDevice(android.bluetooth.BluetoothDevice)
and setAllowsSendVendorSpecificResultCode(boolean)
has not been called with ‘false’ argument.IllegalArgumentException
- if ‘command’ argument is null, per Android APIpublic void setAllowsSendVendorSpecificResultCode(boolean allowsSendVendorSpecificResultCode)
Affects the behavior of BluetoothHeadset.sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice, java.lang.String, java.lang.String)
allowsSendVendorSpecificResultCode
- can be set to ‘false’ to simulate the situation where the system is unable to send vendor-specific result codes to a device