INativeDevice

public interface INativeDevice

com.android.tradefed.device.INativeDevice


Zapewnia niezawodny interfejs API nieco wyższego poziomu dla ddmlib IDevice .

Ponawia polecenia urządzenia w konfigurowalnej ilości i zapewnia interfejs odzyskiwania urządzenia dla urządzeń, które nie odpowiadają.

Streszczenie

Stałe

int UNKNOWN_API_LEVEL

Wartość domyślna, gdy nie można wykryć poziomu interfejsu API

Metody publiczne

abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Sprawdź, czy funkcja jest obecnie obsługiwana przy minimalnym obsługiwanym poziomie.

abstract void clearLogcat ()

Usuwa wszelkie zgromadzone dane logcat.

abstract void deleteFile (String deviceFilePath)

Metoda pomocnika, aby usunąć plik lub katalog na urządzeniu.

abstract boolean deviceSoftRestarted ( ProcessInfo prevSystemServerProcess)

Metoda pomocnika, aby sprawdzić, czy urządzenie zostało ponownie uruchomione, porównując bieżący system_server z poprzednim system_server ProcessInfo .

abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

Metoda pomocnika, aby sprawdzić, czy urządzenie zostało ponownie uruchomione miękko od czasu UTC od epoki z urządzenia i jego ERROR(/TimeUnit) .

abstract boolean disableAdbRoot ()

Wyłącza adb root.

abstract boolean doesFileExist (String deviceFilePath)

Metoda pomocnika w celu ustalenia, czy plik na urządzeniu istnieje.

abstract boolean enableAdbRoot ()

Włącza adb root.

abstract String executeAdbCommand (long timeout, String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie adb jako polecenie systemowe z określonym limitem czasu.

abstract String executeAdbCommand (String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie adb jako polecenie systemowe.

abstract String executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie adb jako polecenie systemowe z określonym limitem czasu.

abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie fastboot jako polecenie systemowe.

abstract CommandResult executeFastbootCommand (String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie fastboot jako polecenie systemowe z domyślnym limitem czasu wynoszącym 2 minuty.

abstract CommandResult executeLongFastbootCommand (String... commandArgs)

Metoda pomocnicza, która wykonuje długotrwałe polecenie fastboot jako polecenie systemowe.

abstract CommandResult executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs)

Metoda pomocnicza, która wykonuje długotrwałe polecenie fastboot jako polecenie systemowe z systemowymi zmiennymi środowiskowymi.

abstract String executeShellCommand (String command)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca dane wyjściowe jako ERROR(/String) .

abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

abstract void executeShellCommand (String command, IShellOutputReceiver receiver)

Wykonuje podane polecenie powłoki adb, ponawiając wiele razy, jeśli polecenie się nie powiedzie.

abstract CommandResult executeShellV2Command (String command)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca wyniki jako CommandResult poprawnie wypełnione danymi wyjściowymi stanu polecenia, stdout i stderr.

abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca wyniki jako CommandResult poprawnie wypełniony danymi wyjściowymi stanu polecenia i stderr.

abstract CommandResult executeShellV2Command (String command, File pipeAsInput)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca wyniki jako CommandResult poprawnie wypełnione danymi wyjściowymi stanu polecenia, stdout i stderr.

abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

abstract CommandResult fastbootWipePartition (String partition)

Metoda pomocnicza, która czyści partycję dla urządzenia.

abstract int getApiLevel ()

Uzyskaj poziom interfejsu API urządzenia.

abstract String getBasebandVersion ()

Wygodna metoda uzyskania wersji pasma podstawowego (radiowego) tego urządzenia.

abstract Integer getBattery ()

Zwraca bieżący poziom naładowania baterii urządzenia lub wartość Null, jeśli poziom naładowania baterii jest niedostępny.

abstract boolean getBooleanProperty (String name, boolean defaultValue)

Zwraca wartość logiczną podanej właściwości.

abstract getBootHistory ()

Metoda pomocnicza zbiera mapę historii rozruchu z czasem rozruchu i przyczyną rozruchu.

abstract getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

Metoda pomocnicza zbiera mapę historii rozruchu z czasem rozruchu i przyczyną rozruchu od podanego czasu od epoki z urządzenia i określonej jednostki czasu.

abstract String getBootloaderVersion ()

Wygodny sposób na uzyskanie wersji bootloadera tego urządzenia.

abstract String getBuildAlias ()

Pobierz alias kompilacji, która jest aktualnie uruchomiona na urządzeniu.

abstract String getBuildFlavor ()

Pobierz smak kompilacji dla urządzenia.

abstract String getBuildId ()

Pobierz kompilację aktualnie uruchomioną na urządzeniu.

abstract String getBuildSigningKeys ()

Zwraca typ klucza używany do podpisania obrazu urządzenia

Zazwyczaj urządzenia z Androidem mogą być podpisywane za pomocą kluczy testowych (jak w AOSP) lub kluczy zwalniających (kontrolowanych przez poszczególnych producentów urządzeń)

abstract DeviceDescriptor getCachedDeviceDescriptor ()

Zwraca buforowany DeviceDescriptor jeśli urządzenie jest przydzielone, w przeciwnym razie zwraca bieżący DeviceDescriptor .

abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Zwraca buforowany DeviceDescriptor jeśli urządzenie jest przydzielone, w przeciwnym razie zwraca bieżący DeviceDescriptor .

abstract String[] getChildren (String deviceFilePath)

Alternatywa dla używania IFileEntry , która czasami nie działa z powodu uprawnień.

abstract AbstractConnection getConnection ()

Zwraca połączenie skojarzone z urządzeniem.

abstract String getDeviceClass ()

Pobierz klasę urządzenia.

abstract long getDeviceDate ()

Zwróć datę urządzenia w milisekundach od epoki.

abstract DeviceDescriptor getDeviceDescriptor ()

Zwróć DeviceDescriptor z informacji o urządzeniu, aby uzyskać informacje na jego temat bez przekazywania rzeczywistego obiektu urządzenia.

abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Zwróć DeviceDescriptor z informacji o urządzeniu, aby uzyskać informacje na jego temat bez przekazywania rzeczywistego obiektu urządzenia.

abstract TestDeviceState getDeviceState ()

Pobierz stan urządzenia.

abstract long getDeviceTimeOffset (Date date)

Pomocnik, aby uzyskać różnicę czasu między urządzeniem a danym ERROR(/Date) .

abstract InputStreamSource getEmulatorOutput ()

Pobierz strumień emulatora stdout i stderr

abstract long getExternalStoreFreeSpace ()

Metoda pomocnicza do określania ilości wolnego miejsca w pamięci zewnętrznej urządzenia.

abstract String getFastbootProductType ()

Wygodna metoda uzyskiwania typu produktu tego urządzenia, gdy jest ono w trybie szybkiego uruchamiania.

abstract String getFastbootProductVariant ()

Wygodna metoda uzyskiwania typu produktu tego urządzenia, gdy jest ono w trybie szybkiego uruchamiania.

abstract String getFastbootSerialNumber ()

Zwraca numer seryjny trybu szybkiego uruchamiania.

abstract String getFastbootVariable (String variableName)

Pobierz z urządzenia podaną wartość zmiennej fastboot.

abstract IFileEntry getFileEntry (String path)

Pobierz odwołanie do zdalnego pliku na urządzeniu.

abstract IDevice getIDevice ()

Zwraca odwołanie do powiązanego ddmlib IDevice .

abstract long getIntProperty (String name, long defaultValue)

Zwraca wartość całkowitą podanej właściwości z urządzenia.

abstract long getLastExpectedRebootTimeMillis ()

Zwraca ostatni raz, kiedy API Tradefed wyzwoliło ponowne uruchomienie w milisekundach od EPOCH, zgodnie z wartością zwróconą przez ERROR(/System#currentTimeMillis()) .

abstract int getLaunchApiLevel ()

Uzyskaj pierwszy uruchomiony poziom API urządzenia.

abstract InputStreamSource getLogcat ()

Przechwytuje strumień migawek danych logcat.

abstract InputStreamSource getLogcat (int maxBytes)

Przechwytuje strumień migawek ostatnich maxBytes przechwyconych danych logcat.

abstract InputStreamSource getLogcatDump ()

Uzyskaj zrzut bieżącego logcata dla urządzenia.

abstract InputStreamSource getLogcatSince (long date)

Przechwytuje strumień migawek przechwyconych danych logcat począwszy od podanej daty.

abstract String getMountPoint (String mountName)

Zwraca punkt montowania.

abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

Zwraca wartość MountPointInfo odpowiadającą podanej ścieżce punktu montowania lub null , jeśli w tej ścieżce nic nie jest zamontowane lub w inny sposób nie pojawia się w /proc/mounts jako punkt montowania.

abstract getMountPointInfo ()

Zwraca przeanalizowaną wersję informacji w /proc/mounts na urządzeniu

abstract long getPartitionFreeSpace (String partition)

Metoda pomocnicza do określania ilości wolnego miejsca na partycji urządzenia.

abstract ProcessInfo getProcessByName (String processName)

Metoda pomocnicza uruchamia polecenie „pidof” i „stat” i zwraca obiekt ProcessInfo z PID i czasem rozpoczęcia danego procesu.

abstract String getProcessPid (String process)

Zwraca pid usługi lub null, jeśli coś poszło nie tak.

abstract String getProductType ()

Wygodna metoda uzyskania typu produktu tego urządzenia.

abstract String getProductVariant ()

Wygodna metoda uzyskania wariantu produktu tego urządzenia.

abstract String getProperty (String name)

Pobierz daną wartość właściwości z urządzenia.

abstract ITestDevice.RecoveryMode getRecoveryMode ()

Pobierz bieżący tryb odzyskiwania używany dla urządzenia.

abstract String getSerialNumber ()

Wygodna metoda uzyskania numeru seryjnego tego urządzenia.

abstract getTombstones ()

Pobierz i zwróć listę nagrobków z urządzeń.

abstract long getTotalMemory ()

Zwraca całkowity rozmiar pamięci fizycznej w bajtach lub -1 w przypadku błędu wewnętrznego

abstract boolean getUseFastbootErase ()

Dowiedz się, czy użyć szybkiego kasowania lub formatu szybkiego rozruchu, aby wyczyścić partycję na urządzeniu.

abstract boolean isAdbRoot ()
abstract boolean isAdbTcp ()
abstract boolean isAppEnumerationSupported ()

Sprawdź, czy platforma na urządzeniu obsługuje wyliczanie aplikacji

abstract boolean isBypassLowTargetSdkBlockSupported ()

Sprawdź, czy platforma na urządzeniu obsługuje pomijanie niskiego docelowego bloku SDK podczas instalacji aplikacji

abstract boolean isDeviceEncrypted ()

Zwraca, jeśli urządzenie jest zaszyfrowane.

abstract boolean isDirectory (String deviceFilePath)

Zwraca True, jeśli ścieżka na urządzeniu jest katalogiem, w przeciwnym razie zwraca false.

abstract boolean isEncryptionSupported ()

Zwraca, jeśli szyfrowanie jest obsługiwane na urządzeniu.

abstract boolean isExecutable (String fullPath)

Zwraca wartość True, jeśli ścieżka pliku na urządzeniu jest plikiem wykonywalnym, w przeciwnym razie zwraca wartość False.

abstract boolean isHeadless ()

Zwróć wartość true, jeśli urządzenie jest bezgłowe (bez ekranu), w przeciwnym razie zwraca wartość false.

abstract boolean isRuntimePermissionSupported ()

Sprawdź, czy platforma na urządzeniu obsługuje nadawanie uprawnień w czasie wykonywania

abstract boolean isStateBootloaderOrFastbootd ()

Zwraca wartość true, jeśli urządzenie znajduje się w TestDeviceState#FASTBOOT lub TestDeviceState.FASTBOOTD .

abstract boolean logAnrs ( ITestLogger logger)

Zbiera i rejestruje błędy ANR z urządzenia.

abstract void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)

Zarejestruj wiadomość w logcat urządzenia.

abstract void nonBlockingReboot ()

Wydaje polecenie ponownego uruchomienia urządzenia i powraca po zakończeniu polecenia i gdy urządzenie nie jest już widoczne dla adb.

abstract void postBootSetup ()

Wykonaj instrukcje, aby skonfigurować urządzenie do testowania po każdym uruchomieniu.

default void postInvocationTearDown ()

Ta metoda jest przestarzała. Zamiast tego użyj postInvocationTearDown(Throwable) .

abstract void postInvocationTearDown (Throwable invocationException)

Dodatkowe kroki związane z wymaganym czyszczeniem urządzenia, które zostaną wykonane po zakończeniu wywołania.

default void preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes)

Dodatkowe kroki dla wymaganej konfiguracji specyficznej dla urządzenia, które zostaną wykonane na urządzeniu przed przepływem wywołania.

abstract boolean pullDir (String deviceFilePath, File localDir)

Rekursywnie ściągaj zawartość katalogu z urządzenia.

abstract File pullFile (String remoteFilePath, int userId)

Pobiera plik z urządzenia, zapisuje go w lokalnym tymczasowym ERROR(/File) i zwraca ten File .

abstract File pullFile (String remoteFilePath)

Pobiera plik z urządzenia, zapisuje go w lokalnym tymczasowym ERROR(/File) i zwraca ten File .

abstract boolean pullFile (String remoteFilePath, File localFile)

Pobiera plik z urządzenia.

abstract boolean pullFile (String remoteFilePath, File localFile, int userId)

Pobiera plik z urządzenia.

abstract String pullFileContents (String remoteFilePath)

Pobiera plik z urządzenia i zwraca zawartość.

abstract File pullFileFromExternal (String remoteFilePath)

Wygodna metoda pobierania pliku z pamięci zewnętrznej urządzenia, zapisywania go w lokalnym tymczasowym ERROR(/File) i zwracania odwołania do tego File .

abstract boolean pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories)

Rekursywnie wypychaj zawartość katalogu do urządzenia, wykluczając niektóre katalogi, które są filtrowane.

