Urządzenie testowe
public class TestDevice
extends NativeDevice
Znane bezpośrednie podklasy |
Implementacja ITestDevice
dla urządzenia z systemem Android z pełnym stosem
Streszczenie
Pola |
---|
public static final String | DISMISS_KEYGUARD_CMD Polecenia, których można użyć do zwolnienia blokady klawiatury. |
Metody publiczne |
---|
boolean | clearErrorDialogs () |
int | createUser (String name) |
int | createUser (String name, boolean guest, boolean ephemeral) |
int | createUserNoThrow (String name) |
void | disableKeyguard () |
boolean | doesFileExist (String deviceFilePath) |
File | dumpHeap (String process, String devicePath) |
| getActiveApexes () |
| getAllSettings (String namespace) |
String | getAndroidId (int userId) |
| getAndroidIds () |
PackageInfo | getAppPackageInfo (String packageName) |
| getAppPackageInfos () |
DeviceFoldableState | getCurrentFoldableState () |
int | getCurrentUser () |
| getFoldableStates () |
| getInstalledPackageNames () |
KeyguardControllerState | getKeyguardState () |
| getMainlineModuleInfo () |
int | getMaxNumberOfRunningUsersSupported () |
int | getMaxNumberOfUsersSupported () |
Integer | getPrimaryUserId () |
InputStreamSource | getScreenshot () |
InputStreamSource | getScreenshot (String format, boolean rescale) |
InputStreamSource | getScreenshot (String format) |
InputStreamSource | getScreenshot (long displayId) |
String | getSetting (String namespace, String key) |
String | getSetting (int userId, String namespace, String key) |
| getUninstallablePackageNames () |
int | getUserFlags (int userId) |
| getUserInfos () |
int | getUserSerialNumber (int userId) |
boolean | hasFeature (String feature) |
String | installPackage (File packageFile, boolean reinstall, String... extraArgs) |
String | installPackage (File packageFile, File certFile, boolean reinstall, String... extraArgs) |
String | installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs) |
String | installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) |
String | installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs) |
String | installPackages ( packageFiles, boolean reinstall, String... extraArgs) installPackages ( packageFiles, boolean reinstall, String... extraArgs) |
String | installPackages ( packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs) installPackages ( packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs) |
String | installPackagesForUser ( packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) installPackagesForUser ( packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) |
String | installPackagesForUser ( packageFiles, boolean reinstall, int userId, String... extraArgs) installPackagesForUser ( packageFiles, boolean reinstall, int userId, String... extraArgs) |
String | installRemotePackages ( remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs) installRemotePackages ( remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs) |
String | installRemotePackages ( remoteApkPaths, boolean reinstall, String... extraArgs) installRemotePackages ( remoteApkPaths, boolean reinstall, String... extraArgs) |
boolean | isAppEnumerationSupported () |
boolean | isMultiUserSupported () |
boolean | isPackageInstalled (String packageName) |
boolean | isPackageInstalled (String packageName, String userId) |
boolean | isUserRunning (int userId) |
boolean | isUserSecondary (int userId) |
| listDisplayIds () |
| listUsers () |
void | postInvocationTearDown (Throwable exception) |
boolean | removeAdmin (String componentName, int userId) |
void | removeOwners () |
boolean | removeUser (int userId) |
boolean | setDeviceOwner (String componentName, int userId) |
void | setSetting (String namespace, String key, String value) |
void | setSetting (int userId, String namespace, String key, String value) |
boolean | startUser (int userId) |
boolean | startUser (int userId, boolean waitFlag) |
boolean | stopUser (int userId, boolean waitFlag, boolean forceFlag) |
boolean | stopUser (int userId) |
boolean | switchUser (int userId) |
boolean | switchUser (int userId, long timeout) |
String | uninstallPackage (String packageName) |
String | uninstallPackageForUser (String packageName, int userId) |
Pola
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
Polecenia, których można użyć do zwolnienia blokady klawiatury.
Konstruktorzy publiczni
Urządzenie testowe
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Metody publiczne
wyczyść okno dialogowe błędów
public boolean clearErrorDialogs ()
Rzuca |
---|
DeviceNotAvailableException | |
Stwórz użytkownika
public int createUser (String name)
Rzuca |
---|
DeviceNotAvailableException | |
Stwórz użytkownika
public int createUser (String name,
boolean guest,
boolean ephemeral)
Parametry |
---|
name | String |
guest | boolean |
ephemeral | boolean |
Rzuca |
---|
DeviceNotAvailableException | |
utwórzUserNoThrow
public int createUserNoThrow (String name)
Rzuca |
---|
DeviceNotAvailableException | |
wyłącz Keyguarda
public void disableKeyguard ()
Rzuca |
---|
DeviceNotAvailableException | |
czy plik istnieje
public boolean doesFileExist (String deviceFilePath)
Parametry |
---|
deviceFilePath | String |
Rzuca |
---|
DeviceNotAvailableException | |
sterta zrzutu
public File dumpHeap (String process,
String devicePath)
Parametry |
---|
process | String |
devicePath | String |
Rzuca |
---|
DeviceNotAvailableException | |
pobierz ActiveApexy
public getActiveApexes ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierzWszystkieUstawienia
public getAllSettings (String namespace)
Parametry |
---|
namespace | String |
Rzuca |
---|
DeviceNotAvailableException | |
pobierz identyfikator Androida
public String getAndroidId (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
pobierz identyfikatory Androida
public getAndroidIds ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierz informacje o pakiecie aplikacji
public PackageInfo getAppPackageInfo (String packageName)
Parametry |
---|
packageName | String |
Rzuca |
---|
DeviceNotAvailableException | |
pobierzInformacje o pakiecie aplikacji
public getAppPackageInfos ()
Rzuca |
---|
DeviceNotAvailableException | |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Zwroty |
---|
DeviceFoldableState | |
Rzuca |
---|
DeviceNotAvailableException | |
pobierz bieżącego użytkownika
public int getCurrentUser ()
Rzuca |
---|
DeviceNotAvailableException | |
getFoldableStates
public getFoldableStates ()
Rzuca |
---|
DeviceNotAvailableException | |
getInstalledPackageNames
public getInstalledPackageNames ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierzKeyguardState
public KeyguardControllerState getKeyguardState ()
Zwroty |
---|
KeyguardControllerState | |
Rzuca |
---|
DeviceNotAvailableException | |
pobierzMainlineModuleInfo
public getMainlineModuleInfo ()
Rzuca |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfRunningUsersSupported ()
Rzuca |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierz identyfikator użytkownika podstawowego
public Integer getPrimaryUserId ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierz zrzut ekranu
public InputStreamSource getScreenshot ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierz zrzut ekranu
public InputStreamSource getScreenshot (String format,
boolean rescale)
Parametry |
---|
format | String |
rescale | boolean |
Rzuca |
---|
DeviceNotAvailableException | |
pobierz zrzut ekranu
public InputStreamSource getScreenshot (String format)
Rzuca |
---|
DeviceNotAvailableException | |
pobierz zrzut ekranu
public InputStreamSource getScreenshot (long displayId)
Rzuca |
---|
DeviceNotAvailableException | |
pobierz ustawienie
public String getSetting (String namespace,
String key)
Parametry |
---|
namespace | String |
key | String |
Rzuca |
---|
DeviceNotAvailableException | |
pobierz ustawienie
public String getSetting (int userId,
String namespace,
String key)
Parametry |
---|
userId | int |
namespace | String |
key | String |
Rzuca |
---|
DeviceNotAvailableException | |
getUninstallablePackageNames
public getUninstallablePackageNames ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierz flagi użytkownika
public int getUserFlags (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
pobierz informacje o użytkowniku
public getUserInfos ()
Rzuca |
---|
DeviceNotAvailableException | |
pobierz numer seryjny użytkownika
public int getUserSerialNumber (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
ma funkcję
public boolean hasFeature (String feature)
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiet
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Parametry |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiet
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Parametry |
---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiet
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parametry |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstalujPakietDlaUżytkownika
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Parametry |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstalujPakietDlaUżytkownika
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Parametry |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiety
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Parametry |
---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiety
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parametry |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstalujPakietyDla Użytkownika
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Parametry |
---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstalujPakietyDla Użytkownika
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Parametry |
---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiety zdalne
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parametry |
---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
zainstaluj pakiety zdalne
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Parametry |
---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
Rzuca |
---|
DeviceNotAvailableException | |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Rzuca |
---|
DeviceNotAvailableException | |
isMultiUserSupported
public boolean isMultiUserSupported ()
Rzuca |
---|
DeviceNotAvailableException | |
jestZainstalowany pakiet
public boolean isPackageInstalled (String packageName)
Parametry |
---|
packageName | String |
Rzuca |
---|
DeviceNotAvailableException | |
jestZainstalowany pakiet
public boolean isPackageInstalled (String packageName,
String userId)
Parametry |
---|
packageName | String |
userId | String |
Rzuca |
---|
DeviceNotAvailableException | |
isUserRunning
public boolean isUserRunning (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
jestUserSecondary
public boolean isUserSecondary (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
listaDisplayIds
public listDisplayIds ()
Rzuca |
---|
DeviceNotAvailableException | |
listaUżytkownicy
public listUsers ()
Rzuca |
---|
DeviceNotAvailableException | |
postInwokacjaTearDown
public void postInvocationTearDown (Throwable exception)
Parametry |
---|
exception | Throwable |
usuńAdministratora
public boolean removeAdmin (String componentName,
int userId)
Parametry |
---|
componentName | String |
userId | int |
Rzuca |
---|
DeviceNotAvailableException | |
usuń właścicieli
public void removeOwners ()
Rzuca |
---|
DeviceNotAvailableException | |
usuń użytkownika
public boolean removeUser (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
ustaw właściciela urządzenia
public boolean setDeviceOwner (String componentName,
int userId)
Parametry |
---|
componentName | String |
userId | int |
Rzuca |
---|
DeviceNotAvailableException | |
ustawUstawienie
public void setSetting (String namespace,
String key,
String value)
Parametry |
---|
namespace | String |
key | String |
value | String |
Rzuca |
---|
DeviceNotAvailableException | |
ustawUstawienie
public void setSetting (int userId,
String namespace,
String key,
String value)
Parametry |
---|
userId | int |
namespace | String |
key | String |
value | String |
Rzuca |
---|
DeviceNotAvailableException | |
uruchom użytkownika
public boolean startUser (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
uruchom użytkownika
public boolean startUser (int userId,
boolean waitFlag)
Parametry |
---|
userId | int |
waitFlag | boolean |
Rzuca |
---|
DeviceNotAvailableException | |
zatrzymajUżytkownika
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Parametry |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Rzuca |
---|
DeviceNotAvailableException | |
zatrzymajUżytkownika
public boolean stopUser (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
Zmień użytkownika
public boolean switchUser (int userId)
Rzuca |
---|
DeviceNotAvailableException | |
Zmień użytkownika
public boolean switchUser (int userId,
long timeout)
Parametry |
---|
userId | int |
timeout | long |
Rzuca |
---|
DeviceNotAvailableException | |
odinstaluj pakiet
public String uninstallPackage (String packageName)
Parametry |
---|
packageName | String |
Rzuca |
---|
DeviceNotAvailableException | |
odinstalujPakietForUser
public String uninstallPackageForUser (String packageName,
int userId)
Parametry |
---|
packageName | String |
userId | int |
Rzuca |
---|
DeviceNotAvailableException | |
Metody chronione
wykonaj AdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
Wykonaj ponowne uruchomienie adb.
Parametry |
---|
rebootMode | NativeDevice.RebootMode : tryb tego ponownego uruchomienia. |
reason | String : dla tego ponownego uruchomienia. |
Rzuca |
---|
DeviceNotAvailableException | |
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
Wystawiony do testów.
pobierz HostCurrentTime
protected long getHostCurrentTime ()
Wystawiony do testów
konfiguracja przedPostBoot
protected void prePostBootSetup ()
Umożliwia każdemu typowi urządzenia (AndroidNativeDevice, TestDevice) zastąpienie tej metody w przypadku określonej konfiguracji po rozruchu.
Rzuca |
---|
DeviceNotAvailableException | |