Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release, bukan aosp-main, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
BluetoothUtils
public
class
BluetoothUtils
extends Object
| java.lang.Object
|
| ↳ |
com.android.tradefed.util.BluetoothUtils
|
Fungsi utilitas untuk memanggil BluetoothInstrumentation di perangkat
Kode BluetoothInstrumentation sisi perangkat dapat ditemukan di AOSP di:
frameworks/base/core/tests/bluetoothtests
Ringkasan
Metode publik |
static
void
|
cleanLogFile(ITestDevice device)
Menghapus file log snoop dari perangkat
|
static
boolean
|
disable(ITestDevice device)
Menonaktifkan bluetooth di perangkat yang ditentukan
|
static
boolean
|
disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
Menonaktifkan logging btsnoop oleh panggilan sl4a
|
static
boolean
|
disableBtsnoopLogging(ITestDevice device)
Menonaktifkan logging btsnoop oleh panggilan sl4a
|
static
boolean
|
enable(ITestDevice device)
Mengaktifkan bluetooth di perangkat tertentu
|
static
boolean
|
enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
Mengaktifkan logging btsnoop dengan panggilan sl4a
|
static
boolean
|
enableBtsnoopLogging(ITestDevice device)
Mengaktifkan logging btsnoop dengan panggilan sl4a
|
static
String
|
getBluetoothMac(ITestDevice device)
Mengambil mac BT perangkat yang ditentukan
|
static
|
getBondedDevices(ITestDevice device)
Menampilkan alamat MAC bluetooth perangkat yang telah disambungkan dengan perangkat tertentu
|
static
String
|
getBtSnoopLogFilePath(ITestDevice device)
Mendapatkan jalur file log bt snoop dari file bt_stack.config
|
static
String
|
runBluetoothInstrumentation(ITestDevice device, String command)
Metode praktis untuk menjalankan perintah instrumentasi BT dan menampilkan output
|
static
boolean
|
runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
|
static
boolean
|
toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
|
static
boolean
|
unpairWithRetry(ITestDevice device)
Mencoba lagi penghapusan penyambungan BT dengan backoff linear
|
static
void
|
uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Mengupload file log snoop untuk hasil pengujian
|
Kolom
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
Konstruktor publik
BluetoothUtils
public BluetoothUtils ()
Metode publik
cleanLogFile
public static void cleanLogFile (ITestDevice device)
Menghapus file log snoop dari perangkat
| Parameter |
device |
ITestDevice |
| Menampilkan |
DeviceNotAvailableException |
|
nonaktifkan
public static boolean disable (ITestDevice device)
Menonaktifkan bluetooth di perangkat yang ditentukan
| Hasil |
boolean |
Benar jika penonaktifan berhasil, salah jika tidak |
| Menampilkan |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device,
File sl4aApkFile)
Menonaktifkan logging btsnoop oleh panggilan sl4a
| Parameter |
sl4aApkFile |
File: Lokasi file sl4a.apk, null jika telah diinstal |
| Hasil |
boolean |
berhasil atau tidak |
| Menampilkan |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device)
Menonaktifkan logging btsnoop oleh panggilan sl4a
| Hasil |
boolean |
berhasil atau tidak |
| Menampilkan |
DeviceNotAvailableException |
|
aktifkan
public static boolean enable (ITestDevice device)
Mengaktifkan bluetooth di perangkat tertentu
| Hasil |
boolean |
Benar jika pengaktifan berhasil, salah jika tidak |
| Menampilkan |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device,
File sl4aApkFile)
Mengaktifkan logging btsnoop dengan panggilan sl4a
| Parameter |
sl4aApkFile |
File: Lokasi file sl4a.apk, null jika telah diinstal |
| Hasil |
boolean |
berhasil atau tidak |
| Menampilkan |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device)
Mengaktifkan logging btsnoop dengan panggilan sl4a
| Hasil |
boolean |
berhasil atau tidak |
| Menampilkan |
DeviceNotAvailableException |
|
getBluetoothMac
public static String getBluetoothMac (ITestDevice device)
Mengambil mac BT perangkat yang ditentukan
| Hasil |
String |
BT mac atau null jika tidak ditemukan |
| Menampilkan |
DeviceNotAvailableException |
|
getBondedDevices
public static getBondedDevices (ITestDevice device)
Menampilkan alamat MAC bluetooth perangkat yang telah disambungkan dengan perangkat tertentu
| Hasil |
|
alamat mac bluetooth |
| Menampilkan |
DeviceNotAvailableException |
|
getBtSnoopLogFilePath
public static String getBtSnoopLogFilePath (ITestDevice device)
Mendapatkan jalur file log bt snoop dari file bt_stack.config
| Hasil |
String |
Nama file untuk bt_snoop_log atau null jika tidak ditemukan
|
| Menampilkan |
DeviceNotAvailableException |
|
runBluetoothInstrumentation
public static String runBluetoothInstrumentation (ITestDevice device,
String command)
Metode praktis untuk menjalankan perintah instrumentasi BT dan menampilkan output
| Parameter |
command |
String: string perintah yang dikirim ke instrumentasi BT, saat ini didukung:
enable, disable, unpairAll, getName, getAddress, getBondedDevices; lihat
sumber AOSP untuk mengetahui detail selengkapnya |
| Hasil |
String |
output BluetoothInstrumentation |
| Menampilkan |
DeviceNotAvailableException |
|
runBluetoothInstrumentationWithRetry
public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device,
String command)
| Parameter |
device |
ITestDevice |
command |
String |
| Menampilkan |
DeviceNotAvailableException |
|
toggleBtsnoopLogging
public static boolean toggleBtsnoopLogging (Sl4aClient client,
boolean onOff)
| Parameter |
client |
Sl4aClient |
onOff |
boolean |
| Menampilkan |
DeviceNotAvailableException |
|
unpairWithRetry
public static boolean unpairWithRetry (ITestDevice device)
Mencoba lagi penghapusan penyambungan BT dengan backoff linear
| Menampilkan |
DeviceNotAvailableException |
|
uploadLogFiles
public static void uploadLogFiles (ITestInvocationListener listener,
ITestDevice device,
String type,
int iteration)
Mengupload file log snoop untuk hasil pengujian
| Parameter |
listener |
ITestInvocationListener |
device |
ITestDevice |
type |
String |
iteration |
int |
| Menampilkan |
DeviceNotAvailableException |
|
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[]]