abstract boolean pushDir (File localDir, String deviceFilePath)

Rekursywnie przesyłaj zawartość katalogu do urządzenia.

abstract boolean pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded)

Wariant pushFile(File, String) , który może opcjonalnie rozważyć ocenę zapotrzebowania na dostawcę zawartości.

abstract boolean pushFile (File localFile, String deviceFilePath)

Prześlij plik do urządzenia.

abstract boolean pushString (String contents, String deviceFilePath)

Prześlij plik utworzony z ciągu znaków na urządzenie

abstract void reboot ()

Ponownie uruchamia urządzenie w trybie adb.

abstract void reboot (String reason)

Ponownie uruchamia urządzenie w trybie adb z podanym reason do utrwalenia podczas ponownego uruchamiania.

abstract void rebootIntoBootloader ()

Ponownie uruchamia urządzenie w trybie programu ładującego.

abstract void rebootIntoFastbootd ()

Ponownie uruchamia urządzenie w trybie fastbootd.

abstract void rebootIntoRecovery ()

Ponownie uruchamia urządzenie w trybie odzyskiwania adb.

abstract void rebootIntoSideload (boolean autoReboot)

Ponownie uruchamia urządzenie w trybie adb sideload (pamiętaj, że jest to specjalny tryb odzyskiwania)

Blokuje, dopóki urządzenie nie przejdzie w tryb ładowania bocznego

abstract void rebootIntoSideload ()

Ponownie uruchamia urządzenie w trybie adb sideload (pamiętaj, że jest to specjalny tryb odzyskiwania)

Blokuje, dopóki urządzenie nie przejdzie w tryb ładowania bocznego

abstract void rebootUntilOnline ()

Alternatywa dla reboot() , która blokuje tylko do momentu, gdy urządzenie jest online, tj. widoczne dla adb.

abstract void rebootUntilOnline (String reason)

Alternatywa dla reboot() , która blokuje tylko do momentu, gdy urządzenie jest online, tj. widoczne dla adb.

abstract void rebootUserspace ()

Restartuje tylko część przestrzeni użytkownika urządzenia.

abstract void rebootUserspaceUntilOnline ()

Alternatywa dla rebootUserspace() ()}, która blokuje tylko do momentu, gdy urządzenie jest online, tj. widoczne dla adb.

abstract void remountSystemWritable ()

Ustaw partycję systemową na urządzeniu z możliwością zapisu.

abstract void remountVendorWritable ()

Ustaw partycję dostawcy na urządzeniu z możliwością zapisu.

abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

Wygodna metoda wykonywania ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) z co najmniej jednym odbiornikiem przekazanym jako parametry.

abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners)

Uruchamia testy oprzyrządowania i zapewnia odzyskiwanie urządzeń.

abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners)

To samo co ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) ale uruchamia test dla danego użytkownika.

abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

To samo co ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) ale uruchamia test dla danego użytkownika.

abstract void setDate (Date date)

Ustawia datę na urządzeniu

Uwaga: ustawienie daty na urządzeniu wymaga roota

abstract void setOptions ( TestDeviceOptions options)

Ustaw opcję TestDeviceOptions dla urządzenia

abstract boolean setProperty (String propKey, String propValue)

Ustawia daną wartość właściwości na urządzeniu.

abstract void setRecovery ( IDeviceRecovery recovery)

Ustaw IDeviceRecovery do użycia dla tego urządzenia.

abstract void setRecoveryMode ( ITestDevice.RecoveryMode mode)

Ustaw bieżący tryb odzyskiwania dla urządzenia.

abstract void setUseFastbootErase (boolean useFastbootErase)

Zdecyduj, czy do wyczyszczenia partycji na urządzeniu chcesz użyć szybkiego kasowania lub formatu szybkiego rozruchu.

abstract void startLogcat ()

Rozpocznij przechwytywanie danych wyjściowych logcat z urządzenia w tle.

abstract void stopEmulatorOutput ()

Zamknij i usuń dane wyjściowe emulatora.

abstract void stopLogcat ()

Zatrzymaj przechwytywanie danych wyjściowych logcat z urządzenia i odrzuć aktualnie zapisane dane logcat.

abstract String switchToAdbTcp ()

Przełącz urządzenie w tryb adb-over-tcp.

abstract boolean switchToAdbUsb ()

Przełącz urządzenie w tryb adb przez USB.

abstract boolean syncFiles (File localFileDir, String deviceFilePath)

Przyrostowo synchronizuje zawartość lokalnego katalogu plików z urządzeniem.

abstract boolean unlockDevice ()

Odblokowuje urządzenie, jeśli jest ono w stanie zaszyfrowanym.

abstract boolean waitForBootComplete (long timeOut)

Blokuje do momentu ustawienia flagi ukończenia rozruchu urządzenia.

abstract boolean waitForDeviceAvailable ()

Czeka, aż urządzenie zacznie reagować i będzie dostępne do testowania.

abstract boolean waitForDeviceAvailable (long waitTime)

Czeka, aż urządzenie zacznie reagować i będzie dostępne do testowania.

abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

Czeka, aż urządzenie zacznie reagować i będzie dostępne bez uwzględniania ścieżki odzyskiwania.

abstract void waitForDeviceBootloader ()

Blokuje, dopóki urządzenie nie będzie widoczne przez fastboot.

abstract boolean waitForDeviceInRecovery (long waitTime)

Blokuje, aby urządzenie znajdowało się w stanie „odzyskiwanie adb” (należy pamiętać, że różni się to od IDeviceRecovery ).

abstract boolean waitForDeviceInSideload (long waitTime)

Blokuje, aby urządzenie znajdowało się w stanie „adb sideload”.

abstract boolean waitForDeviceNotAvailable (long waitTime)

Blokuje, aby urządzenie było niedostępne, tj. Brakujące w adb

abstract void waitForDeviceOnline ()

Blokuje, dopóki urządzenie nie będzie widoczne przez adb.

abstract void waitForDeviceOnline (long waitTime)

Blokuje, dopóki urządzenie nie będzie widoczne przez adb.

abstract boolean waitForDeviceShell (long waitTime)

Czeka, aż urządzenie zareaguje na podstawowe polecenie powłoki adb.

Stałe

NIEZNANY_POZIOM API

public static final int UNKNOWN_API_LEVEL

Wartość domyślna, gdy nie można wykryć poziomu interfejsu API

Stała wartość: -1 (0xffffffff)

Metody publiczne

checkApiLevelAgainstNextRelease

public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Sprawdź, czy funkcja jest obecnie obsługiwana przy minimalnym obsługiwanym poziomie. Ta metoda uwzględnia funkcje, które nie zostały jeszcze wydane, zanim zostanie podniesiony poziom API.

Parametry
strictMinLevel int : Ścisły minimalny możliwy poziom, który obsługuje tę funkcję.

Zwroty
boolean Prawda, jeśli poziom jest obsługiwany. Fałsz inaczej.

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

wyczyśćLogcat

public abstract void clearLogcat ()

Usuwa wszelkie zgromadzone dane logcat.

