INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Stellt eine zuverlässige und etwas höhere API für ein ddmlib IDevice
bereit.
Zusammenfassung
Konstanten | |
---|---|
int | UNKNOWN_API_LEVEL Standardwert, wenn API-Level nicht erkannt werden kann |
Öffentliche Methoden | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Überprüfen Sie, ob eine Funktion bei einem minimal unterstützten Level derzeit unterstützt wird oder nicht. |
abstract void | clearLogcat () Löscht alle angesammelten Logcat-Daten. |
abstract void | deleteFile (String deviceFilePath) Hilfsmethode zum Löschen einer Datei oder eines Verzeichnisses auf dem Gerät. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) Hilfsmethode zum Überprüfen, ob das Gerät weich neu gestartet wurde, indem der aktuelle system_server mit dem vorherigen system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Hilfsmethode, um zu überprüfen, ob das Gerät seit der UTC-Zeit seit der Epoche vom Gerät und seiner |
abstract boolean | disableAdbRoot () Deaktiviert Adb-Root. |
abstract boolean | doesFileExist (String deviceFilePath) Hilfsmethode, um festzustellen, ob eine Datei auf dem Gerät vorhanden ist. |
abstract boolean | enableAdbRoot () Aktiviert Adb-Root. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) Hilfsmethode, die einen adb-Befehl als Systembefehl mit einem angegebenen Timeout ausführt. |
abstract String | executeAdbCommand (String... commandArgs) Hilfsmethode, die einen adb-Befehl als Systembefehl ausführt. |
abstract String | executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs) Hilfsmethode, die einen adb-Befehl als Systembefehl mit einem angegebenen Timeout ausführt. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) Hilfsmethode, die einen Fastboot-Befehl als Systembefehl ausführt. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) Hilfsmethode, die einen Fastboot-Befehl als Systembefehl mit einem Standard-Timeout von 2 Minuten ausführt. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) Hilfsmethode, die einen lange laufenden Fastboot-Befehl als Systembefehl ausführt. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Hilfsmethode, die einen lange laufenden Fastboot-Befehl als Systembefehl mit Systemumgebungsvariablen ausführt. |
abstract String | executeShellCommand (String command) Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ausgabe als |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) Führt den angegebenen Adb-Shell-Befehl aus und versucht es mehrmals, wenn der Befehl fehlschlägt. |
abstract CommandResult | executeShellV2Command (String command) Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ergebnisse als |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ergebnisse als |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ergebnisse als |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus. |
abstract CommandResult | fastbootWipePartition (String partition) Hilfsmethode, die eine Partition für das Gerät löscht. |
abstract int | getApiLevel () Rufen Sie die API-Ebene des Geräts ab. |
abstract String | getBasebandVersion () Komfortmethode zum Abrufen der Basisband-(Funk-)Version dieses Geräts. |
abstract Integer | getBattery () Gibt den aktuellen Batteriestand eines Geräts oder Null zurück, wenn der Batteriestand nicht verfügbar ist. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Gibt den booleschen Wert der angegebenen Eigenschaft zurück. |
abstract | getBootHistory () Die Hilfsmethode sammelt die Startverlaufskarte mit Startzeit und Startgrund. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Die Hilfsmethode erfasst die Startverlaufskarte mit der Startzeit und dem Startgrund seit der angegebenen Zeit seit der Epoche vom Gerät und der angegebenen Zeiteinheit. |
abstract String | getBootloaderVersion () Komfortmethode zum Abrufen der Bootloader-Version dieses Geräts. |
abstract String | getBuildAlias () Rufen Sie den Alias des Builds ab, den das Gerät derzeit ausführt. |
abstract String | getBuildFlavor () Rufen Sie die Build-Variante für das Gerät ab. |
abstract String | getBuildId () Rufen Sie den Build ab, den das Gerät derzeit ausführt. |
abstract String | getBuildSigningKeys () Gibt den Schlüsseltyp zurück, der zum Signieren des Geräteabbilds verwendet wird Typischerweise können Android-Geräte mit Testschlüsseln (wie in AOSP) oder Freigabeschlüsseln (kontrolliert durch einzelne Gerätehersteller) signiert werden. |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Gibt einen zwischengespeicherten |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Gibt einen zwischengespeicherten |
abstract String[] | getChildren (String deviceFilePath) Alternative zur Verwendung |
abstract AbstractConnection | getConnection () Gibt die dem Gerät zugeordnete Verbindung zurück. |
abstract String | getDeviceClass () Rufen Sie die Geräteklasse ab. |
abstract long | getDeviceDate () Gibt das Datum des Geräts in Millisekunden seit der Epoche zurück. |
abstract DeviceDescriptor | getDeviceDescriptor () Geben Sie einen |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Geben Sie einen |
abstract TestDeviceState | getDeviceState () Rufen Sie den Zustand des Geräts ab. |
abstract long | getDeviceTimeOffset (Date date) Helfer, um die Zeitdifferenz zwischen dem Gerät und einem bestimmten |
abstract InputStreamSource | getEmulatorOutput () Holen Sie sich den Stream von Emulator stdout und stderr |
abstract long | getExternalStoreFreeSpace () Hilfsmethode zum Bestimmen des freien Speicherplatzes auf dem externen Speicher des Geräts. |
abstract String | getFastbootProductType () Komfortmethode zum Abrufen des Produkttyps dieses Geräts im Fastboot-Modus. |
abstract String | getFastbootProductVariant () Komfortmethode zum Abrufen des Produkttyps dieses Geräts im Fastboot-Modus. |
abstract String | getFastbootSerialNumber () Gibt die Fastboot-Modus-Seriennummer zurück. |
abstract String | getFastbootVariable (String variableName) Rufen Sie den angegebenen Fastboot-Variablenwert vom Gerät ab. |
abstract IFileEntry | getFileEntry (String path) Rufen Sie einen Verweis auf eine Remote-Datei auf dem Gerät ab. |
abstract IDevice | getIDevice () Gibt eine Referenz auf das zugeordnete ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Gibt den ganzzahligen Wert der angegebenen Eigenschaft vom Gerät zurück. |
abstract long | getLastExpectedRebootTimeMillis () Gibt zurück, wann Tradefed-APIs in Millisekunden seit EPOCH zuletzt einen Neustart ausgelöst haben, wie von |
abstract int | getLaunchApiLevel () Holen Sie sich das erste gestartete API-Level des Geräts. |
abstract InputStreamSource | getLogcat () Erfasst einen Snapshot-Stream der Logcat-Daten. |
abstract InputStreamSource | getLogcat (int maxBytes) Erfasst einen Snapshot-Stream der letzten |
abstract InputStreamSource | getLogcatDump () Holen Sie sich einen Speicherauszug des aktuellen Logcat für das Gerät. |
abstract InputStreamSource | getLogcatSince (long date) Ruft einen Snapshot-Stream erfasster Logcat-Daten ab dem angegebenen Datum ab. |
abstract String | getMountPoint (String mountName) Gibt einen Einhängepunkt zurück. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Gibt eine |
abstract | getMountPointInfo () Gibt eine geparste Version der Informationen in /proc/mounts auf dem Gerät zurück |
abstract long | getPartitionFreeSpace (String partition) Hilfsmethode zur Bestimmung des freien Speicherplatzes auf der Gerätepartition. |
abstract ProcessInfo | getProcessByName (String processName) Die Hilfsmethode führt die Befehle „pidof“ und „stat“ aus und gibt das |
abstract String | getProcessPid (String process) Gibt die PID des Dienstes oder null zurück, wenn etwas schief gelaufen ist. |
abstract String | getProductType () Praktische Methode, um den Produkttyp dieses Geräts zu erhalten. |
abstract String | getProductVariant () Komfortmethode, um die Produktvariante dieses Geräts zu erhalten. |
abstract String | getProperty (String name) Rufen Sie den angegebenen Eigenschaftswert vom Gerät ab. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () Rufen Sie den aktuellen Wiederherstellungsmodus ab, der für das Gerät verwendet wird. |
abstract String | getSerialNumber () Bequeme Methode, um die Seriennummer dieses Geräts zu erhalten. |
abstract | getTombstones () Rufen Sie die Tombstone-Liste von den Geräten ab und senden Sie sie zurück. |
abstract long | getTotalMemory () Gibt die gesamte physische Speichergröße in Bytes oder -1 im Falle eines internen Fehlers zurück |
abstract boolean | getUseFastbootErase () Finden Sie heraus, ob Fastboot Erase oder Fastboot Format verwendet werden soll, um eine Partition auf dem Gerät zu löschen. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () Überprüfen Sie, ob die Plattform auf dem Gerät die App-Aufzählung unterstützt |
abstract boolean | isBypassLowTargetSdkBlockSupported () Überprüfen Sie, ob die Plattform auf dem Gerät die Umgehung des Low-Target-SDK-Blocks bei App-Installationen unterstützt |
abstract boolean | isDeviceEncrypted () Gibt zurück, ob das Gerät verschlüsselt ist. |
abstract boolean | isDirectory (String deviceFilePath) Geben Sie „True“ zurück, wenn der Pfad auf dem Gerät ein Verzeichnis ist, andernfalls „False“. |
abstract boolean | isEncryptionSupported () Gibt zurück, ob die Verschlüsselung auf dem Gerät unterstützt wird. |
abstract boolean | isExecutable (String fullPath) Gibt „True“ zurück, wenn der Dateipfad auf dem Gerät eine ausführbare Datei ist, andernfalls „False“. |
abstract boolean | isHeadless () Geben Sie „true“ zurück, wenn das Gerät kopflos ist (kein Bildschirm), andernfalls „false“. |
abstract boolean | isRuntimePermissionSupported () Überprüfen Sie, ob die Plattform auf dem Gerät die Gewährung von Laufzeitberechtigungen unterstützt |
abstract boolean | isStateBootloaderOrFastbootd () Gibt true zurück, wenn sich das Gerät in |
abstract boolean | logAnrs ( ITestLogger logger) Sammelt und protokolliert ANRs vom Gerät. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Protokollieren Sie eine Nachricht im Logcat des Geräts. |
abstract void | nonBlockingReboot () Gibt einen Befehl zum Neustart des Geräts aus und kehrt zurück, wenn der Befehl abgeschlossen ist und das Gerät für adb nicht mehr sichtbar ist. |
abstract void | postBootSetup () Führen Sie Anweisungen zum Konfigurieren des Geräts aus, um dies nach jedem Start zu testen. |
default void | postInvocationTearDown () Diese Methode ist veraltet. Verwenden Sie stattdessen |
abstract void | postInvocationTearDown (Throwable invocationException) Zusätzliche Schritte für die gerätespezifische erforderliche Bereinigung, die nach Abschluss des Aufrufs ausgeführt werden. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) Zusätzliche Schritte für die gerätespezifische erforderliche Einrichtung, die vor dem Aufruffluss auf dem Gerät ausgeführt werden. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Verzeichnisinhalte rekursiv vom Gerät abrufen. |
abstract File | pullFile (String remoteFilePath, int userId) Ruft eine Datei vom Gerät ab, speichert sie in einem lokalen temporären |
abstract File | pullFile (String remoteFilePath) Ruft eine Datei vom Gerät ab, speichert sie in einem lokalen temporären |
abstract boolean | pullFile (String remoteFilePath, File localFile) Ruft eine Datei vom Gerät ab. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Ruft eine Datei vom Gerät ab. |
abstract String | pullFileContents (String remoteFilePath) Ruft eine Datei vom Gerät ab und gibt den Inhalt zurück. |
abstract File | pullFileFromExternal (String remoteFilePath) Eine bequeme Methode, um eine Datei aus dem externen Speicher des Geräts abzurufen, sie in einem lokalen temporären |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) Verzeichnisinhalte rekursiv auf das Gerät übertragen und dabei einige gefilterte Verzeichnisse ausschließen. |
abstract boolean | pushDir (File localDir, String deviceFilePath) Verzeichnisinhalte rekursiv auf das Gerät übertragen. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) Variante von |
abstract boolean | pushFile (File localFile, String deviceFilePath) Drücken Sie eine Datei auf das Gerät. |
abstract boolean | pushString (String contents, String deviceFilePath) Push-Datei, die aus einer Zeichenfolge erstellt wurde, an das Gerät |
abstract void | reboot () Startet das Gerät im Adb-Modus neu. |
abstract void | reboot (String reason) Startet das Gerät im ADB-Modus neu, wobei |
abstract void | rebootIntoBootloader () Startet das Gerät im Bootloader-Modus neu. |
abstract void | rebootIntoFastbootd () Startet das Gerät im Fastbootd-Modus neu. |
abstract void | rebootIntoRecovery () Startet das Gerät im ADB-Wiederherstellungsmodus neu. |
abstract void | rebootIntoSideload (boolean autoReboot) Startet das Gerät im ADB-Sideload-Modus neu (beachten Sie, dass dies ein spezieller Modus in der Wiederherstellung ist) Blockiert, bis das Gerät in den Sideload-Modus wechselt |
abstract void | rebootIntoSideload () Startet das Gerät im ADB-Sideload-Modus neu (beachten Sie, dass dies ein spezieller Modus in der Wiederherstellung ist) Blockiert, bis das Gerät in den Sideload-Modus wechselt |
abstract void | rebootUntilOnline () Eine Alternative zu |
abstract void | rebootUntilOnline (String reason) Eine Alternative zu |
abstract void | rebootUserspace () Startet nur den Userspace-Teil des Geräts neu. |
abstract void | rebootUserspaceUntilOnline () Eine Alternative zu |
abstract void | remountSystemWritable () Machen Sie die Systempartition auf dem Gerät beschreibbar. |
abstract void | remountVendorWritable () Machen Sie die Herstellerpartition auf dem Gerät beschreibbar. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) Praktische Methode zum Ausführen |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) Führt Instrumentierungstests durch und bietet Gerätewiederherstellung. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) Identisch mit |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Entspricht |
abstract void | setDate (Date date) Stellt das Datum auf dem Gerät ein Hinweis: Zum Einstellen des Datums auf dem Gerät ist root erforderlich |
abstract void | setOptions ( TestDeviceOptions options) Legen Sie die |
abstract boolean | setProperty (String propKey, String propValue) Legt den angegebenen Eigenschaftswert auf dem Gerät fest. |
abstract void | setRecovery ( IDeviceRecovery recovery) Legen Sie die für dieses Gerät zu verwendende |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) Legen Sie den aktuellen Wiederherstellungsmodus fest, der für das Gerät verwendet werden soll. |
abstract void | setUseFastbootErase (boolean useFastbootErase) Legen Sie fest, ob Fastboot Erase oder Fastboot Format verwendet werden soll, um eine Partition auf dem Gerät zu löschen. |
abstract void | startLogcat () Starten Sie die Erfassung der Logcat-Ausgabe vom Gerät im Hintergrund. |
abstract void | stopEmulatorOutput () Schließen und löschen Sie die Emulatorausgabe. |
abstract void | stopLogcat () Beenden Sie die Erfassung der Logcat-Ausgabe vom Gerät und verwerfen Sie die aktuell gespeicherten Logcat-Daten. |
abstract String | switchToAdbTcp () Schalten Sie das Gerät in den Adb-over-TCP-Modus. |
abstract boolean | switchToAdbUsb () Schalten Sie das Gerät in den ADB-über-USB-Modus. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) Synchronisiert inkrementell den Inhalt eines lokalen Dateiverzeichnisses mit dem Gerät. |
abstract boolean | unlockDevice () Entsperrt das Gerät, wenn sich das Gerät in einem verschlüsselten Zustand befindet. |
abstract boolean | waitForBootComplete (long timeOut) Blockiert, bis das Boot-Complete-Flag des Geräts gesetzt ist. |
abstract boolean | waitForDeviceAvailable () Wartet, bis das Gerät reagiert und zum Testen verfügbar ist. |
abstract boolean | waitForDeviceAvailable (long waitTime) Wartet, bis das Gerät reagiert und zum Testen verfügbar ist. |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) Wartet, bis das Gerät reagiert und verfügbar ist, ohne den Wiederherstellungspfad zu berücksichtigen. |
abstract void | waitForDeviceBootloader () Blockiert, bis das Gerät per Fastboot sichtbar ist. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Blockiert, dass sich das Gerät im Zustand „adb recovery“ befindet (beachten Sie, dass sich dies von |
abstract boolean | waitForDeviceInSideload (long waitTime) Blockiert, damit sich das Gerät im Zustand „adb sideload“ befindet |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Blöcke für das Gerät sind nicht verfügbar, dh fehlen in adb |
abstract void | waitForDeviceOnline () Blockiert, bis das Gerät über adb sichtbar ist. |
abstract void | waitForDeviceOnline (long waitTime) Blockiert, bis das Gerät über adb sichtbar ist. |
abstract boolean | waitForDeviceShell (long waitTime) Wartet darauf, dass das Gerät auf einen einfachen Adb-Shell-Befehl reagiert. |
Konstanten
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
Standardwert, wenn API-Level nicht erkannt werden kann
Konstanter Wert: -1 (0xffffffff)
Öffentliche Methoden
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Überprüfen Sie, ob eine Funktion bei einem minimal unterstützten Level derzeit unterstützt wird oder nicht. Diese Methode berücksichtigt noch unveröffentlichte Funktionen, bevor die API-Ebene angehoben wird.
Parameter | |
---|---|
strictMinLevel | int : Die strenge minimal mögliche Ebene, die die Funktion unterstützt. |
Kehrt zurück | |
---|---|
boolean | True, wenn die Ebene unterstützt wird. Sonst falsch. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
Löscht alle angesammelten Logcat-Daten.
Dies ist nützlich, wenn Sie sicherstellen möchtenITestDevice#getLogcat()
nur Protokolldaten zurückgibt, die nach einem bestimmten Punkt erstellt wurden (z. B. nach dem Flashen eines neuen Geräteaufbaus usw.). Datei löschen
public abstract void deleteFile (String deviceFilePath)
Hilfsmethode zum Löschen einer Datei oder eines Verzeichnisses auf dem Gerät.
Parameter | |
---|---|
deviceFilePath | String : Der absolute Pfad der Datei auf dem Gerät. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Hilfsmethode zum Überprüfen, ob das Gerät weich neu gestartet wurde, indem der aktuelle system_server mit dem vorherigen system_server ProcessInfo
verglichen wird. Verwenden Sie getProcessByName(String)
, um ProcessInfo
abzurufen.
Parameter | |
---|---|
prevSystemServerProcess | ProcessInfo : der vorherige system_server-Prozess ProcessInfo . |
Kehrt zurück | |
---|---|
boolean | true , wenn das Gerät weich neu gestartet wurde |
Wirft | |
---|---|
| wenn das Gerät einen ungewöhnlichen Startgrund hat |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Hilfsmethode, um zu überprüfen, ob das Gerät seit der UTC-Zeit seit der Epoche vom Gerät und seiner ERROR(/TimeUnit)
neu gestartet wurde. Sanfter Neustart bezieht sich auf system_server, der außerhalb eines harten Geräteneustarts neu gestartet wurde (z. B.: angeforderter Neustart). Die aktuelle Device utcEpochTime in Millisekunden kann mit der Methode getDeviceDate()
ermittelt werden.
Parameter | |
---|---|
utcEpochTime | long : die Gerätezeit in Sekunden seit der Epoche. |
timeUnit | TimeUnit : die Zeiteinheit TimeUnit für die gegebene utcEpochTime. |
Kehrt zurück | |
---|---|
boolean | true , wenn das Gerät weich neu gestartet wurde |
Wirft | |
---|---|
| wenn das Gerät einen ungewöhnlichen Startgrund hat |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
AdbRoot deaktivieren
public abstract boolean disableAdbRoot ()
Deaktiviert Adb-Root.
Das Deaktivieren von adb root kann dazu führen, dass das Gerät von adb getrennt wird. Diese Methode blockiert, bis das Gerät verfügbar ist.Kehrt zurück | |
---|---|
boolean | true , wenn erfolgreich. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Hilfsmethode, um festzustellen, ob eine Datei auf dem Gerät vorhanden ist.
Parameter | |
---|---|
deviceFilePath | String : Der absolute Pfad der Datei auf dem zu prüfenden Gerät |
Kehrt zurück | |
---|---|
boolean | true , wenn die Datei existiert, andernfalls false . |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
Aktiviert Adb-Root. Wenn die Einstellung „enable-root“ „false“ ist, wird eine Nachricht protokolliert und zurückgegeben, ohne root zu aktivieren.
Das Aktivieren von adb root kann dazu führen, dass das Gerät von adb getrennt wird. Diese Methode blockiert, bis das Gerät verfügbar ist.Kehrt zurück | |
---|---|
boolean | true , wenn erfolgreich. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Hilfsmethode, die einen adb-Befehl als Systembefehl mit einem angegebenen Timeout ausführt.
Wenn möglich, sollte stattdessen executeShellCommand(String)
verwendet werden, da diese Methode eine bessere Fehlererkennung und Leistung bietet.
Parameter | |
---|---|
timeout | long : Die Zeit in Millisekunden, bevor das Gerät als nicht reagierend betrachtet wird, 0L für kein Timeout |
commandArgs | String : der adb-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
String | die Standardausgabe vom Befehl. null , wenn der Befehl nicht ausgeführt werden konnte. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Hilfsmethode, die einen adb-Befehl als Systembefehl ausführt.
Wenn möglich, sollte stattdessenexecuteShellCommand(String)
verwendet werden, da diese Methode eine bessere Fehlererkennung und Leistung bietet.Parameter | |
---|---|
commandArgs | String : der adb-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
String | die Standardausgabe vom Befehl. null , wenn der Befehl nicht ausgeführt werden konnte. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenAdbCommand
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
Hilfsmethode, die einen adb-Befehl als Systembefehl mit einem angegebenen Timeout ausführt.
Wenn möglich, sollte stattdessen executeShellCommand(String)
verwendet werden, da diese Methode eine bessere Fehlererkennung und Leistung bietet.
Parameter | |
---|---|
timeout | long : Die Zeit in Millisekunden, bevor das Gerät als nicht reagierend betrachtet wird, 0L für kein Timeout |
envMap | |
commandArgs | String : der adb-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
String | die Standardausgabe vom Befehl. null , wenn der Befehl nicht ausgeführt werden konnte. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
Hilfsmethode, die einen Fastboot-Befehl als Systembefehl ausführt.
Wird voraussichtlich verwendet, wenn sich das Gerät bereits im Fastboot-Modus befindet.Parameter | |
---|---|
timeout | long : die Zeit in Millisekunden, bevor der Befehl abläuft |
commandArgs | String : der Fastboot-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
CommandResult | das CommandResult, das die Ausgabe des Befehls enthält |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenFastbootCommand
public abstract CommandResult executeFastbootCommand (String... commandArgs)
Hilfsmethode, die einen Fastboot-Befehl als Systembefehl mit einem Standard-Timeout von 2 Minuten ausführt.
Wird voraussichtlich verwendet, wenn sich das Gerät bereits im Fastboot-Modus befindet.
Parameter | |
---|---|
commandArgs | String : der Fastboot-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
CommandResult | das CommandResult, das die Ausgabe des Befehls enthält |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Hilfsmethode, die einen lange laufenden Fastboot-Befehl als Systembefehl ausführt.
Identisch mitexecuteFastbootCommand(String)
außer dass ein längeres Timeout verwendet wird.Parameter | |
---|---|
commandArgs | String : der Fastboot-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
CommandResult | das CommandResult, das die Ausgabe des Befehls enthält |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Hilfsmethode, die einen lange laufenden Fastboot-Befehl als Systembefehl mit Systemumgebungsvariablen ausführt.
Identisch mit executeFastbootCommand(String)
außer dass ein längeres Timeout verwendet wird.
Parameter | |
---|---|
envVarMap | |
commandArgs | String : der Fastboot-Befehl und die auszuführenden Argumente |
Kehrt zurück | |
---|---|
CommandResult | das CommandResult, das die Ausgabe des Befehls enthält |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
ShellCommand ausführen
public abstract String executeShellCommand (String command)
Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ausgabe als ERROR(/String)
zurückgibt.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
Kehrt zurück | |
---|---|
String | die Shell-Ausgabe |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
ShellCommand ausführen
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
receiver | IShellOutputReceiver : der IShellOutputReceiver , an den die Shell-Ausgabe geleitet werden soll. |
maxTimeToOutputShellResponse | long : die maximale Zeitspanne, während der der Befehl keine Antwort ausgeben darf; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : die maximale Anzahl von Wiederholungen des Befehls, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts ohne Erfolg durchgeführt werden. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
ShellCommand ausführen
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
receiver | IShellOutputReceiver : der IShellOutputReceiver , an den die Shell-Ausgabe geleitet werden soll. |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für den Abschluss des Befehls; Einheit wie in timeUnit angegeben |
maxTimeToOutputShellResponse | long : die maximale Zeitspanne, während der der Befehl keine Antwort ausgeben darf; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : die maximale Anzahl von Wiederholungen des Befehls, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts ohne Erfolg durchgeführt werden. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
ShellCommand ausführen
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
Führt den angegebenen Adb-Shell-Befehl aus und versucht es mehrmals, wenn der Befehl fehlschlägt.
Eine einfachere Form vonexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
mit Standardwerten.Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
receiver | IShellOutputReceiver : der IShellOutputReceiver , an den die Shell-Ausgabe geleitet werden soll. |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command)
Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ergebnisse als CommandResult
zurückgibt, das ordnungsgemäß mit der Befehlsstatusausgabe, stdout und stderr gefüllt ist.
Parameter | |
---|---|
command | String : Der Befehl, der ausgeführt werden soll. |
Kehrt zurück | |
---|---|
CommandResult | Das Ergebnis in CommandResult . |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ergebnisse als CommandResult
zurückgibt, das ordnungsgemäß mit der Befehlsstatusausgabe und stderr gefüllt ist. stdout wird an den angegebenen Stream geleitet.
Parameter | |
---|---|
command | String : Der Befehl, der ausgeführt werden soll. |
pipeToOutput | OutputStream : ERROR(/OutputStream) wo die Standardausgabe umgeleitet wird, oder null. |
Kehrt zurück | |
---|---|
CommandResult | Das Ergebnis in CommandResult . |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
Hilfsmethode, die einen Adb-Shell-Befehl ausführt und die Ergebnisse als CommandResult
zurückgibt, das ordnungsgemäß mit der Befehlsstatusausgabe, stdout und stderr gefüllt ist.
Parameter | |
---|---|
command | String : Der Befehl, der ausgeführt werden soll. |
pipeAsInput | File : Ein ERROR(/File) , der als Eingabe an den Befehl weitergeleitet wird, oder null. |
Kehrt zurück | |
---|---|
CommandResult | Das Ergebnis in CommandResult . |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für den Abschluss des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : die maximale Anzahl von Wiederholungen des Befehls, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts ohne Erfolg durchgeführt werden. |
Kehrt zurück | |
---|---|
CommandResult |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
Siehe auch:
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für den Abschluss des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
Kehrt zurück | |
---|---|
CommandResult |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
Siehe auch:
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
pipeAsInput | File : Ein ERROR(/File) , der als Eingabe an den Befehl weitergeleitet wird, oder null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) wo die Standardausgabe umgeleitet wird, oder null. |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für den Abschluss des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : die maximale Anzahl von Wiederholungen des Befehls, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts ohne Erfolg durchgeführt werden. |
Kehrt zurück | |
---|---|
CommandResult |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
Siehe auch:
AusführenShellV2Befehl
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Führt einen Adb-Shell-Befehl mit weiteren Parametern zur Steuerung des Befehlsverhaltens aus.
Parameter | |
---|---|
command | String : der auszuführende Adb-Shell-Befehl |
pipeAsInput | File : Ein ERROR(/File) , der als Eingabe an den Befehl weitergeleitet wird, oder null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) wo die Standardausgabe umgeleitet wird, oder null. |
pipeToError | OutputStream : ERROR(/OutputStream) , wo der Standardfehler umgeleitet wird, oder null. |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für den Abschluss des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : die maximale Anzahl von Wiederholungen des Befehls, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts ohne Erfolg durchgeführt werden. |
Kehrt zurück | |
---|---|
CommandResult |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
Siehe auch:
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
Hilfsmethode, die eine Partition für das Gerät löscht.
WenngetUseFastbootErase()
true
ist, wird Fastboot Erase verwendet, um die Partition zu löschen. Das Gerät muss dann beim nächsten Start des Geräts ein Dateisystem erstellen. Andernfalls wird das Fastboot-Format verwendet, das ein neues Dateisystem auf dem Gerät erstellt. Wird voraussichtlich verwendet, wenn sich das Gerät bereits im Fastboot-Modus befindet.Parameter | |
---|---|
partition | String : die zu löschende Partition |
Kehrt zurück | |
---|---|
CommandResult | das CommandResult, das die Ausgabe des Befehls enthält |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
getApiLevel
public abstract int getApiLevel ()
Rufen Sie die API-Ebene des Geräts ab. Standardmäßig UNKNOWN_API_LEVEL
.
Kehrt zurück | |
---|---|
int | eine Ganzzahl, die das API-Level des Geräts angibt |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
Komfortmethode zum Abrufen der Basisband-(Funk-)Version dieses Geräts. Das Abrufen der Radioversion ist gerätespezifisch, sodass möglicherweise nicht für alle Geräte die richtigen Informationen zurückgegeben werden. Diese Methode stützt sich auf die Eigenschaft gsm.version.baseband, um die richtigen Versionsinformationen zurückzugeben. Dies ist für einige CDMA-Geräte nicht korrekt und die hier zurückgegebene Version stimmt möglicherweise nicht mit der von Fastboot gemeldeten Version überein und gibt möglicherweise nicht die Version für das CDMA-Radio zurück. TL;DR Diese Methode meldet nur dann die genaue Version, wenn die Eigenschaft gsm.version.baseband mit der von fastboot getvar version-baseband
zurückgegebenen Version identisch ist.
Kehrt zurück | |
---|---|
String | die ERROR(/String) Basisbandversion oder null , wenn sie nicht ermittelt werden kann (Gerät hat kein Funkgerät oder Versionsstring kann nicht gelesen werden) |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung mit dem Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
Batterie erhalten
public abstract Integer getBattery ()
Gibt den aktuellen Batteriestand eines Geräts oder Null zurück, wenn der Batteriestand nicht verfügbar ist.
Kehrt zurück | |
---|---|
Integer |
getBooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
Gibt den booleschen Wert der angegebenen Eigenschaft zurück.
Parameter | |
---|---|
name | String : der Eigenschaftsname |
defaultValue | boolean : Standardwert, der zurückgegeben wird, wenn die Eigenschaft leer ist oder nicht existiert. |
Kehrt zurück | |
---|---|
boolean | true wenn die Eigenschaft den Wert "1" , "y" , "yes" , "on" oder "true" hat, false , wenn die Eigenschaft den Wert "0" , "n" , "no" , "off" hat, "false" oder andernfalls defaultValue . |
Wirft | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
Die Hilfsmethode sammelt die Startverlaufskarte mit Startzeit und Startgrund.
Kehrt zurück | |
---|---|
Karte der Startzeit (UTC-Zeit in Sekunden seit Epoche) und Startgrund |
Wirft | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Die Hilfsmethode erfasst die Startverlaufskarte mit der Startzeit und dem Startgrund seit der angegebenen Zeit seit der Epoche vom Gerät und der angegebenen Zeiteinheit. Die aktuelle Device utcEpochTime in Millisekunden kann mit der Methode getDeviceDate()
ermittelt werden.
Parameter | |
---|---|
utcEpochTime | long : die Gerätezeit seit Epoch. |
timeUnit | TimeUnit : die Zeiteinheit TimeUnit . |
Kehrt zurück | |
---|---|
Karte der Startzeit (UTC-Zeit in Sekunden seit Epoche) und Startgrund |
Wirft | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
Komfortmethode zum Abrufen der Bootloader-Version dieses Geräts.
Versucht, die Bootloader-Version aus dem aktuellen Zustand des Geräts abzurufen. (d. h. wenn sich das Gerät im Fastboot-Modus befindet, wird es versuchen, die Version von Fastboot abzurufen)Kehrt zurück | |
---|---|
String | die ERROR(/String) Bootloader-Version oder null , wenn sie nicht gefunden werden kann |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
getBuildAlias
public abstract String getBuildAlias ()
Rufen Sie den Alias des Builds ab, den das Gerät derzeit ausführt.
Der Build-Alias ist normalerweise eine besser lesbare Zeichenfolge als die Build-ID (normalerweise eine Zahl für Nexus-Builds). Beispielsweise hat die endgültige Version von Android 4.2 den Build-Alias JDQ39 und die Build-ID 573038
Kehrt zurück | |
---|---|
String | den Build-Alias oder greifen Sie auf die Build-ID zurück, wenn sie nicht abgerufen werden konnte |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
Rufen Sie die Build-Variante für das Gerät ab.
Kehrt zurück | |
---|---|
String | die Build-Variante oder null, wenn sie nicht abgerufen werden konnte |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Rufen Sie den Build ab, den das Gerät derzeit ausführt.
Kehrt zurück | |
---|---|
String | die Build-ID oder IBuildInfo#UNKNOWN_BUILD_ID , wenn sie nicht abgerufen werden konnte |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
Gibt den Schlüsseltyp zurück, der zum Signieren des Geräteabbilds verwendet wird
Typischerweise können Android-Geräte mit Testschlüsseln (wie in AOSP) oder Freigabeschlüsseln (kontrolliert durch einzelne Gerätehersteller) signiert werden.
Kehrt zurück | |
---|---|
String | Der Signaturschlüssel, falls gefunden, andernfalls null. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Gibt einen zwischengespeicherten DeviceDescriptor
zurück, wenn das Gerät zugewiesen ist, ansonsten den aktuellen DeviceDescriptor
.
Kehrt zurück | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Gibt einen zwischengespeicherten DeviceDescriptor
zurück, wenn das Gerät zugewiesen ist, ansonsten den aktuellen DeviceDescriptor
.
Parameter | |
---|---|
shortDescriptor | boolean : Ob der Deskriptor auf das Nötigste beschränkt werden soll oder nicht |
Kehrt zurück | |
---|---|
DeviceDescriptor |
Kinder bekommen
public abstract String[] getChildren (String deviceFilePath)
Alternative zur Verwendung IFileEntry
, die aufgrund von Berechtigungen manchmal nicht funktioniert.
Parameter | |
---|---|
deviceFilePath | String : ist der Pfad auf dem Gerät, wo die Suche durchgeführt werden soll |
Kehrt zurück | |
---|---|
String[] | String-Array, das alle Dateien in einem Pfad auf dem Gerät enthält. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getConnection
public abstract AbstractConnection getConnection ()
Gibt die dem Gerät zugeordnete Verbindung zurück.
Kehrt zurück | |
---|---|
AbstractConnection |
getDeviceClass
public abstract String getDeviceClass ()
Rufen Sie die Geräteklasse ab.
Kehrt zurück | |
---|---|
String | die Geräteklasse ERROR(/String) . |
getDeviceDate
public abstract long getDeviceDate ()
Gibt das Datum des Geräts in Millisekunden seit der Epoche zurück.
Kehrt zurück | |
---|---|
long | das Datum des Geräts im Epochenformat. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Geben Sie einen DeviceDescriptor
aus den Geräteinformationen zurück, um Informationen darüber zu erhalten, ohne das eigentliche Geräteobjekt zu übergeben.
Kehrt zurück | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Geben Sie einen DeviceDescriptor
aus den Geräteinformationen zurück, um Informationen darüber zu erhalten, ohne das eigentliche Geräteobjekt zu übergeben.
Parameter | |
---|---|
shortDescriptor | boolean : Ob der Deskriptor auf das Nötigste beschränkt werden soll oder nicht |
Kehrt zurück | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Rufen Sie den Zustand des Geräts ab.
Kehrt zurück | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Helfer, um die Zeitdifferenz zwischen dem Gerät und einem bestimmten ERROR(/Date)
zu erhalten. Epoch-Zeit intern verwenden.
Parameter | |
---|---|
date | Date |
Kehrt zurück | |
---|---|
long | die Differenz in Millisekunden |
Wirft | |
---|---|
DeviceNotAvailableException |
getEmulatorAusgabe
public abstract InputStreamSource getEmulatorOutput ()
Holen Sie sich den Stream von Emulator stdout und stderr
Kehrt zurück | |
---|---|
InputStreamSource | Emulatorausgabe |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Hilfsmethode zum Bestimmen des freien Speicherplatzes auf dem externen Speicher des Geräts.
Kehrt zurück | |
---|---|
long | die Menge an freiem Speicherplatz in KB |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
getFastbootProductType
public abstract String getFastbootProductType ()
Komfortmethode zum Abrufen des Produkttyps dieses Geräts im Fastboot-Modus.
Diese Methode sollte nur verwendet werden, wenn das Gerät im Fastboot sein soll. Dies ist in diesem Fall eine etwas sicherere Variante als die generische MethodegetProductType()
, da ITestDevice weiß, dass das Gerät in den Fastboot-Modus versetzt werden muss, wenn sich das Gerät in einem falschen Zustand befindet oder nicht reagiert.Kehrt zurück | |
---|---|
String | der Name des Produkttyps ERROR(/String) oder null , wenn er nicht bestimmt werden kann |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
Komfortmethode zum Abrufen des Produkttyps dieses Geräts im Fastboot-Modus.
Diese Methode sollte nur verwendet werden, wenn das Gerät im Fastboot sein soll. Dies ist in diesem Fall eine etwas sicherere Variante als die generische MethodegetProductType()
, da ITestDevice weiß, dass das Gerät in den Fastboot-Modus versetzt werden muss, wenn sich das Gerät in einem falschen Zustand befindet oder nicht reagiert.Kehrt zurück | |
---|---|
String | der Name des Produkttyps ERROR(/String) oder null , wenn er nicht bestimmt werden kann |
Wirft | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät unterbrochen wird und nicht wiederhergestellt werden kann. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Gibt die Fastboot-Modus-Seriennummer zurück.
Kehrt zurück | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
Rufen Sie den angegebenen Fastboot-Variablenwert vom Gerät ab.
Parameter | |
---|---|
variableName | String : der Variablenname |
Kehrt zurück | |
---|---|
String | der Eigenschaftswert oder null , wenn er nicht vorhanden ist |
Wirft | |
---|---|
| Nicht unterstützteOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
Rufen Sie einen Verweis auf eine Remote-Datei auf dem Gerät ab.
Parameter | |
---|---|
path | String : der abzurufende Dateipfad. Kann ein absoluter Pfad oder Pfad relativ zu '/' sein. (d. h. es wird sowohl die „/system“- als auch die „system“-Syntax unterstützt) |
Kehrt zurück | |
---|---|
IFileEntry | der IFileEntry oder null , wenn die Datei im angegebenen path nicht gefunden werden kann |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Gibt eine Referenz auf das zugeordnete ddmlib IDevice
zurück.
IDevice
kann von DDMS jedes Mal zugewiesen werden, wenn das Gerät die Verbindung zu adb trennt und wieder verbindet. Daher sollten Aufrufer keinen Verweis auf das IDevice
behalten, da dieser Verweis veraltet sein kann.Kehrt zurück | |
---|---|
IDevice | das IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Gibt den ganzzahligen Wert der angegebenen Eigenschaft vom Gerät zurück.
Parameter | |
---|---|
name | String : der Eigenschaftsname |
defaultValue | long : Standardwert, der zurückgegeben wird, wenn die Eigenschaft leer ist oder nicht existiert. |
Kehrt zurück | |
---|---|
long | der Eigenschaftswert oder defaultValue , wenn die Eigenschaft leer ist, nicht existiert oder keinen ganzzahligen Wert hat. |
Wirft | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by ERROR(/System#currentTimeMillis())
.
Kehrt zurück | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
Kehrt zurück | |
---|---|
int | an integer indicating the first launched API Level of device |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat captureKehrt zurück | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
Parameter | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
Kehrt zurück | |
---|---|
InputStreamSource |
getLogcatDump
public abstract InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
Kehrt zurück | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public abstract InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
Parameter | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
Kehrt zurück | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
Parameter | |
---|---|
mountName | String : the name of the mount point |
Kehrt zurück | |
---|---|
String | the mount point or null |
See also:
getMountPointInfo
public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
Parameter | |
---|---|
mountpoint | String |
Kehrt zurück | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Wirft | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
Kehrt zurück | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Wirft | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
Parameter | |
---|---|
partition | String |
Kehrt zurück | |
---|---|
long | the amount of free space in KB |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
Parameter | |
---|---|
processName | String : the proces name String. |
Kehrt zurück | |
---|---|
ProcessInfo | ProcessInfo of given processName |
Wirft | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
Parameter | |
---|---|
process | String : The proces name String. |
Kehrt zurück | |
---|---|
String |
Wirft | |
---|---|
DeviceNotAvailableException |
getProductType
public abstract String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.Kehrt zurück | |
---|---|
String | the ERROR(/String) product type name. Will not be null |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract String getProductVariant ()
Convenience method to get the product variant of this device.
This method will work if device is in either adb or fastboot mode.Kehrt zurück | |
---|---|
String | the ERROR(/String) product variant name or null if it cannot be determined |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProperty
public abstract String getProperty (String name)
Retrieve the given property value from the device.
Parameter | |
---|---|
name | String : the property name |
Kehrt zurück | |
---|---|
String | the property value or null if it does not exist |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
Kehrt zurück | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
Kehrt zurück | |
---|---|
String | the ERROR(/String) serial number |
getTombstones
public abstractgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
Kehrt zurück | |
---|---|
A list of tombstone files, empty if no tombstone. |
Wirft | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
Kehrt zurück | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
Kehrt zurück | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
Kehrt zurück | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
Kehrt zurück | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
Kehrt zurück | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public abstract boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
Kehrt zurück | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
Kehrt zurück | |
---|---|
boolean | true if the device is encrypted. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
Parameter | |
---|---|
deviceFilePath | String |
Kehrt zurück | |
---|---|
boolean |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
Kehrt zurück | |
---|---|
boolean | true if the device supports encryption. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
Parameter | |
---|---|
fullPath | String |
Kehrt zurück | |
---|---|
boolean |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
Kehrt zurück | |
---|---|
boolean |
Wirft | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
Kehrt zurück | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
Kehrt zurück | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
Parameter | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
Kehrt zurück | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException |
logOnDevice
public abstract void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
Parameter | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public abstract void postBootSetup ()
Perform instructions to configure device for testing that after every boot.
Should be called after device is fully booted/available In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot. Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
Parameter | |
---|---|
invocationException | Throwable : if any, the final exception raised by the invocation failure. |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
Parameter | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
Wirft | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
Parameter | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
Kehrt zurück | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
Kehrt zurück | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Kehrt zurück | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
Kehrt zurück | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
userId | int : The user id to pull from |
Kehrt zurück | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Kehrt zurück | |
---|---|
String | A ERROR(/String) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Wirft | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public abstract File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
Parameter | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
Kehrt zurück | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
Parameter | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
Kehrt zurück | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
Parameter | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
Kehrt zurück | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded)
Variant of pushFile(File, String)
which can optionally consider evaluating the need for the content provider.
Parameter | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
Kehrt zurück | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
Parameter | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
Kehrt zurück | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
Parameter | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
Kehrt zurück | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.Wirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract void reboot (String reason)
Reboots the device into adb mode with given reason
to be persisted across reboot.
Blocks until device becomes available.
Last reboot reason can be obtained by querying sys.boot.reason
propety.
Parameter | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Wirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recoveryWirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract void rebootIntoSideload (boolean autoReboot)
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
Parameter | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
Wirft | |
---|---|
DeviceNotAvailableException | if device is not in sideload after reboot |
rebootIntoSideload
public abstract void rebootIntoSideload ()
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
Wirft | |
---|---|
DeviceNotAvailableException | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
Wirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline (String reason)
An alternate to reboot()
that only blocks until device is online ie visible to adb.
Parameter | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Wirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
See also:
rebootUserspace
public abstract void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
Wirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
Wirft | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
runInstrumentationTests
public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)
Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))
with one or more listeners passed as parameters.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
Kehrt zurück | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,listeners)
Runs instrumentation tests, and provides device recovery.
If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.
If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
Kehrt zurück | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
Kehrt zurück | |
---|---|
boolean |
Wirft | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
Kehrt zurück | |
---|---|
boolean |
Wirft | |
---|---|
DeviceNotAvailableException |
setDate
public abstract void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
Parameter | |
---|---|
date | Date : specify a particular date; will use host date if null |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
Parameter | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
Parameter | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
Kehrt zurück | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setRecovery
public abstract void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
Parameter | |
---|---|
recovery | IDeviceRecovery : the IDeviceRecovery |
setRecoveryMode
public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)
Set the current recovery mode to use for the device.
Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etcParameter | |
---|---|
mode | ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not. |
setUseFastbootErase
public abstract void setUseFastbootErase (boolean useFastbootErase)
Set whether to use fastboot erase or fastboot format to wipe a partition on the device.
Parameter | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
See also:
startLogcat
public abstract void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
Kehrt zurück | |
---|---|
String | the tcp serial number or null if device could not be switched |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
Kehrt zurück | |
---|---|
boolean | true if switch was successful, false otherwise. |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
syncFiles
public abstract boolean syncFiles (File localFileDir, String deviceFilePath)
Incrementally syncs the contents of a local file directory to device.
Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date. Hidden files (with names starting with ".") will be ignored. Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.Parameter | |
---|---|
localFileDir | File : the local file directory containing files to recursively push. |
deviceFilePath | String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail |
Kehrt zurück | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
unlockDevice
public abstract boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.Kehrt zurück | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
| if encryption is not supported on the device. |
waitForBootComplete
public abstract boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
Parameter | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
Kehrt zurück | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Wirft | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
Kehrt zurück | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Kehrt zurück | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Wirft | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceAvailableInRecoverPath
public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
Parameter | |
---|---|
waitTime | long |
Kehrt zurück | |
---|---|
boolean | True if device is available, False if unavailable. |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Kehrt zurück | |
---|---|
boolean | true if device boots into recovery before time expires. false otherwise |
waitForDeviceInSideload
public abstract boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Kehrt zurück | |
---|---|
boolean | true if device boots into sideload before time expires. false otherwise |
waitForDeviceNotAvailable
public abstract boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Kehrt zurück | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public abstract void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Wirft | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Kehrt zurück | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |