BluetoothUtils
public
class
BluetoothUtils
extends Object
java.lang.Object | |
↳ | com.android.tradefed.util.BluetoothUtils |
Utility functions for calling BluetoothInstrumentation on device
Device side BluetoothInstrumentation code can be found in AOSP at:
frameworks/base/core/tests/bluetoothtests
Summary
Constants | |
---|---|
String |
BTSNOOP_API
|
String |
BTSNOOP_CMD
|
String |
BTSNOOP_DISABLE_CMD
|
String |
BTSNOOP_ENABLE_CMD
|
String |
GOLD_BTSNOOP_LOG_PATH
|
String |
O_BUILD
|
Public constructors | |
---|---|
BluetoothUtils()
|
Public methods | |
---|---|
static
void
|
cleanLogFile(ITestDevice device)
Delete snoop log file from device |
static
boolean
|
disable(ITestDevice device)
Disables bluetooth on the given device |
static
boolean
|
disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
Disable btsnoop logging by sl4a call |
static
boolean
|
disableBtsnoopLogging(ITestDevice device)
Disable btsnoop logging by sl4a call |
static
boolean
|
enable(ITestDevice device)
Enables bluetooth on the given device |
static
boolean
|
enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
Enable btsnoop logging by sl4a call |
static
boolean
|
enableBtsnoopLogging(ITestDevice device)
Enable btsnoop logging by sl4a call |
static
String
|
getBluetoothMac(ITestDevice device)
Retrieves BT mac of the given device |
static
Set<String>
|
getBondedDevices(ITestDevice device)
Returns bluetooth mac addresses of devices that the given device has bonded with |
static
String
|
getBtSnoopLogFilePath(ITestDevice device)
Get bt snoop log file path from bt_stack.config file |
static
String
|
runBluetoothInstrumentation(ITestDevice device, String command)
Convenience method to execute BT instrumentation command and return output |
static
boolean
|
runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
|
static
boolean
|
toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
|
static
boolean
|
unpairWithRetry(ITestDevice device)
Retries clearing of BT pairing with linear backoff |
static
void
|
uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Upload snoop log file for test results |
Constants
BTSNOOP_API
public static final String BTSNOOP_API
Constant Value: "bluetoothConfigHciSnoopLog"
BTSNOOP_CMD
public static final String BTSNOOP_CMD
Constant Value: "setprop persist.bluetooth.btsnoopenable "
BTSNOOP_DISABLE_CMD
public static final String BTSNOOP_DISABLE_CMD
Constant Value: "setprop persist.bluetooth.btsnoopenable false"
BTSNOOP_ENABLE_CMD
public static final String BTSNOOP_ENABLE_CMD
Constant Value: "setprop persist.bluetooth.btsnoopenable true"
GOLD_BTSNOOP_LOG_PATH
public static final String GOLD_BTSNOOP_LOG_PATH
Constant Value: "/data/misc/bluetooth/logs/btsnoop_hci.log"
O_BUILD
public static final String O_BUILD
Constant Value: "O"
Public constructors
BluetoothUtils
public BluetoothUtils ()
Public methods
cleanLogFile
public static void cleanLogFile (ITestDevice device)
Delete snoop log file from device
Parameters | |
---|---|
device |
ITestDevice |
Throws | |
---|---|
DeviceNotAvailableException |
disable
public static boolean disable (ITestDevice device)
Disables bluetooth on the given device
Returns | |
---|---|
boolean |
True if disable is successful, false otherwise |
Throws | |
---|---|
DeviceNotAvailableException |
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device, File sl4aApkFile)
Disable btsnoop logging by sl4a call
Parameters | |
---|---|
sl4aApkFile |
File : sl4a.apk file location, null if it has been installed |
Returns | |
---|---|
boolean |
success or not |
Throws | |
---|---|
DeviceNotAvailableException |
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device)
Disable btsnoop logging by sl4a call
Returns | |
---|---|
boolean |
success or not |
Throws | |
---|---|
DeviceNotAvailableException |
enable
public static boolean enable (ITestDevice device)
Enables bluetooth on the given device
Returns | |
---|---|
boolean |
True if enable is successful, false otherwise |
Throws | |
---|---|
DeviceNotAvailableException |
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device, File sl4aApkFile)
Enable btsnoop logging by sl4a call
Parameters | |
---|---|
sl4aApkFile |
File : sl4a.apk file location, null if it has been installed |
Returns | |
---|---|
boolean |
success or not |
Throws | |
---|---|
DeviceNotAvailableException |
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device)
Enable btsnoop logging by sl4a call
Returns | |
---|---|
boolean |
success or not |
Throws | |
---|---|
DeviceNotAvailableException |
getBluetoothMac
public static String getBluetoothMac (ITestDevice device)
Retrieves BT mac of the given device
Returns | |
---|---|
String |
BT mac or null if not found |
Throws | |
---|---|
DeviceNotAvailableException |
getBondedDevices
public static Set<String> getBondedDevices (ITestDevice device)
Returns bluetooth mac addresses of devices that the given device has bonded with
Returns | |
---|---|
Set<String> |
bluetooth mac addresses |
Throws | |
---|---|
DeviceNotAvailableException |
getBtSnoopLogFilePath
public static String getBtSnoopLogFilePath (ITestDevice device)
Get bt snoop log file path from bt_stack.config file
Returns | |
---|---|
String |
THe file name for bt_snoop_log or null if it is not found |
Throws | |
---|---|
DeviceNotAvailableException |
runBluetoothInstrumentation
public static String runBluetoothInstrumentation (ITestDevice device, String command)
Convenience method to execute BT instrumentation command and return output
Parameters | |
---|---|
command |
String : a command string sent over to BT instrumentation, currently supported:
enable, disable, unpairAll, getName, getAddress, getBondedDevices; refer to
AOSP source for more details |
Returns | |
---|---|
String |
output of BluetoothInstrumentation |
Throws | |
---|---|
DeviceNotAvailableException |
runBluetoothInstrumentationWithRetry
public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, String command)
Parameters | |
---|---|
device |
ITestDevice |
command |
String |
Returns | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
toggleBtsnoopLogging
public static boolean toggleBtsnoopLogging (Sl4aClient client, boolean onOff)
Parameters | |
---|---|
client |
Sl4aClient |
onOff |
boolean |
Returns | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
unpairWithRetry
public static boolean unpairWithRetry (ITestDevice device)
Retries clearing of BT pairing with linear backoff
Returns | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
uploadLogFiles
public static void uploadLogFiles (ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Upload snoop log file for test results
Parameters | |
---|---|
listener |
ITestInvocationListener |
device |
ITestDevice |
type |
String |
iteration |
int |
Throws | |
---|---|
DeviceNotAvailableException |
Interfaces
Classes
- AaptParser
- AbiFormatter
- AbiUtils
- Alarm
- AppVersionFetcher
- ArrayUtil
- BluetoothUtils
- Bugreport
- BuildTestsZipUtils
- BulkEmailer
- ByteArrayList
- CircularAtraceUtil
- CircularByteArray
- ClassPathScanner
- ClassPathScanner.ClassNameFilter
- ClassPathScanner.ExternalClassNameFilter
- CommandResult
- ConditionPriorityBlockingQueue
- ConditionPriorityBlockingQueue.AlwaysMatch
- ConfigCompletor
- DeviceConcurrentUtil
- DeviceConcurrentUtil.ShellCommandCallable
- DeviceRecoveryModeUtil
- DirectedGraph
- EmmaXmlConstants
- EmmaXmlReportParser
- FakeTestsZipFolder
- FileUtil
- FixedByteArrayOutputStream
- GCSBucketUtil
- GCSFileDownloader
- HprofAllocSiteParser
- IEmail.Message
- JUnit4TestFilter
- JUnitXmlParser
- KeyguardControllerState
- ListInstrumentationParser
- ListInstrumentationParser.InstrumentationTarget
- LogcatUpdaterEventParser
- LogcatUpdaterEventParser.AsyncUpdaterEvent
- MetricsXmlParser
- MultiMap
- NullUtil
- Pair
- ProcessInfo
- PropertyChanger
- PsParser
- QuotationAwareTokenizer
- RegexTrie
- RegexTrie.CompPattern
- RunUtil
- RunUtil.RunnableResult
- SerializationUtil
- SimplePerfResult
- SimplePerfStatResultParser
- SimplePerfUtil
- SimpleStats
- SizeLimitedOutputStream
- StreamUtil
- StringEscapeUtils
- SubprocessEventHelper
- SubprocessEventHelper.BaseTestEventInfo
- SubprocessEventHelper.FailedTestEventInfo
- SubprocessEventHelper.InvocationFailedEventInfo
- SubprocessEventHelper.InvocationStartedEventInfo
- SubprocessEventHelper.LogAssociationEventInfo
- SubprocessEventHelper.TestEndedEventInfo
- SubprocessEventHelper.TestLogEventInfo
- SubprocessEventHelper.TestModuleStartedEventInfo
- SubprocessEventHelper.TestRunEndedEventInfo
- SubprocessEventHelper.TestRunFailedEventInfo
- SubprocessEventHelper.TestRunStartedEventInfo
- SubprocessEventHelper.TestStartedEventInfo
- SubprocessTestResultsParser
- SubprocessTestResultsParser.StatusKeys
- SystemUtil
- TableBuilder
- TableFormatter
- TarUtil
- TestFilterHelper
- TestLoader
- TestMapping
- TestMapping.TestInfo
- TestMapping.TestOption
- TimeUtil
- TimeVal
- UniqueMultiMap
- VersionParser
- ZipCompressionStrategy
- ZipUtil
- ZipUtil2
Enums
Exceptions