Jest to przydatne w przypadkach, gdy chcesz mieć pewność, że ITestDevice#getLogcat() zwróci tylko dane dziennika utworzone po określonym punkcie (na przykład po flashowaniu nowej wersji urządzenia itp.).

usunąć plik

public abstract void deleteFile (String deviceFilePath)

Metoda pomocnika, aby usunąć plik lub katalog na urządzeniu.

Parametry
deviceFilePath String : Bezwzględna ścieżka do pliku na urządzeniu.

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

Urządzenie zostało ponownie uruchomione

public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

Metoda pomocnika, aby sprawdzić, czy urządzenie zostało ponownie uruchomione, porównując bieżący system_server z poprzednim system_server ProcessInfo . Użyj getProcessByName(String) , aby uzyskać ProcessInfo .

Parametry
prevSystemServerProcess ProcessInfo : poprzedni proces system_server ProcessInfo .

Zwroty
boolean true Jeśli urządzenie zostało ponownie uruchomione

Rzuty
jeśli urządzenie ma nieprawidłowy powód rozruchu
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

deviceSoftRestartedSince

public abstract boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

Metoda pomocnika, aby sprawdzić, czy urządzenie zostało ponownie uruchomione miękko od czasu UTC od epoki z urządzenia i jego ERROR(/TimeUnit) . Soft-Restart odnosi się do serwera system_server uruchomionego ponownie poza twardym ponownym uruchomieniem urządzenia (na przykład: wymagane ponowne uruchomienie). Bieżące urządzenie utcEpochTime w milisekundach można uzyskać za pomocą metody getDeviceDate() .

Parametry
utcEpochTime long : czas urządzenia w sekundach od epoki.

timeUnit TimeUnit : jednostka czasu TimeUnit dla danego utcEpochTime.

Zwroty
boolean true Jeśli urządzenie zostało ponownie uruchomione

Rzuty
jeśli urządzenie ma nieprawidłowy powód rozruchu
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

wyłącz AdbRoot

public abstract boolean disableAdbRoot ()

Wyłącza adb root.

Wyłączenie adb root może spowodować rozłączenie urządzenia z adb. Ta metoda będzie blokować, dopóki urządzenie nie będzie dostępne.

Zwroty
boolean true jeśli się powiedzie.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

czyPlikIstnieje

public abstract boolean doesFileExist (String deviceFilePath)

Metoda pomocnika w celu ustalenia, czy plik na urządzeniu istnieje.

Parametry
deviceFilePath String : bezwzględna ścieżka do pliku na urządzeniu do sprawdzenia

Zwroty
boolean true , jeśli plik istnieje, false w przeciwnym razie.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

włączAdbRoot

public abstract boolean enableAdbRoot ()

Włącza adb root. Jeśli ustawienie „enable-root” ma wartość „false”, zarejestruje komunikat i zwróci bez włączania roota.

Włączenie adb root może spowodować rozłączenie urządzenia z adb. Ta metoda będzie blokować, dopóki urządzenie nie będzie dostępne.

Zwroty
boolean true jeśli się powiedzie.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaćAdbCommand

