BluetoothUtils

public class BluetoothUtils
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.BluetoothUtils


デバイスで BluetoothInstrumentation を呼び出すためのユーティリティ関数

デバイス側の BluetoothInstrumentation コードは、AOSP の frameworks/base/core/tests/bluetoothtests にあります。

概要

フィールド

public static final String BTSNOOP_API

public static final String BTSNOOP_CMD

public static final String BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

public static final String GOLD_BTSNOOP_LOG_PATH

public static final String O_BUILD

パブリック コンストラクタ

BluetoothUtils()

パブリック メソッド

static void cleanLogFile(ITestDevice device)

デバイスからスヌープ ログファイルを削除する

static boolean disable(ITestDevice device)

指定したデバイスで Bluetooth を無効にします。

static boolean disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを無効化。

static boolean disableBtsnoopLogging(ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを無効化。

static boolean enable(ITestDevice device)

指定したデバイスで Bluetooth を有効にする

static boolean enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを有効にする

static boolean enableBtsnoopLogging(ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを有効にする

static String getBluetoothMac(ITestDevice device)

指定されたデバイスの BT MAC を取得します。

static getBondedDevices(ITestDevice device)

指定されたデバイスがボンディングしたデバイスの Bluetooth MAC アドレスを返します。

static String getBtSnoopLogFilePath(ITestDevice device)

bt_stack.config ファイルから bt スヌープ ログファイルのパスを取得します。

static String runBluetoothInstrumentation(ITestDevice device, String command)

BT 計測コマンドを実行して出力を返す便利なメソッド

static boolean runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
static boolean toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
static boolean unpairWithRetry(ITestDevice device)

線形バックオフで BT ペアリングの消去を再試行します

static void uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)

テスト結果のスヌープ ログファイルをアップロードします。

フィールド

BTSNOOP_API

public static final String BTSNOOP_API

BTSNOOP_CMD

public static final String BTSNOOP_CMD

BTSNOOP_DISABLE_CMD

public static final String BTSNOOP_DISABLE_CMD

BTSNOOP_ENABLE_CMD

public static final String BTSNOOP_ENABLE_CMD

GOLD_BTSNOOP_LOG_PATH

public static final String GOLD_BTSNOOP_LOG_PATH

O_BUILD

public static final String O_BUILD

パブリック コンストラクタ

BluetoothUtils

public BluetoothUtils ()

パブリック メソッド

cleanLogFile

public static void cleanLogFile (ITestDevice device)

デバイスからスヌープ ログファイルを削除する

パラメータ
device ITestDevice

例外
DeviceNotAvailableException

無効にする

public static boolean disable (ITestDevice device)

指定したデバイスで Bluetooth を無効にする

戻り値
boolean 無効化が成功した場合は true、それ以外の場合は false

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを無効化

パラメータ
sl4aApkFile File: sl4a.apk ファイルの場所(インストールされている場合は null)

戻り値
boolean 成功したかどうか

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

disableBtsnoopLogging

public static boolean disableBtsnoopLogging (ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを無効化

戻り値
boolean 成功したかどうか

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

有効にする

public static boolean enable (ITestDevice device)

指定したデバイスで Bluetooth を有効にする

戻り値
boolean 有効化が成功した場合は true、それ以外の場合は false

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device, 
                File sl4aApkFile)

sl4a 呼び出しによる btsnoop ロギングを有効にする

パラメータ
sl4aApkFile File: sl4a.apk ファイルの場所(インストールされている場合は null)

戻り値
boolean 成功したかどうか

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

enableBtsnoopLogging

public static boolean enableBtsnoopLogging (ITestDevice device)

sl4a 呼び出しによる btsnoop ロギングを有効にする

戻り値
boolean 成功したかどうか

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBluetoothMac

public static String getBluetoothMac (ITestDevice device)

指定されたデバイスの BT MAC を取得します。

戻り値
String BT MAC または見つからない場合は null

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBondedDevices

public static  getBondedDevices (ITestDevice device)

指定されたデバイスがボンディングしたデバイスの Bluetooth MAC アドレスを返します。

戻り値
Bluetooth MAC アドレス

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBtSnoopLogFilePath

public static String getBtSnoopLogFilePath (ITestDevice device)

bt_stack.config ファイルから bt スヌープ ログファイルのパスを取得する

戻り値
String bt_snoop_log のファイル名。見つからない場合は null

例外
DeviceNotAvailableException

runBluetoothInstrumentation

public static String runBluetoothInstrumentation (ITestDevice device, 
                String command)

BT 計測コマンドを実行して出力を返す便利なメソッド

パラメータ
command String: BT 計測に送信されるコマンド文字列。現在サポートされているコマンド: enable、disable、unpairAll、getName、getAddress、getBondedDevices。詳細については、AOSP ソースを参照してください。

戻り値
String BluetoothInstrumentation の出力

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

runBluetoothInstrumentationWithRetry

public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device, 
                String command)

パラメータ
device ITestDevice

command String

戻り値
boolean

例外
DeviceNotAvailableException

toggleBtsnoopLogging

public static boolean toggleBtsnoopLogging (Sl4aClient client, 
                boolean onOff)

パラメータ
client Sl4aClient

onOff boolean

戻り値
boolean

例外
DeviceNotAvailableException

unpairWithRetry

public static boolean unpairWithRetry (ITestDevice device)

線形バックオフで BT ペアリングの消去を再試行

戻り値
boolean

例外
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

uploadLogFiles

public static void uploadLogFiles (ITestInvocationListener listener, 
                ITestDevice device, 
                String type, 
                int iteration)

テスト結果のスヌープ ログファイルをアップロードする

パラメータ
listener ITestInvocationListener

device ITestDevice

type String

iteration int

例外
DeviceNotAvailableException