Тестовое устройство
public class TestDevice
extends NativeDevice
java.lang.Объект | ||
↳ | com.android.tradefed.device.NativeDevice | |
↳ | com.android.tradefed.device.TestDevice |
Реализация ITestDevice
для полнофункционального устройства Android.
Краткое содержание
Поля | |
---|---|
public static final String | DISMISS_KEYGUARD_CMD Команды, которые можно использовать для отключения защиты клавиатуры. |
Общественные конструкторы | |
---|---|
TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) |
Публичные методы | |
---|---|
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)
|
Защищенные методы | |
---|---|
void | doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason) Выполните перезагрузку adb. |
long | getCheckNewUserSleep () Выставлено на тестирование. |
long | getHostCurrentTime () Выставлено на тестирование |
void | prePostBootSetup () Позволяет каждому типу устройства (AndroidNativeDevice, TestDevice) переопределить этот метод для конкретной настройки после загрузки. |
Поля
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
Команды, которые можно использовать для отключения защиты клавиатуры.
Общественные конструкторы
Тестовое устройство
public TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
Публичные методы
ClearErrorDialogs
public boolean clearErrorDialogs ()
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
создать пользователя
public int createUser (String name)
Параметры | |
---|---|
name | String |
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
создать пользователя
public int createUser (String name, boolean guest, boolean ephemeral)
Параметры | |
---|---|
name | String |
guest | boolean |
ephemeral | boolean |
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
createUserNoThrow
public int createUserNoThrow (String name)
Параметры | |
---|---|
name | String |
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
отключитьKeyguard
public void disableKeyguard ()
Броски | |
---|---|
DeviceNotAvailableException |
делаетFileExist
public boolean doesFileExist (String deviceFilePath)
Параметры | |
---|---|
deviceFilePath | String |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
дампКуча
public File dumpHeap (String process, String devicePath)
Параметры | |
---|---|
process | String |
devicePath | String |
Возврат | |
---|---|
File |
Броски | |
---|---|
DeviceNotAvailableException |
getActiveApexes
publicgetActiveApexes ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
получить все настройки
publicgetAllSettings (String namespace)
Параметры | |
---|---|
namespace | String |
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
получитьAndroidId
public String getAndroidId (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
получитьAndroidIds
publicgetAndroidIds ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Параметры | |
---|---|
packageName | String |
Возврат | |
---|---|
PackageInfo |
Броски | |
---|---|
DeviceNotAvailableException |
getAppPackageInfos
publicgetAppPackageInfos ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Возврат | |
---|---|
DeviceFoldableState |
Броски | |
---|---|
DeviceNotAvailableException |
getCurrentUser
public int getCurrentUser ()
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
getFoldableStates
publicgetFoldableStates ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getInstalledPackageNames
publicgetInstalledPackageNames ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Возврат | |
---|---|
KeyguardControllerState |
Броски | |
---|---|
DeviceNotAvailableException |
getMainlineModuleInfo
publicgetMainlineModuleInfo ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfRunningUsersSupported
public int getMaxNumberOfRunningUsersSupported ()
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfUsersSupported
public int getMaxNumberOfUsersSupported ()
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
получитьPrimaryUserId
public Integer getPrimaryUserId ()
Возврат | |
---|---|
Integer |
Броски | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot ()
Возврат | |
---|---|
InputStreamSource |
Броски | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (String format, boolean rescale)
Параметры | |
---|---|
format | String |
rescale | boolean |
Возврат | |
---|---|
InputStreamSource |
Броски | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (String format)
Параметры | |
---|---|
format | String |
Возврат | |
---|---|
InputStreamSource |
Броски | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Параметры | |
---|---|
displayId | long |
Возврат | |
---|---|
InputStreamSource |
Броски | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (String namespace, String key)
Параметры | |
---|---|
namespace | String |
key | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (int userId, String namespace, String key)
Параметры | |
---|---|
userId | int |
namespace | String |
key | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
getUninstallablePackageNames
publicgetUninstallablePackageNames ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getUserFlags
public int getUserFlags (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
getUserInfos
publicgetUserInfos ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
int |
Броски | |
---|---|
DeviceNotAvailableException |
имеет особенность
public boolean hasFeature (String feature)
Параметры | |
---|---|
feature | String |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
установитьПакет
public String installPackage (File packageFile, boolean reinstall, String... extraArgs)
Параметры | |
---|---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
установитьПакет
public String installPackage (File packageFile, File certFile, boolean reinstall, String... extraArgs)
Параметры | |
---|---|
packageFile | File |
certFile | File |
reinstall | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
установитьПакет
public String installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)
Параметры | |
---|---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
installPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)
Параметры | |
---|---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
installPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs)
Параметры | |
---|---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
установитьПакеты
public String installPackages (packageFiles, boolean reinstall, String... extraArgs)
Параметры | |
---|---|
packageFiles | |
reinstall | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
установитьПакеты
public String installPackages (packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs)
Параметры | |
---|---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
installPackagesForUser
public String installPackagesForUser (packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)
Параметры | |
---|---|
packageFiles | |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
installPackagesForUser
public String installPackagesForUser (packageFiles, boolean reinstall, int userId, String... extraArgs)
Параметры | |
---|---|
packageFiles | |
reinstall | boolean |
userId | int |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
установитьRemotePackages
public String installRemotePackages (remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs)
Параметры | |
---|---|
remoteApkPaths | |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
установитьRemotePackages
public String installRemotePackages (remoteApkPaths, boolean reinstall, String... extraArgs)
Параметры | |
---|---|
remoteApkPaths | |
reinstall | boolean |
extraArgs | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
isMultiUserSupported
public boolean isMultiUserSupported ()
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Параметры | |
---|---|
packageName | String |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
isPackageInstalled
public boolean isPackageInstalled (String packageName, String userId)
Параметры | |
---|---|
packageName | String |
userId | String |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
isUserRunning
public boolean isUserRunning (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
isUserSecondary
public boolean isUserSecondary (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
списокдисплейидс
publiclistDisplayIds ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
списокПользователи
publiclistUsers ()
Возврат | |
---|---|
Броски | |
---|---|
DeviceNotAvailableException |
постПризывСнос
public void postInvocationTearDown (Throwable exception)
Параметры | |
---|---|
exception | Throwable |
удалить администратора
public boolean removeAdmin (String componentName, int userId)
Параметры | |
---|---|
componentName | String |
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
удалить владельцев
public void removeOwners ()
Броски | |
---|---|
DeviceNotAvailableException |
удалить пользователя
public boolean removeUser (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
setDeviceOwner
public boolean setDeviceOwner (String componentName, int userId)
Параметры | |
---|---|
componentName | String |
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
УстановитьНастройки
public void setSetting (String namespace, String key, String value)
Параметры | |
---|---|
namespace | String |
key | String |
value | String |
Броски | |
---|---|
DeviceNotAvailableException |
УстановитьНастройки
public void setSetting (int userId, String namespace, String key, String value)
Параметры | |
---|---|
userId | int |
namespace | String |
key | String |
value | String |
Броски | |
---|---|
DeviceNotAvailableException |
startUser
public boolean startUser (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
startUser
public boolean startUser (int userId, boolean waitFlag)
Параметры | |
---|---|
userId | int |
waitFlag | boolean |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
стоппользователь
public boolean stopUser (int userId, boolean waitFlag, boolean forceFlag)
Параметры | |
---|---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
стоппользователь
public boolean stopUser (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
переключательПользователь
public boolean switchUser (int userId)
Параметры | |
---|---|
userId | int |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
переключательПользователь
public boolean switchUser (int userId, long timeout)
Параметры | |
---|---|
userId | int |
timeout | long |
Возврат | |
---|---|
boolean |
Броски | |
---|---|
DeviceNotAvailableException |
удалить пакет
public String uninstallPackage (String packageName)
Параметры | |
---|---|
packageName | String |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
деинсталлироватьПакажефорюсер
public String uninstallPackageForUser (String packageName, int userId)
Параметры | |
---|---|
packageName | String |
userId | int |
Возврат | |
---|---|
String |
Броски | |
---|---|
DeviceNotAvailableException |
Защищенные методы
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
Выполните перезагрузку adb.
Параметры | |
---|---|
rebootMode | NativeDevice.RebootMode : режим этой перезагрузки. |
reason | String : для этой перезагрузки. |
Броски | |
---|---|
DeviceNotAvailableException |
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
Выставлено на тестирование.
Возврат | |
---|---|
long |
getHostCurrentTime
protected long getHostCurrentTime ()
Выставлено на тестирование
Возврат | |
---|---|
long |
prePostBootSetup
protected void prePostBootSetup ()
Позволяет каждому типу устройства (AndroidNativeDevice, TestDevice) переопределить этот метод для конкретной настройки после загрузки.
Броски | |
---|---|
DeviceNotAvailableException |