public abstract String executeAdbCommand (long timeout, 
                String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie adb jako polecenie systemowe z określonym limitem czasu.

executeShellCommand(String) powinno być używane zamiast tego, gdy tylko jest to możliwe, ponieważ ta metoda zapewnia lepsze wykrywanie awarii i lepszą wydajność.

Parametry
timeout long : czas w milisekundach, zanim urządzenie zostanie uznane za niereagujące, 0L oznacza brak limitu czasu

commandArgs String : polecenie adb i argumenty do uruchomienia

Zwroty
String standardowe wyjście z polecenia. null , jeśli wykonanie polecenia nie powiodło się.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaćAdbCommand

public abstract String executeAdbCommand (String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie adb jako polecenie systemowe.

executeShellCommand(String) powinno być używane zamiast tego, gdy tylko jest to możliwe, ponieważ ta metoda zapewnia lepsze wykrywanie awarii i lepszą wydajność.

Parametry
commandArgs String : polecenie adb i argumenty do uruchomienia

Zwroty
String standardowe wyjście z polecenia. null , jeśli wykonanie polecenia nie powiodło się.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaćAdbCommand

public abstract String executeAdbCommand (long timeout, 
                 envMap, 
                String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie adb jako polecenie systemowe z określonym limitem czasu.

executeShellCommand(String) powinno być używane zamiast tego, gdy tylko jest to możliwe, ponieważ ta metoda zapewnia lepsze wykrywanie awarii i lepszą wydajność.

Parametry
timeout long : czas w milisekundach, zanim urządzenie zostanie uznane za niereagujące, 0L oznacza brak limitu czasu

envMap : środowisko do ustawienia dla polecenia

commandArgs String : polecenie adb i argumenty do uruchomienia

Zwroty
String standardowe wyjście z polecenia. null , jeśli wykonanie polecenia nie powiodło się.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie Fastboot

public abstract CommandResult executeFastbootCommand (long timeout, 
                String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie fastboot jako polecenie systemowe.

Oczekuje się, że będzie używany, gdy urządzenie jest już w trybie szybkiego uruchamiania.

Parametry
timeout long : czas w milisekundach przed wygaśnięciem polecenia

commandArgs String : polecenie fastboot i argumenty do uruchomienia

Zwroty
CommandResult CommandResult zawierający dane wyjściowe polecenia

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie Fastboot

public abstract CommandResult executeFastbootCommand (String... commandArgs)

Metoda pomocnicza, która wykonuje polecenie fastboot jako polecenie systemowe z domyślnym limitem czasu wynoszącym 2 minuty.

Oczekuje się, że będzie używany, gdy urządzenie jest już w trybie szybkiego uruchamiania.

Parametry
commandArgs String : polecenie fastboot i argumenty do uruchomienia

Zwroty
CommandResult CommandResult zawierający dane wyjściowe polecenia

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie LongFastboot

public abstract CommandResult executeLongFastbootCommand (String... commandArgs)

Metoda pomocnicza, która wykonuje długotrwałe polecenie fastboot jako polecenie systemowe.

Identyczne z executeFastbootCommand(String) z wyjątkiem tego, że używa dłuższego limitu czasu.

Parametry
commandArgs String : polecenie fastboot i argumenty do uruchomienia

Zwroty
CommandResult CommandResult zawierający dane wyjściowe polecenia

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie LongFastboot

public abstract CommandResult executeLongFastbootCommand ( envVarMap, 
                String... commandArgs)

Metoda pomocnicza, która wykonuje długotrwałe polecenie fastboot jako polecenie systemowe z systemowymi zmiennymi środowiskowymi.

Identyczne z executeFastbootCommand(String) z wyjątkiem tego, że używa dłuższego limitu czasu.

Parametry
envVarMap : systemowe zmienne środowiskowe, z którymi uruchamiane jest polecenie fastboot

commandArgs String : polecenie fastboot i argumenty do uruchomienia

Zwroty
CommandResult CommandResult zawierający dane wyjściowe polecenia

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie powłoki

public abstract String executeShellCommand (String command)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca dane wyjściowe jako ERROR(/String) .

Parametry
command String : polecenie powłoki adb do uruchomienia

Zwroty
String wyjście powłoki

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie powłoki

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

Parametry
command String : polecenie powłoki adb do uruchomienia

receiver IShellOutputReceiver : IShellOutputReceiver do kierowania danych wyjściowych powłoki.

maxTimeToOutputShellResponse long : maksymalny czas, w którym polecenie może nie generować żadnej odpowiedzi; jednostka określona w timeUnit

timeUnit TimeUnit : jednostka dla maxTimeToOutputShellResponse

retryAttempts int : maksymalna liczba ponownych prób wykonania polecenia, jeśli nie powiedzie się z powodu wyjątku. DeviceNotResponsiveException zostanie zgłoszony, jeśli retryAttempts zostaną wykonane bez powodzenia.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie powłoki

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeoutForCommand, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

Parametry
command String : polecenie powłoki adb do uruchomienia

receiver IShellOutputReceiver : IShellOutputReceiver do kierowania danych wyjściowych powłoki.

maxTimeoutForCommand long : maksymalny czas oczekiwania na wykonanie polecenia; jednostka określona w timeUnit

maxTimeToOutputShellResponse long : maksymalny czas, w którym polecenie może nie generować żadnej odpowiedzi; jednostka określona w timeUnit

timeUnit TimeUnit : jednostka dla maxTimeToOutputShellResponse

retryAttempts int : maksymalna liczba ponownych prób wykonania polecenia, jeśli nie powiedzie się z powodu wyjątku. DeviceNotResponsiveException zostanie zgłoszony, jeśli retryAttempts zostaną wykonane bez powodzenia.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie powłoki

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

Wykonuje podane polecenie powłoki adb, ponawiając wiele razy, jeśli polecenie się nie powiedzie.

Prostsza forma executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int) z wartościami domyślnymi.

Parametry
command String : polecenie powłoki adb do uruchomienia

receiver IShellOutputReceiver : IShellOutputReceiver do kierowania danych wyjściowych powłoki.

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca wyniki jako CommandResult poprawnie wypełnione danymi wyjściowymi stanu polecenia, stdout i stderr.

Parametry
command String : Polecenie, które powinno zostać uruchomione.

Zwroty
CommandResult Wynik w CommandResult .

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                OutputStream pipeToOutput)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca wyniki jako CommandResult poprawnie wypełniony danymi wyjściowymi stanu polecenia i stderr. stdout jest kierowane do określonego strumienia.

Parametry
command String : Polecenie, które powinno zostać uruchomione.

pipeToOutput OutputStream : ERROR(/OutputStream) gdzie standardowe wyjście zostanie przekierowane lub null.

Zwroty
CommandResult Wynik w CommandResult .

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput)

Metoda pomocnicza, która wykonuje polecenie powłoki adb i zwraca wyniki jako CommandResult poprawnie wypełnione danymi wyjściowymi stanu polecenia, stdout i stderr.

Parametry
command String : Polecenie, które powinno zostać uruchomione.

pipeAsInput File : ERROR(/File) , który zostanie przesłany jako dane wejściowe do polecenia lub null.

Zwroty
CommandResult Wynik w CommandResult .

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

Parametry
command String : polecenie powłoki adb do uruchomienia

maxTimeoutForCommand long : maksymalny czas oczekiwania na wykonanie polecenia; jednostka określona w timeUnit

timeUnit TimeUnit : jednostka dla maxTimeToOutputShellResponse

retryAttempts int : maksymalna liczba ponownych prób wykonania polecenia, jeśli nie powiedzie się z powodu wyjątku. DeviceNotResponsiveException zostanie zgłoszony, jeśli retryAttempts zostaną wykonane bez powodzenia.

Zwroty
CommandResult

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

Parametry
command String : polecenie powłoki adb do uruchomienia

maxTimeoutForCommand long : maksymalny czas oczekiwania na wykonanie polecenia; jednostka określona w timeUnit

timeUnit TimeUnit : jednostka dla maxTimeToOutputShellResponse

Zwroty
CommandResult

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

Parametry
command String : polecenie powłoki adb do uruchomienia

pipeAsInput File : ERROR(/File) , który zostanie przesłany jako dane wejściowe do polecenia lub null.

pipeToOutput OutputStream : ERROR(/OutputStream) gdzie standardowe wyjście zostanie przekierowane lub null.

maxTimeoutForCommand long : maksymalny czas oczekiwania na wykonanie polecenia; jednostka określona w timeUnit

timeUnit TimeUnit : jednostka dla maxTimeToOutputShellResponse

retryAttempts int : maksymalna liczba ponownych prób wykonania polecenia, jeśli nie powiedzie się z powodu wyjątku. DeviceNotResponsiveException zostanie zgłoszony, jeśli retryAttempts zostaną wykonane bez powodzenia.

Zwroty
CommandResult

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

wykonaj polecenie ShellV2

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                OutputStream pipeToError, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Wykonuje polecenie powłoki adb, z większą liczbą parametrów do kontrolowania zachowania polecenia.

Parametry
command String : polecenie powłoki adb do uruchomienia

pipeAsInput File : ERROR(/File) , który zostanie przesłany jako dane wejściowe do polecenia lub null.

pipeToOutput OutputStream : ERROR(/OutputStream) gdzie standardowe wyjście zostanie przekierowane lub null.

pipeToError OutputStream : ERROR(/OutputStream) gdzie std błąd zostanie przekierowany lub null.

maxTimeoutForCommand long : maksymalny czas oczekiwania na wykonanie polecenia; jednostka określona w timeUnit

timeUnit TimeUnit : jednostka dla maxTimeToOutputShellResponse

retryAttempts int : maksymalna liczba ponownych prób wykonania polecenia, jeśli nie powiedzie się z powodu wyjątku. DeviceNotResponsiveException zostanie zgłoszony, jeśli retryAttempts zostaną wykonane bez powodzenia.

Zwroty
CommandResult

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

fastboot wyczyść partycję

public abstract CommandResult fastbootWipePartition (String partition)

Metoda pomocnicza, która czyści partycję dla urządzenia.

Jeśli getUseFastbootErase() ma true , do wyczyszczenia partycji zostanie użyte szybkie wymazywanie. Urządzenie musi następnie utworzyć system plików przy następnym uruchomieniu urządzenia. W przeciwnym razie używany jest format fastboot, który utworzy nowy system plików na urządzeniu.

Oczekuje się, że będzie używany, gdy urządzenie jest już w trybie szybkiego uruchamiania.

Parametry
partition String : partycja do wyczyszczenia

Zwroty
CommandResult CommandResult zawierający dane wyjściowe polecenia

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

pobierzPoziomApi

public abstract int getApiLevel ()

Uzyskaj poziom interfejsu API urządzenia. Domyślnie UNKNOWN_API_LEVEL .

Zwroty
int liczba całkowita wskazująca poziom API urządzenia

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

pobierz wersję pasma podstawowego

public abstract String getBasebandVersion ()

Wygodna metoda uzyskania wersji pasma podstawowego (radiowego) tego urządzenia. Uzyskanie wersji radiowej zależy od urządzenia, więc może nie zwracać prawidłowych informacji dla wszystkich urządzeń. Ta metoda opiera się na właściwości gsm.version.baseband w celu zwrócenia poprawnych informacji o wersji. Nie jest to dokładne w przypadku niektórych urządzeń CDMA, a zwrócona tutaj wersja może nie być zgodna z wersją zgłoszoną przez fastboot i może nie zwracać wersji dla radia CDMA. TL;DR ta metoda zgłasza dokładną wersję tylko wtedy, gdy właściwość gsm.version.baseband jest taka sama jak wersja zwrócona przez fastboot getvar version-baseband .

Zwroty
String wersja pasma podstawowego ERROR(/String) lub null , jeśli nie można jej określić (urządzenie nie ma radia lub nie można odczytać ciągu znaków wersji)

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

pobierz baterię

public abstract Integer getBattery ()

Zwraca bieżący poziom naładowania baterii urządzenia lub wartość Null, jeśli poziom naładowania baterii jest niedostępny.

Zwroty
Integer

getBooleanProperty

public abstract boolean getBooleanProperty (String name, 
                boolean defaultValue)

Zwraca wartość logiczną podanej właściwości.

Parametry
name String : nazwa właściwości

defaultValue boolean : domyślna wartość zwracana, jeśli właściwość jest pusta lub nie istnieje.

Zwroty
boolean true , jeśli właściwość ma wartość "1" , "y" , "yes" , "on" lub "true" , false jeśli właściwość ma wartość "0" , "n" , "no" , "off" , "false" lub defaultValue w inny sposób.

Rzuty
DeviceNotAvailableException

pobierz historię rozruchu

public abstract  getBootHistory ()

Metoda pomocnicza zbiera mapę historii rozruchu z czasem rozruchu i przyczyną rozruchu.

Zwroty
Mapa czasu rozruchu (czas UTC w sekundach od Epoki) i przyczyna rozruchu

Rzuty
DeviceNotAvailableException

getBootHistorySince

public abstract  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

Metoda pomocnicza zbiera mapę historii rozruchu z czasem rozruchu i przyczyną rozruchu od podanego czasu od epoki z urządzenia i określonej jednostki czasu. Bieżące urządzenie utcEpochTime w milisekundach można uzyskać za pomocą metody getDeviceDate() .

Parametry
utcEpochTime long : czas urządzenia od Epoki.

timeUnit TimeUnit : jednostka czasu TimeUnit .

Zwroty
Mapa czasu rozruchu (czas UTC w sekundach od Epoki) i przyczyna rozruchu

Rzuty
DeviceNotAvailableException

getBootloaderVersion

public abstract String getBootloaderVersion ()

Wygodny sposób na uzyskanie wersji bootloadera tego urządzenia.

Spróbuje pobrać wersję programu ładującego z bieżącego stanu urządzenia. (tj. jeśli urządzenie jest w trybie fastboot, spróbuje pobrać wersję z fastboot)

Zwroty
String wersję programu ładującego ERROR(/String) lub null , jeśli nie można go znaleźć

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

getBuildAlias

public abstract String getBuildAlias ()

Pobierz alias kompilacji, która jest aktualnie uruchomiona na urządzeniu.

Alias ​​kompilacji jest zwykle bardziej czytelnym ciągiem znaków niż identyfikator kompilacji (zwykle liczba w przypadku kompilacji Nexusa). Na przykład ostateczna wersja Androida 4.2 ma alias kompilacji JDQ39 i identyfikator kompilacji 573038

Zwroty
String alias kompilacji lub cofnij się do identyfikatora kompilacji, jeśli nie można go odzyskać

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildFlavour

public abstract String getBuildFlavor ()

Pobierz smak kompilacji dla urządzenia.

Zwroty
String smak kompilacji lub null, jeśli nie można go odzyskać

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildId

public abstract String getBuildId ()

Pobierz kompilację aktualnie uruchomioną na urządzeniu.

Zwroty
String identyfikator kompilacji lub IBuildInfo#UNKNOWN_BUILD_ID , jeśli nie można go pobrać

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildSigningKeys

public abstract String getBuildSigningKeys ()

Zwraca typ klucza używany do podpisania obrazu urządzenia

Zazwyczaj urządzenia z Androidem mogą być podpisywane za pomocą kluczy testowych (jak w AOSP) lub kluczy zwalniających (kontrolowanych przez poszczególnych producentów urządzeń)

Zwroty
String Klucz podpisywania, jeśli został znaleziony, null w przeciwnym razie.

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getCachedDeviceDescriptor

public abstract DeviceDescriptor getCachedDeviceDescriptor ()

Zwraca buforowany DeviceDescriptor jeśli urządzenie jest przydzielone, w przeciwnym razie zwraca bieżący DeviceDescriptor .

Zwroty
DeviceDescriptor

getCachedDeviceDescriptor

public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Zwraca buforowany DeviceDescriptor jeśli urządzenie jest przydzielone, w przeciwnym razie zwraca bieżący DeviceDescriptor .

Parametry
shortDescriptor boolean : Określa, czy ograniczyć deskryptor do minimum informacji

Zwroty
DeviceDescriptor

dostać Dzieci

public abstract String[] getChildren (String deviceFilePath)

Alternatywa dla używania IFileEntry , która czasami nie działa z powodu uprawnień.

Parametry
deviceFilePath String : to ścieżka na urządzeniu, w którym należy przeprowadzić wyszukiwanie

Zwroty
String[] Tablica ciągów znaków zawierająca cały plik w ścieżce na urządzeniu.

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getConnection

public abstract AbstractConnection getConnection ()

Zwraca połączenie skojarzone z urządzeniem.

Zwroty
AbstractConnection

getDeviceClass

public abstract String getDeviceClass ()

Pobierz klasę urządzenia.

Zwroty
String klasa urządzenia ERROR(/String) .

getDeviceDate

public abstract long getDeviceDate ()

Zwróć datę urządzenia w milisekundach od epoki.

Zwroty
long data urządzenia w formacie epoki.

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getDeviceDescriptor

public abstract DeviceDescriptor getDeviceDescriptor ()

Zwróć DeviceDescriptor z informacji o urządzeniu, aby uzyskać informacje na jego temat bez przekazywania rzeczywistego obiektu urządzenia.

Zwroty
DeviceDescriptor

getDeviceDescriptor

public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Zwróć DeviceDescriptor z informacji o urządzeniu, aby uzyskać informacje na jego temat bez przekazywania rzeczywistego obiektu urządzenia.

Parametry
shortDescriptor boolean : Określa, czy ograniczyć deskryptor do minimum informacji

Zwroty
DeviceDescriptor

pobierz stan urządzenia

public abstract TestDeviceState getDeviceState ()

Pobierz stan urządzenia.

Zwroty
TestDeviceState

getDeviceTimeOffset

public abstract long getDeviceTimeOffset (Date date)

Pomocnik, aby uzyskać różnicę czasu między urządzeniem a danym ERROR(/Date) . Użyj czasu Epoki wewnętrznie.

Parametry
date Date

Zwroty
long różnica w milisekundach

Rzuty
DeviceNotAvailableException

getEmulatorOutput

public abstract InputStreamSource getEmulatorOutput ()

Pobierz strumień emulatora stdout i stderr

Zwroty
InputStreamSource wyjście emulatora

getExternalStoreFreeSpace

public abstract long getExternalStoreFreeSpace ()

Metoda pomocnicza do określania ilości wolnego miejsca w pamięci zewnętrznej urządzenia.

Zwroty
long ilość wolnego miejsca w KB

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

getFastbootProductType

public abstract String getFastbootProductType ()

Wygodna metoda uzyskiwania typu produktu tego urządzenia, gdy jest ono w trybie szybkiego uruchamiania.

Ta metoda powinna być używana tylko wtedy, gdy urządzenie powinno być w trybie fastboot. W tym przypadku jest to nieco bezpieczniejsza odmiana niż ogólna metoda getProductType() , ponieważ ITestDevice będzie wiedziało, jak przywrócić urządzenie do szybkiego rozruchu, jeśli urządzenie jest w nieprawidłowym stanie lub nie odpowiada.

Zwroty
String nazwę typu produktu ERROR(/String) lub null , jeśli nie można jej określić

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

getFastbootProductVariant

public abstract String getFastbootProductVariant ()

Wygodna metoda uzyskiwania typu produktu tego urządzenia, gdy jest ono w trybie szybkiego uruchamiania.

Ta metoda powinna być używana tylko wtedy, gdy urządzenie powinno być w trybie fastboot. W tym przypadku jest to nieco bezpieczniejsza odmiana niż ogólna metoda getProductType() , ponieważ ITestDevice będzie wiedziało, jak przywrócić urządzenie do szybkiego rozruchu, jeśli urządzenie jest w nieprawidłowym stanie lub nie odpowiada.

Zwroty
String nazwę typu produktu ERROR(/String) lub null , jeśli nie można jej określić

Rzuty
DeviceNotAvailableException jeśli połączenie z urządzeniem zostało utracone i nie można go odzyskać.

getFastbootSerialNumber

public abstract String getFastbootSerialNumber ()

Zwraca numer seryjny trybu szybkiego uruchamiania.

Zwroty
String

getFastbootVariable

public abstract String getFastbootVariable (String variableName)

Pobierz z urządzenia podaną wartość zmiennej fastboot.

Parametry
variableName String : nazwa zmiennej

Zwroty
String wartość właściwości lub null , jeśli nie istnieje

Rzuty
Nieobsługiwany wyjątek operacji
DeviceNotAvailableException

pobierz wpis do pliku

public abstract IFileEntry getFileEntry (String path)

Pobierz odwołanie do zdalnego pliku na urządzeniu.

Parametry
path String : ścieżka pliku do pobrania. Może być ścieżką bezwzględną lub ścieżką względną do „/”. (tj. obsługiwana jest zarówno składnia „/ system”, jak i „system”)

Zwroty
IFileEntry IFileEntry lub null , jeśli nie można znaleźć pliku w podanej path

Rzuty
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getIDevice

public abstract IDevice getIDevice ()

Zwraca odwołanie do powiązanego ddmlib IDevice .

Nowy IDevice może zostać przydzielony przez DDMS za każdym razem, gdy urządzenie odłącza się i ponownie łączy z adb. W związku z tym wywołujący nie powinni przechowywać odwołania do IDevice , ponieważ to odwołanie może stać się nieaktualne.

Zwroty
IDevice IDevice

getIntProperty

public abstract long getIntProperty (String name, 
                long defaultValue)

Zwraca wartość całkowitą podanej właściwości z urządzenia.

Parametry
name String : nazwa właściwości

defaultValue long : wartość domyślna do zwrócenia, jeśli właściwość jest pusta lub nie istnieje.

Zwroty
long the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value.

Throws
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()) .

