Ab dem 27. März 2025 empfehlen wir, android-latest-release
anstelle von aosp-main
zu verwenden, um AOSP zu erstellen und Beiträge dazu zu leisten. Weitere Informationen finden Sie unter Änderungen am AOSP.
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
BluetoothUtils
public
class
BluetoothUtils
extends Object
java.lang.Object
|
↳ |
com.android.tradefed.util.BluetoothUtils
|
Dienstfunktionen zum Aufrufen von BluetoothInstrumentation auf dem Gerät
Den geräteseitigen BluetoothInstrumentation-Code finden Sie in AOSP unter:
frameworks/base/core/tests/bluetoothtests
Zusammenfassung
Öffentliche Methoden |
static
void
|
cleanLogFile(ITestDevice device)
Snoop-Protokolldatei vom Gerät löschen
|
static
boolean
|
disable(ITestDevice device)
Deaktiviert Bluetooth auf dem angegebenen Gerät
|
static
boolean
|
disableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
BTSnoop-Logging über sl4a-Aufruf deaktivieren
|
static
boolean
|
disableBtsnoopLogging(ITestDevice device)
BTSnoop-Logging über sl4a-Aufruf deaktivieren
|
static
boolean
|
enable(ITestDevice device)
Aktiviert Bluetooth auf dem angegebenen Gerät
|
static
boolean
|
enableBtsnoopLogging(ITestDevice device, File sl4aApkFile)
BTSnoop-Logging über sl4a-Aufruf aktivieren
|
static
boolean
|
enableBtsnoopLogging(ITestDevice device)
BTSnoop-Logging über sl4a-Aufruf aktivieren
|
static
String
|
getBluetoothMac(ITestDevice device)
Ruft die BT-MAC-Adresse des angegebenen Geräts ab
|
static
|
getBondedDevices(ITestDevice device)
Gibt die Bluetooth-MAC-Adressen der Geräte zurück, mit denen das angegebene Gerät gekoppelt ist.
|
static
String
|
getBtSnoopLogFilePath(ITestDevice device)
Pfad zur BT-Snoop-Logdatei aus der Datei „bt_stack.config“ abrufen
|
static
String
|
runBluetoothInstrumentation(ITestDevice device, String command)
Diese praktische Methode dient zum Ausführen eines BT-Instrumentierungsbefehls und zum Zurückgeben der Ausgabe.
|
static
boolean
|
runBluetoothInstrumentationWithRetry(ITestDevice device, String command)
|
static
boolean
|
toggleBtsnoopLogging(Sl4aClient client, boolean onOff)
|
static
boolean
|
unpairWithRetry(ITestDevice device)
Wiederholen des Löschens der BT-Kopplung mit linearem Backoff
|
static
void
|
uploadLogFiles(ITestInvocationListener listener, ITestDevice device, String type, int iteration)
Snoop-Protokolldatei für Testergebnisse hochladen
|
Felder
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
Öffentliche Konstruktoren
BluetoothUtils
public BluetoothUtils ()
Öffentliche Methoden
cleanLogFile
public static void cleanLogFile (ITestDevice device)
Snoop-Protokolldatei vom Gerät löschen
Parameter |
device |
ITestDevice |
Ausgabe |
DeviceNotAvailableException |
|
deaktivieren
public static boolean disable (ITestDevice device)
Deaktiviert Bluetooth auf dem angegebenen Gerät
Returns |
boolean |
„True“, wenn die Deaktivierung erfolgreich war, andernfalls „false“ |
Ausgabe |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device,
File sl4aApkFile)
BTSnoop-Logging über sl4a-Aufruf deaktivieren
Parameter |
sl4aApkFile |
File : Speicherort der Datei „sl4a.apk“, „null“, wenn sie installiert wurde |
Returns |
boolean |
erfolgreich war oder nicht. |
Ausgabe |
DeviceNotAvailableException |
|
disableBtsnoopLogging
public static boolean disableBtsnoopLogging (ITestDevice device)
BTSnoop-Logging über sl4a-Aufruf deaktivieren
Returns |
boolean |
erfolgreich war oder nicht. |
Ausgabe |
DeviceNotAvailableException |
|
Aktivieren
public static boolean enable (ITestDevice device)
Aktiviert Bluetooth auf dem angegebenen Gerät
Returns |
boolean |
„True“, wenn die Aktivierung erfolgreich war, andernfalls „false“ |
Ausgabe |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device,
File sl4aApkFile)
BTSnoop-Logging über sl4a-Aufruf aktivieren
Parameter |
sl4aApkFile |
File : Speicherort der Datei „sl4a.apk“, „null“, wenn sie installiert wurde |
Returns |
boolean |
erfolgreich war oder nicht. |
Ausgabe |
DeviceNotAvailableException |
|
enableBtsnoopLogging
public static boolean enableBtsnoopLogging (ITestDevice device)
BTSnoop-Logging über sl4a-Aufruf aktivieren
Returns |
boolean |
erfolgreich war oder nicht. |
Ausgabe |
DeviceNotAvailableException |
|
getBluetoothMac
public static String getBluetoothMac (ITestDevice device)
Ruft die BT-MAC-Adresse des angegebenen Geräts ab
Returns |
String |
BT-MAC oder „null“, wenn nicht gefunden |
Ausgabe |
DeviceNotAvailableException |
|
getBondedDevices
public static getBondedDevices (ITestDevice device)
Gibt die Bluetooth-MAC-Adressen der Geräte zurück, mit denen das angegebene Gerät gekoppelt ist.
Returns |
|
Bluetooth-MAC-Adressen |
Ausgabe |
DeviceNotAvailableException |
|
getBtSnoopLogFilePath
public static String getBtSnoopLogFilePath (ITestDevice device)
Pfad zur BT-Snoop-Logdatei aus der Datei „bt_stack.config“ abrufen
Returns |
String |
Der Dateiname für „bt_snoop_log“ oder „null“, wenn die Datei nicht gefunden wird
|
Ausgabe |
DeviceNotAvailableException |
|
runBluetoothInstrumentation
public static String runBluetoothInstrumentation (ITestDevice device,
String command)
Diese praktische Methode dient zum Ausführen eines BT-Instrumentierungsbefehls und zum Zurückgeben der Ausgabe.
Parameter |
command |
String : Ein Befehlsstring, der an die BT-Instrumentierung gesendet wird. Derzeit werden folgende Befehle unterstützt: enable, disable, unpairAll, getName, getAddress, getBondedDevices. Weitere Informationen finden Sie in der AOSP-Quelle. |
Returns |
String |
Ausgabe von BluetoothInstrumentation |
Ausgabe |
DeviceNotAvailableException |
|
runBluetoothInstrumentationWithRetry
public static boolean runBluetoothInstrumentationWithRetry (ITestDevice device,
String command)
Parameter |
device |
ITestDevice |
command |
String |
Ausgabe |
DeviceNotAvailableException |
|
toggleBtsnoopLogging
public static boolean toggleBtsnoopLogging (Sl4aClient client,
boolean onOff)
Parameter |
client |
Sl4aClient |
onOff |
boolean |
Ausgabe |
DeviceNotAvailableException |
|
unpairWithRetry
public static boolean unpairWithRetry (ITestDevice device)
Wiederholen des Löschens der BT-Kopplung mit linearem Backoff
Ausgabe |
DeviceNotAvailableException |
|
uploadLogFiles
public static void uploadLogFiles (ITestInvocationListener listener,
ITestDevice device,
String type,
int iteration)
Snoop-Protokolldatei für Testergebnisse hochladen
Parameter |
listener |
ITestInvocationListener |
device |
ITestDevice |
type |
String |
iteration |
int |
Ausgabe |
DeviceNotAvailableException |
|
Alle Inhalte und Codebeispiele auf dieser Seite unterliegen den Lizenzen wie im Abschnitt Inhaltslizenz beschrieben. Java und OpenJDK sind Marken oder eingetragene Marken von Oracle und/oder seinen Tochtergesellschaften.
Zuletzt aktualisiert: 2025-03-26 (UTC).
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Benötigte Informationen nicht gefunden","missingTheInformationINeed","thumb-down"],["Zu umständlich/zu viele Schritte","tooComplicatedTooManySteps","thumb-down"],["Nicht mehr aktuell","outOfDate","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Problem mit Beispielen/Code","samplesCodeIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-03-26 (UTC)."],[],[]]