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 die API-Ebene nicht erkannt werden kann |
Öffentliche Methoden | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Überprüfen Sie, ob eine Funktion derzeit auf einem minimal unterstützten Niveau unterstützt wird. |
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 einen Soft-Neustart durchgeführt hat, indem der aktuelle system_server mit dem vorherigen system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Hilfsmethode zum Überprüfen, ob das Gerät seit der UTC-Zeit seit der Epoche vom Gerät und seinem |
abstract boolean | disableAdbRoot () Schaltet ADB-Root aus. |
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 lang laufenden Fastboot-Befehl als Systembefehl ausführt. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Hilfsmethode, die einen lang 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 Geräte-API-Ebene ab. |
abstract String | getBasebandVersion () Praktische Methode, um die Basisband-(Radio-)Version dieses Geräts zu erhalten. |
abstract Integer | getBattery () Gibt den aktuellen Akkuladestand eines Geräts zurück oder Null, wenn der Akkuladestand nicht verfügbar ist. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Gibt den booleschen Wert der angegebenen Eigenschaft zurück. |
abstract | getBootHistory () Die Hilfsmethode erfasst die Boot-Verlaufsübersicht mit Boot-Zeit und Boot-Grund. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Die Hilfsmethode erfasst die Boot-Verlaufsübersicht mit der Boot-Zeit und dem Boot-Grund seit der angegebenen Zeit seit der Epoche vom Gerät und der angegebenen Zeiteinheit. |
abstract String | getBootloaderVersion () Praktische Methode 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 gerade ausführt. |
abstract String | getBuildSigningKeys () Gibt den Schlüsseltyp zurück, der zum Signieren des Gerätebilds verwendet wird Typischerweise können Android-Geräte mit Testschlüsseln (wie in AOSP) oder Freigabeschlüsseln (von einzelnen Geräteherstellern gesteuert) 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 mit dem Gerät verknüpfte 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 () Gibt einen |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Gibt einen |
abstract TestDeviceState | getDeviceState () Rufen Sie den Status des Geräts ab. |
abstract long | getDeviceTimeOffset (Date date) Helfer zum Ermitteln des Zeitunterschieds zwischen dem Gerät und einem bestimmten |
abstract InputStreamSource | getEmulatorOutput () Holen Sie sich den Stream des Emulators stdout und stderr |
abstract long | getExternalStoreFreeSpace () Hilfsmethode zur Bestimmung der Menge an freiem Speicherplatz im externen Gerätespeicher. |
abstract String | getFastbootProductType () Praktische Methode zum Abrufen des Produkttyps dieses Geräts, wenn es sich im Fastboot-Modus befindet. |
abstract String | getFastbootProductVariant () Praktische Methode zum Abrufen des Produkttyps dieses Geräts, wenn es sich im Fastboot-Modus befindet. |
abstract String | getFastbootSerialNumber () Gibt die Seriennummer des Fastboot-Modus 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 einen Verweis auf das zugehörige ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Gibt einen ganzzahligen Wert der angegebenen Eigenschaft vom Gerät zurück. |
abstract long | getLastExpectedRebootTimeMillis () Gibt den letzten Neustart in Millisekunden seit EPOCH zurück, wie von |
abstract int | getLaunchApiLevel () Rufen Sie den ersten gestarteten API-Level des Geräts ab. |
abstract InputStreamSource | getLogcat () Erfasst einen Snapshot-Stream der Logcat-Daten. |
abstract InputStreamSource | getLogcat (int maxBytes) Erfasst einen Snapshot-Stream der letzten |
abstract InputStreamSource | getLogcatDump () Rufen Sie einen Dump des aktuellen Logcat für das Gerät ab. |
abstract InputStreamSource | getLogcatSince (long date) Erfasst einen Snapshot-Stream der erfassten Logcat-Daten ab dem angegebenen Datum. |
abstract String | getMountPoint (String mountName) Gibt einen Mountpunkt zurück. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Gibt eine |
abstract | getMountPointInfo () Gibt eine analysierte Version der Informationen in /proc/mounts auf dem Gerät zurück |
abstract long | getPartitionFreeSpace (String partition) Hilfsmethode zur Bestimmung der Menge an freiem Speicherplatz 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 ein Fehler aufgetreten ist. |
abstract String | getProductType () Praktische Methode, um den Produkttyp dieses Geräts zu ermitteln. |
abstract String | getProductVariant () Bequeme Methode, 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 () Praktische Methode, um die Seriennummer dieses Geräts zu erhalten. |
abstract | getTombstones () Rufen Sie die Liste der Tombstones von den Geräten ab und geben 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 Sie Fastboot Erase oder Fastboot Format verwenden möchten, 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-Enumeration unterstützt |
abstract boolean | isBypassLowTargetSdkBlockSupported () Überprüfen Sie, ob die Plattform auf dem Gerät die Umgehung des SDK-Blocks mit niedrigem Zielwert bei App-Installationen unterstützt |
abstract boolean | isDeviceEncrypted () Gibt zurück, wenn das Gerät verschlüsselt ist. |
abstract boolean | isDirectory (String deviceFilePath) Gibt „True“ zurück, wenn der Pfad auf dem Gerät ein Verzeichnis ist, andernfalls „False“. |
abstract boolean | isEncryptionSupported () Gibt zurück, wenn 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 () Gibt „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 die Anweisungen zum Konfigurieren des Geräts aus, um es 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 Aufrufablauf 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 praktische 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) Übertragen 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 mit angegebenem |
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 ist, der gerade wiederhergestellt wird). 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 ist, der gerade wiederhergestellt wird). 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 | remountSystemReadOnly () Machen Sie die Systempartition auf dem Gerät schreibgeschützt. |
abstract void | remountSystemWritable () Machen Sie die Systempartition auf dem Gerät beschreibbar. |
abstract void | remountVendorReadOnly () Machen Sie die Herstellerpartition auf dem Gerät schreibgeschützt. |
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) Identisch mit |
abstract void | setDate (Date date) Legt das Datum auf dem Gerät fest Hinweis: Zum Festlegen 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 |
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 zum Löschen einer Partition auf dem Gerät verwendet werden soll. |
abstract void | startLogcat () Beginnen Sie mit der 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 darauf, dass das Gerät reagiert und zum Testen verfügbar ist. |
abstract boolean | waitForDeviceAvailable (long waitTime) Wartet darauf, dass das Gerät reagiert und zum Testen verfügbar ist. |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) Wartet darauf, dass das Gerät reagiert und verfügbar ist, ohne den Wiederherstellungspfad zu berücksichtigen. |
abstract void | waitForDeviceBootloader () Blockiert, bis das Gerät über Fastboot sichtbar ist. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Blockiert, dass sich das Gerät im Status „ADB Recovery“ befindet (beachten Sie, dass sich dies von |
abstract boolean | waitForDeviceInSideload (long waitTime) Blockiert, damit sich das Gerät im Status „adb sideload“ befindet |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Blöcke für das Gerät sind nicht verfügbar, dh sie fehlen in der 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 die API-Ebene nicht erkannt werden kann
Konstanter Wert: -1 (0xffffffff)
Öffentliche Methoden
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Überprüfen Sie, ob eine Funktion derzeit auf einem minimal unterstützten Niveau unterstützt wird. Diese Methode berücksichtigt noch nicht veröffentlichte Funktionen, bevor die API-Ebene angehoben wird.
Parameter | |
---|---|
strictMinLevel | int : Die strikte minimal mögliche Ebene, die die Funktion unterstützt. |
Kehrt zurück | |
---|---|
boolean | True, wenn die Ebene unterstützt wird. Sonst falsch. |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
Löscht alle angesammelten Logcat-Daten.
Dies ist in Fällen nützlich, in denen Sie sicherstellen möchtenITestDevice#getLogcat()
nur Protokolldaten zurückgibt, die nach einem bestimmten Zeitpunkt erstellt wurden (z. B. nach dem Flashen eines neuen Gerätebuilds 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. |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Hilfsmethode zum Überprüfen, ob das Gerät einen Soft-Neustart durchgeführt hat, 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 einen Soft-Neustart durchgeführt hat |
Würfe | |
---|---|
RuntimeException | wenn das Gerät einen abnormalen Startgrund hat |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Hilfsmethode zum Überprüfen, ob das Gerät seit der UTC-Zeit seit der Epoche vom Gerät und seinem ERROR(/TimeUnit)
einen Soft-Neustart durchgeführt hat. Soft-Restart bezieht sich auf den Neustart des Systemservers außerhalb eines harten Neustarts des Geräts (z. B. angeforderter Neustart). Die aktuelle utcEpochTime des Geräts 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 angegebene utcEpochTime. |
Kehrt zurück | |
---|---|
boolean | true , wenn das Gerät einen Soft-Neustart durchgeführt hat |
Würfe | |
---|---|
RuntimeException | wenn das Gerät einen abnormalen Startgrund hat |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
disableAdbRoot
public abstract boolean disableAdbRoot ()
Schaltet ADB-Root aus.
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. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht 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 zu überprüfenden Datei auf dem Gerät |
Kehrt zurück | |
---|---|
boolean | true , wenn die Datei vorhanden ist, andernfalls false . |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
Aktiviert ADB-Root. Wenn die Einstellung „enable-root“ „false“ ist, wird eine Meldung protokolliert und ohne Root-Aktivierung zurückgegeben.
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. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Hilfsmethode, die einen ADB-Befehl als Systembefehl mit einem angegebenen Timeout ausführt.
Wann immer möglich sollte 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 gilt, 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 die Ausführung des Befehls fehlgeschlagen ist. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Hilfsmethode, die einen ADB-Befehl als Systembefehl ausführt.
Wann immer möglich sollteexecuteShellCommand(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 die Ausführung des Befehls fehlgeschlagen ist. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
Hilfsmethode, die einen ADB-Befehl als Systembefehl mit einem angegebenen Timeout ausführt.
Wann immer möglich sollte 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 gilt, 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 die Ausführung des Befehls fehlgeschlagen ist. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht 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 |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht 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 |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
ausführenLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Hilfsmethode, die einen lang 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 |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
ausführenLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Hilfsmethode, die einen lang 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 |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeShellCommand
public abstract String executeShellCommand (String command)
Hilfsmethode, die einen ADB-Shell-Befehl ausführt und die Ausgabe als String
zurückgibt.
Parameter | |
---|---|
command | String : der auszuführende ADB-Shell-Befehl |
Kehrt zurück | |
---|---|
String | die Shell-Ausgabe |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeShellCommand
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 weitergeleitet werden soll. |
maxTimeToOutputShellResponse | long : die maximale Zeitspanne, in der der Befehl keine Antwort ausgeben darf; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : Die maximale Häufigkeit, mit der der Befehl wiederholt werden soll, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts erfolglos ausgeführt werden. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeShellCommand
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 weitergeleitet werden soll. |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für die Ausführung des Befehls; Einheit wie in timeUnit angegeben |
maxTimeToOutputShellResponse | long : die maximale Zeitspanne, in der der Befehl keine Antwort ausgeben darf; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : Die maximale Häufigkeit, mit der der Befehl wiederholt werden soll, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts erfolglos ausgeführt werden. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
executeShellCommand
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 FormexecuteShellCommand(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 weitergeleitet werden soll. |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
AusführenShellV2Command
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 . |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
AusführenShellV2Command
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 weitergeleitet.
Parameter | |
---|---|
command | String : Der Befehl, der ausgeführt werden soll. |
pipeToOutput | OutputStream : ERROR(/OutputStream) wobei die Standardausgabe umgeleitet wird, oder null. |
Kehrt zurück | |
---|---|
CommandResult | Das Ergebnis in CommandResult . |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
AusführenShellV2Command
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 . |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
AusführenShellV2Command
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 die Ausführung des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : Die maximale Häufigkeit, mit der der Befehl wiederholt werden soll, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts erfolglos ausgeführt werden. |
Kehrt zurück | |
---|---|
CommandResult |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
Siehe auch:
AusführenShellV2Command
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 die Ausführung des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
Kehrt zurück | |
---|---|
CommandResult |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
Siehe auch:
AusführenShellV2Command
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) wobei die Standardausgabe umgeleitet wird, oder null. |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für die Ausführung des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : Die maximale Häufigkeit, mit der der Befehl wiederholt werden soll, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts erfolglos ausgeführt werden. |
Kehrt zurück | |
---|---|
CommandResult |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
Siehe auch:
AusführenShellV2Command
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) wobei die Standardausgabe umgeleitet wird, oder null. |
pipeToError | OutputStream : ERROR(/OutputStream) wobei der Standardfehler umgeleitet wird, oder null. |
maxTimeoutForCommand | long : die maximale Zeitüberschreitung für die Ausführung des Befehls; Einheit wie in timeUnit angegeben |
timeUnit | TimeUnit : Einheit für maxTimeToOutputShellResponse |
retryAttempts | int : Die maximale Häufigkeit, mit der der Befehl wiederholt werden soll, wenn er aufgrund einer Ausnahme fehlschlägt. DeviceNotResponsiveException wird ausgelöst, wenn retryAttempts erfolglos ausgeführt werden. |
Kehrt zurück | |
---|---|
CommandResult |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht 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 Gerätestart 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 |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
getApiLevel
public abstract int getApiLevel ()
Rufen Sie die Geräte-API-Ebene ab. Standardmäßig ist UNKNOWN_API_LEVEL
.
Kehrt zurück | |
---|---|
int | eine Ganzzahl, die die API-Ebene des Geräts angibt |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
Praktische Methode, um die Basisband-(Radio-)Version dieses Geräts zu erhalten. Das Abrufen der Radioversion ist gerätespezifisch, daher werden möglicherweise nicht für alle Geräte die richtigen Informationen zurückgegeben. Diese Methode basiert auf der Eigenschaft gsm.version.baseband, um die korrekten 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 eine genaue Version, wenn die Eigenschaft gsm.version.baseband mit der von fastboot getvar version-baseband
zurückgegebenen Version übereinstimmt.
Kehrt zurück | |
---|---|
String | die String Basisbandversion oder null , wenn sie nicht bestimmt werden kann (Gerät verfügt über kein Radio oder Versionsstring kann nicht gelesen werden) |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
getBattery
public abstract Integer getBattery ()
Gibt den aktuellen Akkuladestand eines Geräts zurück oder Null, wenn der Akkuladestand 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 . |
Würfe | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
Die Hilfsmethode erfasst die Boot-Verlaufsübersicht mit Boot-Zeit und Boot-Grund.
Kehrt zurück | |
---|---|
Karte der Startzeit (UTC-Zeit in Sekunden seit Epoche) und Startgrund |
Würfe | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Die Hilfsmethode erfasst die Boot-Verlaufsübersicht mit der Boot-Zeit und dem Boot-Grund seit der angegebenen Zeit seit der Epoche vom Gerät und der angegebenen Zeiteinheit. Die aktuelle utcEpochTime des Geräts 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 |
Würfe | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
Praktische Methode zum Abrufen der Bootloader-Version dieses Geräts.
Versucht, die Bootloader-Version vom aktuellen Status des Geräts abzurufen. (d. h. wenn sich das Gerät im Fastboot-Modus befindet, wird es versuchen, die Version vom Fastboot abzurufen)Kehrt zurück | |
---|---|
String | die String Bootloader-Version oder null , wenn sie nicht gefunden werden kann |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht 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 diese nicht abgerufen werden konnte |
Würfe | |
---|---|
| 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 |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Rufen Sie den Build ab, den das Gerät gerade ausführt.
Kehrt zurück | |
---|---|
String | die Build-ID oder IBuildInfo#UNKNOWN_BUILD_ID , wenn sie nicht abgerufen werden konnte |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
Gibt den Schlüsseltyp zurück, der zum Signieren des Gerätebilds verwendet wird
Typischerweise können Android-Geräte mit Testschlüsseln (wie in AOSP) oder Freigabeschlüsseln (von einzelnen Geräteherstellern gesteuert) signiert werden.
Kehrt zurück | |
---|---|
String | Der Signaturschlüssel, falls gefunden, andernfalls null. |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Gibt einen zwischengespeicherten DeviceDescriptor
zurück, wenn das Gerät zugewiesen ist, andernfalls wird der aktuelle DeviceDescriptor
zurückgegeben.
Kehrt zurück | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Gibt einen zwischengespeicherten DeviceDescriptor
zurück, wenn das Gerät zugewiesen ist, andernfalls wird der aktuelle DeviceDescriptor
zurückgegeben.
Parameter | |
---|---|
shortDescriptor | boolean : Gibt an, ob der Deskriptor auf das Nötigste an Informationen beschränkt werden soll oder nicht |
Kehrt zurück | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
Alternative zur Verwendung IFileEntry
, das manchmal aufgrund von Berechtigungen nicht funktioniert.
Parameter | |
---|---|
deviceFilePath | String : ist der Pfad auf dem Gerät, in dem die Suche durchgeführt werden soll |
Kehrt zurück | |
---|---|
String[] | String-Array, das alle Dateien in einem Pfad auf dem Gerät enthält. |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getConnection
public abstract AbstractConnection getConnection ()
Gibt die mit dem Gerät verknüpfte Verbindung zurück.
Kehrt zurück | |
---|---|
AbstractConnection |
getDeviceClass
public abstract String getDeviceClass ()
Rufen Sie die Geräteklasse ab.
Kehrt zurück | |
---|---|
String | die String Geräteklasse. |
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. |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Gibt 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)
Gibt einen DeviceDescriptor
aus den Geräteinformationen zurück, um Informationen darüber zu erhalten, ohne das eigentliche Geräteobjekt zu übergeben.
Parameter | |
---|---|
shortDescriptor | boolean : Gibt an, ob der Deskriptor auf das Nötigste an Informationen beschränkt werden soll oder nicht |
Kehrt zurück | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Rufen Sie den Status des Geräts ab.
Kehrt zurück | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Helfer zum Ermitteln des Zeitunterschieds zwischen dem Gerät und einem bestimmten ERROR(/Date)
. Nutzen Sie die Epochenzeit intern.
Parameter | |
---|---|
date | Date |
Kehrt zurück | |
---|---|
long | der Unterschied in Millisekunden |
Würfe | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
Holen Sie sich den Stream des Emulators stdout und stderr
Kehrt zurück | |
---|---|
InputStreamSource | Emulator-Ausgabe |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Hilfsmethode zur Bestimmung der Menge an freiem Speicherplatz im externen Gerätespeicher.
Kehrt zurück | |
---|---|
long | die Menge an freiem Speicherplatz in KB |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
getFastbootProductType
public abstract String getFastbootProductType ()
Praktische Methode zum Abrufen des Produkttyps dieses Geräts, wenn es sich im Fastboot-Modus befindet.
Diese Methode sollte nur verwendet werden, wenn sich das Gerät im Fastboot-Modus befinden soll. In diesem Fall handelt es sich um eine etwas sicherere Variante als die generischegetProductType()
Methode, da ITestDevice das Gerät in den Fastboot-Modus wiederherstellen kann, wenn sich das Gerät in einem falschen Zustand befindet oder nicht reagiert.Kehrt zurück | |
---|---|
String | der String Produkttypname oder null , wenn er nicht bestimmt werden kann |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
Praktische Methode zum Abrufen des Produkttyps dieses Geräts, wenn es sich im Fastboot-Modus befindet.
Diese Methode sollte nur verwendet werden, wenn sich das Gerät im Fastboot-Modus befinden soll. In diesem Fall handelt es sich um eine etwas sicherere Variante als die generischegetProductType()
Methode, da ITestDevice das Gerät in den Fastboot-Modus wiederherstellen kann, wenn sich das Gerät in einem falschen Zustand befindet oder nicht reagiert.Kehrt zurück | |
---|---|
String | der String Produkttypname oder null , wenn er nicht bestimmt werden kann |
Würfe | |
---|---|
DeviceNotAvailableException | wenn die Verbindung zum Gerät verloren geht und nicht wiederhergestellt werden kann. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Gibt die Seriennummer des Fastboot-Modus 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 |
Würfe | |
---|---|
| UnsupportedOperationException |
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 ein Pfad relativ zu „/“ sein. (d. h. sowohl die Syntax „/system“ als auch „system“ wird unterstützt) |
Kehrt zurück | |
---|---|
IFileEntry | der IFileEntry oder null , wenn die Datei im angegebenen path nicht gefunden werden kann |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Gibt einen Verweis auf das zugehörige ddmlib IDevice
zurück.
IDevice
kann von DDMS jedes Mal zugewiesen werden, wenn das Gerät die Verbindung zur ADB trennt und wieder herstellt. Daher sollten Aufrufer keinen Verweis auf IDevice
behalten, da dieser Verweis möglicherweise veraltet ist.Kehrt zurück | |
---|---|
IDevice | das IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Gibt einen 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. |
Würfe | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Gibt den letzten Neustart in Millisekunden seit EPOCH zurück, wie von System.currentTimeMillis()
zurückgegeben.
Kehrt zurück | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Rufen Sie den ersten gestarteten API-Level des Geräts ab. Standardmäßig ist UNKNOWN_API_LEVEL
.
Kehrt zurück | |
---|---|
int | eine Ganzzahl, die die erste gestartete API-Ebene des Geräts angibt |
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Erfasst einen Snapshot-Stream der Logcat-Daten.
Funktioniert in zwei Modi:
TestDeviceOptions.getMaxLogcatDataSize()
Bytes des aktuellen Inhalts der Hintergrund-Logcat-Erfassung zurückgegebenKehrt 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" |
Würfe | |
---|---|
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" |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
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 String product type name. Will not be null |
Würfe | |
---|---|
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 String product variant name or null if it cannot be determined |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
| 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 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 | |
---|---|
Eine Liste von Tombstone-Dateien, leer, wenn kein Tombstone vorhanden ist. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
| 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 |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
| 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 |
Würfe | |
---|---|
| 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 |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
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.
Würfe | |
---|---|
| 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)Würfe | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
Diese Methode ist veraltet.
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 |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
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) |
Würfe | |
---|---|
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) |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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 String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Würfe | |
---|---|
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) |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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.Würfe | |
---|---|
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. |
Würfe | |
---|---|
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.Würfe | |
---|---|
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.
Würfe | |
---|---|
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 recoveryWürfe | |
---|---|
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 |
Würfe | |
---|---|
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
Würfe | |
---|---|
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.
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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.
Würfe | |
---|---|
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.
Würfe | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemReadOnly
public abstract void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorReadOnly
public abstract void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
Würfe | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Würfe | |
---|---|
| 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 |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
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 |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
| 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 |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | 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 |
Würfe | |
---|---|
| 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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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. |
Würfe | |
---|---|
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.
Würfe | |
---|---|
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.Würfe | |
---|---|
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 |
Würfe | |
---|---|
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. |