Mulai tahun 2026, untuk menyelaraskan dengan model pengembangan stabil trunk kami dan memastikan stabilitas platform untuk ekosistem, kami akan memublikasikan kode sumber ke AOSP pada Q2 dan Q4. Untuk membuat dan berkontribusi ke AOSP, gunakan android-latest-release. Cabang manifes android-latest-release akan selalu merujuk ke rilis terbaru yang dikirim ke AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Google menggunakan teknologi AI untuk menerjemahkan konten ke dalam bahasa pilihan Anda. Terjemahan AI mungkin mengandung kesalahan.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Sl4aBluetoothUtil
public
class
Sl4aBluetoothUtil
extends Object
| java.lang.Object
|
| ↳ |
com.android.tradefed.util.Sl4aBluetoothUtil
|
Class utilitas menyediakan operasi Bluetooth di satu atau dua perangkat menggunakan SL4A
Ringkasan
Metode publik |
boolean
|
changeProfileAccessPermission(ITestDevice primary, ITestDevice secondary, Sl4aBluetoothUtil.BluetoothProfile profile, Sl4aBluetoothUtil.BluetoothAccessLevel access)
Mengubah izin akses profil Bluetooth perangkat sekunder di perangkat utama agar perangkat sekunder dapat mengakses perangkat utama pada profil yang diberikan
|
boolean
|
connect(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)
Menghubungkan perangkat utama ke perangkat sekunder pada profil Bluetooth tertentu
|
boolean
|
disable(ITestDevice device)
Nonaktifkan Bluetooth di perangkat target
|
boolean
|
disableBluetoothSnoopLog(ITestDevice device)
Menonaktifkan log pengintaian Bluetooth
|
boolean
|
disconnect(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)
Memutuskan hubungan perangkat utama dari perangkat sekunder
|
boolean
|
enable(ITestDevice device)
Aktifkan Bluetooth di perangkat target
|
boolean
|
enableBluetoothSnoopLog(ITestDevice device)
Aktifkan log pengintaian Bluetooth
|
String
|
getAddress(ITestDevice device)
Mendapatkan Alamat MAC Bluetooth perangkat target
|
Set<String>
|
getBondedDevices(ITestDevice device)
Mendapatkan kumpulan alamat MAC Bluetooth dari perangkat yang terhubung (dipasangkan) di perangkat target
|
boolean
|
pair(ITestDevice primary, ITestDevice secondary)
Menyambungkan perangkat utama ke perangkat sekunder
|
void
|
setBtConnectionTimeout(Duration timeout)
|
void
|
setBtPairTimeout(Duration timeout)
|
boolean
|
setProfilePriority(ITestDevice primary, ITestDevice secondary, Set<Sl4aBluetoothUtil.BluetoothProfile> profiles, Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
Mengubah setelan prioritas profil tertentu di perangkat utama ke perangkat sekunder
|
void
|
startSl4a(ITestDevice device, File sl4aApkFile)
Mulai klien SL4A secara eksplisit dengan perangkat dan file APK SL4A yang diberikan.
|
void
|
stopSl4a()
Hentikan klien SL4A yang sudah dibuka.
|
boolean
|
unpairAll(ITestDevice device)
Membatalkan penyambungan semua perangkat yang disambungkan untuk perangkat saat ini
|
Metode yang dilindungi |
void
|
finalize()
Membersihkan semua koneksi SL4A
|
Konstruktor publik
Sl4aBluetoothUtil
public Sl4aBluetoothUtil ()
Metode publik
changeProfileAccessPermission
public boolean changeProfileAccessPermission (ITestDevice primary,
ITestDevice secondary,
Sl4aBluetoothUtil.BluetoothProfile profile,
Sl4aBluetoothUtil.BluetoothAccessLevel access)
Mengubah izin akses profil Bluetooth perangkat sekunder di perangkat utama agar perangkat sekunder dapat mengakses perangkat utama pada profil yang diberikan
| Parameter |
primary |
ITestDevice: perangkat untuk mengubah izin |
secondary |
ITestDevice: perangkat yang mengakses perangkat utama pada profil tertentu |
profile |
Sl4aBluetoothUtil.BluetoothProfile: Profil Bluetooth yang akan diakses |
access |
Sl4aBluetoothUtil.BluetoothAccessLevel: tingkat akses, lihat BluetoothAccessLevel |
| Hasil |
boolean |
benar jika izin berhasil diubah |
hubungkan
public boolean connect (ITestDevice primary,
ITestDevice secondary,
Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)
Menghubungkan perangkat utama ke perangkat sekunder pada profil Bluetooth tertentu
| Parameter |
primary |
ITestDevice: perangkat yang akan digunakan untuk menghubungkan |
secondary |
ITestDevice: perangkat yang akan dihubungkan |
profiles |
Set: Serangkaian profil Bluetooth harus terhubung |
| Hasil |
boolean |
benar jika koneksi berhasil |
nonaktifkan
public boolean disable (ITestDevice device)
Nonaktifkan Bluetooth di perangkat target
| Parameter |
device |
ITestDevice: perangkat target |
| Hasil |
boolean |
benar jika Bluetooth berhasil dinonaktifkan |
disableBluetoothSnoopLog
public boolean disableBluetoothSnoopLog (ITestDevice device)
Menonaktifkan log pengintaian Bluetooth
| Parameter |
device |
ITestDevice: untuk menonaktifkan log intip |
| Hasil |
boolean |
benar jika berhasil dinonaktifkan |
berhenti hubungkan
public boolean disconnect (ITestDevice primary,
ITestDevice secondary,
Set<Sl4aBluetoothUtil.BluetoothProfile> profiles)
Memutuskan hubungan perangkat utama dari perangkat sekunder
| Parameter |
primary |
ITestDevice: perangkat untuk melakukan operasi pemutusan koneksi |
secondary |
ITestDevice: perangkat yang akan dihentikan koneksinya |
profiles |
Set: Kumpulan profil Bluetooth tertentu harus diputus koneksinya |
| Hasil |
boolean |
benar jika berhasil diputus |
aktifkan
public boolean enable (ITestDevice device)
Aktifkan Bluetooth di perangkat target
| Parameter |
device |
ITestDevice: perangkat target |
| Hasil |
boolean |
benar jika Bluetooth berhasil diaktifkan |
enableBluetoothSnoopLog
public boolean enableBluetoothSnoopLog (ITestDevice device)
Aktifkan log pengintaian Bluetooth
| Parameter |
device |
ITestDevice: untuk mengaktifkan log intip |
| Hasil |
boolean |
benar jika berhasil diaktifkan |
getAddress
public String getAddress (ITestDevice device)
Mendapatkan Alamat MAC Bluetooth perangkat target
| Parameter |
device |
ITestDevice: perangkat target |
| Hasil |
String |
String Alamat MAC |
getBondedDevices
public Set<String> getBondedDevices (ITestDevice device)
Mendapatkan kumpulan alamat MAC Bluetooth dari perangkat yang terhubung (dipasangkan) di perangkat target
| Parameter |
device |
ITestDevice: perangkat target |
| Hasil |
Set<String> |
Setel alamat MAC Bluetooth |
sandingkan
public boolean pair (ITestDevice primary,
ITestDevice secondary)
Menyambungkan perangkat utama ke perangkat sekunder
| Parameter |
primary |
ITestDevice: perangkat yang akan disambungkan |
secondary |
ITestDevice: perangkat yang akan disambungkan |
| Hasil |
boolean |
benar jika pemasangan berhasil |
setBtConnectionTimeout
public void setBtConnectionTimeout (Duration timeout)
| Parameter |
timeout |
Duration |
setBtPairTimeout
public void setBtPairTimeout (Duration timeout)
| Parameter |
timeout |
Duration |
setProfilePriority
public boolean setProfilePriority (ITestDevice primary,
ITestDevice secondary,
Set<Sl4aBluetoothUtil.BluetoothProfile> profiles,
Sl4aBluetoothUtil.BluetoothPriorityLevel priority)
Mengubah setelan prioritas profil tertentu di perangkat utama ke perangkat sekunder
| Parameter |
primary |
ITestDevice: perangkat untuk menetapkan prioritas |
secondary |
ITestDevice: perangkat untuk menetapkan prioritas |
profiles |
Set: Profil Bluetooth untuk mengubah setelan prioritas |
priority |
Sl4aBluetoothUtil.BluetoothPriorityLevel: tingkat prioritas |
| Hasil |
boolean |
true jika berhasil menetapkan prioritas |
startSl4a
public void startSl4a (ITestDevice device,
File sl4aApkFile)
Mulai klien SL4A secara eksplisit dengan perangkat dan file APK SL4A yang diberikan. Biasanya metode ini tidak diperlukan, karena koneksi SL4A akan selalu dibuat sebelum operasi sebenarnya.
| Parameter |
device |
ITestDevice: perangkat yang akan dihubungkan menggunakan SL4A |
sl4aApkFile |
File: APK SL4A opsional yang akan diinstal dan digunakan. |
stopSl4a
public void stopSl4a ()
Hentikan klien SL4A yang sudah dibuka. Pada dasarnya, cara ini memberikan cara untuk membersihkan klien
segera setelah tidak lagi digunakan
unpairAll
public boolean unpairAll (ITestDevice device)
Membatalkan penyambungan semua perangkat yang disambungkan untuk perangkat saat ini
| Parameter |
device |
ITestDevice: Perangkat saat ini untuk melakukan tindakan |
| Hasil |
boolean |
benar jika berhasil membatalkan penyandingan |
Metode yang dilindungi
finalize
protected void finalize ()
Membersihkan semua koneksi SL4A
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 2026-06-22 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 2026-06-22 UTC."],[],[]]