Zwroty
long

getLaunchApiLevel

public abstract int getLaunchApiLevel ()

Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL .

Zwroty
int an integer indicating the first launched API Level of device

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getLogcat

public abstract InputStreamSource getLogcat ()

Grabs a snapshot stream of the logcat data.

Works in two modes:

  • If the logcat is currently being captured in the background, will return up to TestDeviceOptions.getMaxLogcatDataSize() bytes of the current contents of the background logcat capture
  • Otherwise, will return a static dump of the logcat data if device is currently responding

    Zwroty
    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.

    Parametry
    maxBytes int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory

    Zwroty
    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.

    Zwroty
    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() .

    Parametry
    date long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s')

    Zwroty
    InputStreamSource

    getMountPoint

    public abstract String getMountPoint (String mountName)

    Returns a mount point.

    Queries the device directly if the cached info in IDevice is not available.

    TODO: move this behavior to IDevice#getMountPoint(String)

    Parametry
    mountName String : the name of the mount point

    Zwroty
    String the mount point or null

    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.

    Parametry
    mountpoint String

    Zwroty
    ITestDevice.MountPointInfo A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    Throws
    DeviceNotAvailableException

    getMountPointInfo

    public abstract  getMountPointInfo ()

    Returns a parsed version of the information in /proc/mounts on the device

    Zwroty
    A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts"

    Throws
    DeviceNotAvailableException

    getPartitionFreeSpace

    public abstract long getPartitionFreeSpace (String partition)

    Helper method to determine amount of free space on device partition.

    Parametry
    partition String

    Zwroty
    long the amount of free space in KB

    Throws
    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.

    Parametry
    processName String : the proces name String.

    Zwroty
    ProcessInfo ProcessInfo of given processName

    Throws
    DeviceNotAvailableException

    getProcessPid

    public abstract String getProcessPid (String process)

    Returns the pid of the service or null if something went wrong.

    Parametry
    process String : The proces name String.

    Zwroty
    String

    Throws
    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.

    Zwroty
    String the ERROR(/String) product type name. Will not be null

    Throws
    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.

    Zwroty
    String the ERROR(/String) product variant name or null if it cannot be determined

    Throws
    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.

    Parametry
    name String : the property name

    Zwroty
    String the property value or null if it does not exist

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    getRecoveryMode

    public abstract ITestDevice.RecoveryMode getRecoveryMode ()

    Get the current recovery mode used for the device.

    Zwroty
    ITestDevice.RecoveryMode the current recovery mode used for the device.

    getSerialNumber

    public abstract String getSerialNumber ()

    Convenience method to get serial number of this device.

    Zwroty
    String the ERROR(/String) serial number

    getTombstones

    public abstract  getTombstones ()

    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.

    Zwroty
    A list of tombstone files, empty if no tombstone.

    Throws
    DeviceNotAvailableException

    getTotalMemory

    public abstract long getTotalMemory ()

    Returns total physical memory size in bytes or -1 in case of internal error

    Zwroty
    long

    getUseFastbootErase

    public abstract boolean getUseFastbootErase ()

    Get whether to use fastboot erase or fastboot format to wipe a partition on the device.

    Zwroty
    boolean true if fastboot erase will be used or false if fastboot format will be used.

    isAdbRoot

    public abstract boolean isAdbRoot ()

    Zwroty
    boolean true if device currently has adb root, false otherwise.

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered.

    isAdbTcp

    public abstract boolean isAdbTcp ()

    Zwroty
    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

    Zwroty
    boolean True if app enumeration is supported, false otherwise

    Throws
    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

    Zwroty
    boolean True if bypass low target sdk block is supported, false otherwise

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isDeviceEncrypted

    public abstract boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    Zwroty
    boolean true if the device is encrypted.

    Throws
    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.

    Parametry
    deviceFilePath String

    Zwroty
    boolean

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isEncryptionSupported

    public abstract boolean isEncryptionSupported ()

    Returns if encryption is supported on the device.

    Zwroty
    boolean true if the device supports encryption.

    Throws
    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.

    Parametry
    fullPath String

    Zwroty
    boolean

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isHeadless

    public abstract boolean isHeadless ()

    Return true if the device is headless (no screen), false otherwise.

    Zwroty
    boolean

    Throws
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public abstract boolean isRuntimePermissionSupported ()

    Check whether platform on device supports runtime permission granting

    Zwroty
    boolean True if runtime permission are supported, false otherwise.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isStateBootloaderOrFastbootd

    public abstract boolean isStateBootloaderOrFastbootd ()

    Returns true if device is in TestDeviceState#FASTBOOT or TestDeviceState.FASTBOOTD .

    Zwroty
    boolean

    logAnrs

    public abstract boolean logAnrs (ITestLogger logger)

    Collects and log ANRs from the device.

    Parametry
    logger ITestLogger : an ITestLogger to log the ANRs.

    Zwroty
    boolean True if the logging was successful, false otherwise.

    Throws
    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.

    Parametry
    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.

    Throws
    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)

    Throws
    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.

    Parametry
    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.

    Parametry
    info IBuildInfo : The IBuildInfo of the device.

    attributes MultiMap : The attributes stored in the invocation context

    Throws
    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.

    Parametry
    deviceFilePath String : the absolute file path of the remote source

    localDir File : the local directory to pull files into

    Zwroty
    boolean true if file was pulled successfully. false otherwise.

    Throws
    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 .

    Parametry
    remoteFilePath String : the absolute path to file on device.

    userId int : The user id to pull from

    Zwroty
    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)

    Throws
    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 .

    Parametry
    remoteFilePath String : the absolute path to file on device.

    Zwroty
    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)

    Throws
    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.

    Parametry
    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.

    Zwroty
    boolean true if file was retrieved successfully. false otherwise.

    Throws
    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.

    Parametry
    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

    Zwroty
    boolean true if file was retrieved successfully. false otherwise.

    Throws
    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.

    Parametry
    remoteFilePath String : the absolute path to file on device.

    Zwroty
    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)

    Throws
    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 .

    Parametry
    remoteFilePath String : the path to file on device, relative to the device's external storage mountpoint

    Zwroty
    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)

    Throws
    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.

    Parametry
    localDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    excludedDirectories : Set of excluded directories names that shouldn't be pushed.

    Zwroty
    boolean true if file was pushed successfully. false otherwise.

    Throws
    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.

    Parametry
    localDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    Zwroty
    boolean true if file was pushed successfully. false otherwise.

    Throws
    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.

    Parametry
    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

    Zwroty
    boolean true if file was pushed successfully. false otherwise.

    Throws
    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.

    Parametry
    localFile File : the local file to push

    deviceFilePath String : the remote destination absolute file path

    Zwroty
    boolean true if file was pushed successfully. false otherwise.

    Throws
    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

    Parametry
    contents String : the contents of the file to push

    deviceFilePath String : the remote destination absolute file path

    Zwroty
    boolean true if string was pushed successfully. false otherwise.

    Throws
    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.

    Throws
    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.

    Parametry
    reason String : a reason for this reboot, or null if no reason is specified.

    Throws
    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.

    Throws
    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.

    Throws
    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 recovery

    Throws
    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

    Parametry
    autoReboot boolean : whether to automatically reboot the device after sideload

    Throws
    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

    Throws
    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.

    Throws
    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.

    Parametry
    reason String : a reason for this reboot, or null if no reason is specified.

    Throws
    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.

    Throws
    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.

    Throws
    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.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountVendorWritable

    public abstract void remountVendorWritable ()

    Make the vendor partition on the device writable. May reboot the device.

    Throws
    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.

    Parametry
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners ITestLifeCycleReceiver : the test result listener(s)

    Zwroty
    boolean true if test command completed. false if it failed to complete, but recovery succeeded

    Throws
    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.

    Parametry
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners : the test result listeners

    Zwroty
    boolean true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded

    Throws
    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.

    Parametry
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    Zwroty
    boolean

    Throws
    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.

    Parametry
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    Zwroty
    boolean

    Throws
    DeviceNotAvailableException

    setDate

    public abstract void setDate (Date date)

    Sets the date on device

    Note: setting date on device requires root

    Parametry
    date Date : specify a particular date; will use host date if null

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    setOptions

    public abstract void setOptions (TestDeviceOptions options)

    Set the TestDeviceOptions for the device

    Parametry
    options TestDeviceOptions

    setProperty

    public abstract boolean setProperty (String propKey, 
                    String propValue)

    Sets the given property value on the device. Requires adb root is true.

    Parametry
    propKey String : The key targeted to be set.

    propValue String : The property value to be set.

    Zwroty
    boolean returns True if the setprop command was successful, False otherwise.

    Throws
    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.

    Parametry
    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, etc

    Parametry
    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.

    Parametry
    useFastbootErase boolean : true if fastboot erase should be used or false if fastboot format should be used.

    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.

    Zwroty
    String the tcp serial number or null if device could not be switched

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    switchToAdbUsb

    public abstract boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    Zwroty
    boolean true if switch was successful, false otherwise.

    Throws
    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.

    Parametry
    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

    Zwroty
    boolean true if files were synced successfully. false otherwise.

    Throws
    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 call postBootSetup() . Therefore, the device might not be fully ready to be tested when this method returns.

    Zwroty
    boolean true if successful or if the device is unencrypted.

    Throws
    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.

    Parametry
    timeOut long : time in msecs to wait for the flag to be set

    Zwroty
    boolean true if device's boot complete flag is set within the timeout

    Throws
    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.

    Zwroty
    boolean True if device is available, False if recovery is disabled and unavailable.

    Throws
    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.

    Parametry
    waitTime long : the time in ms to wait

    Zwroty
    boolean True if device is available, False if recovery is disabled and unavailable.

    Throws
    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.

    Parametry
    waitTime long

    Zwroty
    boolean True if device is available, False if unavailable.

    Throws
    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.

    Throws
    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 ).

    Parametry
    waitTime long : the time in ms to wait

    Zwroty
    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

    Parametry
    waitTime long : the time in ms to wait

    Zwroty
    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

    Parametry
    waitTime long : the time in ms to wait

    Zwroty
    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. Use waitForDeviceAvailable() instead.

    Throws
    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. Use waitForDeviceAvailable() instead.

    Parametry
    waitTime long : the time in ms to wait

    Throws
    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.

    Parametry
    waitTime long : the time in ms to wait

    Zwroty
    boolean true if device becomes responsive before waitTime elapses.