executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
void
executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Переопределите, если устройству необходимо выполнить определенные действия после удаления root с помощью adb и до того, как устройство снова будет в сети.
Получить свойство устройства из кеша ddmlib по умолчанию и вернуться к `adb shell getprop` или` fastboot getvar` в зависимости от того, находится ли устройство в Fastboot или нет.
IDeviceMonitor : IDeviceMonitor информировать об изменениях состояния распределения. Может быть нулевым
Публичные методы
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Параметры
strictMinLevel
int
Возврат
boolean
Броски
DeviceNotAvailableException
checkConnectivity
public boolean checkConnectivity ()
Возврат
boolean
Броски
DeviceNotAvailableException
clearErrorDialogs
public boolean clearErrorDialogs ()
Возврат
boolean
Броски
DeviceNotAvailableException
clearLastConnectedWifiNetwork
public void clearLastConnectedWifiNetwork ()
clearLogcat
public void clearLogcat ()
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid,
String wifiPsk)
Параметры
wifiSsid
String
wifiPsk
String
Возврат
boolean
Броски
DeviceNotAvailableException
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid,
String wifiPsk,
boolean scanSsid)
Параметры
wifiSsid
String
wifiPsk
String
scanSsid
boolean
Возврат
boolean
Броски
DeviceNotAvailableException
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid,
String wifiPsk,
boolean scanSsid)
Параметры
wifiSsid
String
wifiPsk
String
scanSsid
boolean
Возврат
boolean
Броски
DeviceNotAvailableException
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid,
String wifiPsk)
Параметры
wifiSsid
String
wifiPsk
String
Возврат
boolean
Броски
DeviceNotAvailableException
Создать пользователя
public int createUser (String name,
boolean guest,
boolean ephemeral)
Параметры
name
String
guest
boolean
ephemeral
boolean
Возврат
int
Броски
DeviceNotAvailableException
Создать пользователя
public int createUser (String name)
Параметры
name
String
Возврат
int
Броски
DeviceNotAvailableException
createUserNoThrow
public int createUserNoThrow (String name)
Параметры
name
String
Возврат
int
Броски
DeviceNotAvailableException
удалить файл
public void deleteFile (String deviceFilePath)
Параметры
deviceFilePath
String
Броски
DeviceNotAvailableException
deviceSoftRestarted
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Параметры
prevSystemServerProcess
ProcessInfo
Возврат
boolean
Броски
DeviceNotAvailableException
deviceSoftRestartedSince
public boolean deviceSoftRestartedSince (long utcEpochTime,
TimeUnit timeUnit)
Параметры
utcEpochTime
long
timeUnit
TimeUnit
Возврат
boolean
Броски
DeviceNotAvailableException
disableAdbRoot
public boolean disableAdbRoot ()
Возврат
boolean
Броски
DeviceNotAvailableException
disableKeyguard
public void disableKeyguard ()
Броски
DeviceNotAvailableException
disableNetworkMonitor
public boolean disableNetworkMonitor ()
Возврат
boolean
Броски
DeviceNotAvailableException
отключить от Wi-Fi
public boolean disconnectFromWifi ()
Возврат
boolean
Броски
DeviceNotAvailableException
doesFileExist
public boolean doesFileExist (String deviceFilePath)
Параметры
deviceFilePath
String
Возврат
boolean
Броски
DeviceNotAvailableException
свалка
public File dumpHeap (String process,
String devicePath)
Параметры
process
String
devicePath
String
Возврат
File
Броски
DeviceNotAvailableException
enableAdbRoot
public boolean enableAdbRoot ()
Возврат
boolean
Броски
DeviceNotAvailableException
enableNetworkMonitor
public boolean enableNetworkMonitor ()
Возврат
boolean
Броски
DeviceNotAvailableException
encryptDevice
public boolean encryptDevice (boolean inplace)
Параметры
inplace
boolean
Возврат
boolean
Броски
DeviceNotAvailableException
executeAdbCommand
public String executeAdbCommand (long timeout,
String... cmdArgs)
Параметры
timeout
long
cmdArgs
String
Возврат
String
Броски
DeviceNotAvailableException
executeAdbCommand
public String executeAdbCommand (String... cmdArgs)
Параметры
cmdArgs
String
Возврат
String
Броски
DeviceNotAvailableException
executeFastbootCommand
public CommandResult executeFastbootCommand (String... cmdArgs)
Параметры
cmdArgs
String
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeFastbootCommand
public CommandResult executeFastbootCommand (long timeout,
String... cmdArgs)
Параметры
timeout
long
cmdArgs
String
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeLongFastbootCommand
public CommandResult executeLongFastbootCommand (String... cmdArgs)
Параметры
cmdArgs
String
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellCommand
public String executeShellCommand (String command)
Параметры
command
String
Возврат
String
Броски
DeviceNotAvailableException
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeToOutputShellResponse,
TimeUnit timeUnit,
int retryAttempts)
Параметры
command
String
receiver
IShellOutputReceiver
maxTimeToOutputShellResponse
long
timeUnit
TimeUnit
retryAttempts
int
Броски
DeviceNotAvailableException
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeoutForCommand,
long maxTimeToOutputShellResponse,
TimeUnit timeUnit,
int retryAttempts)
Параметры
command
String
receiver
IShellOutputReceiver
maxTimeoutForCommand
long
maxTimeToOutputShellResponse
long
timeUnit
TimeUnit
retryAttempts
int
Броски
DeviceNotAvailableException
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver)
Параметры
command
String
receiver
IShellOutputReceiver
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd)
Параметры
cmd
String
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
OutputStream pipeToOutput)
Параметры
cmd
String
pipeToOutput
OutputStream
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
File pipeAsInput)
Параметры
cmd
String
pipeAsInput
File
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
long maxTimeoutForCommand,
TimeUnit timeUnit,
int retryAttempts)
Параметры
cmd
String
maxTimeoutForCommand
long
timeUnit
TimeUnit
retryAttempts
int
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
long maxTimeoutForCommand,
TimeUnit timeUnit)
Параметры
cmd
String
maxTimeoutForCommand
long
timeUnit
TimeUnit
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
File pipeAsInput,
OutputStream pipeToOutput,
long maxTimeoutForCommand,
TimeUnit timeUnit,
int retryAttempts)
Параметры
cmd
String
pipeAsInput
File
pipeToOutput
OutputStream
maxTimeoutForCommand
long
timeUnit
TimeUnit
retryAttempts
int
Возврат
CommandResult
Броски
DeviceNotAvailableException
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
File pipeAsInput,
OutputStream pipeToOutput,
OutputStream pipeToError,
long maxTimeoutForCommand,
TimeUnit timeUnit,
int retryAttempts)
Параметры
cmd
String
pipeAsInput
File
pipeToOutput
OutputStream
pipeToError
OutputStream
maxTimeoutForCommand
long
timeUnit
TimeUnit
retryAttempts
int
Возврат
CommandResult
Броски
DeviceNotAvailableException
fastbootWipePartition
public CommandResult fastbootWipePartition (String partition)
Параметры
partition
String
Возврат
CommandResult
Броски
DeviceNotAvailableException
getActiveApexes
public getActiveApexes ()
Возврат
Броски
DeviceNotAvailableException
getAllSettings
public getAllSettings (String namespace)
Параметры
namespace
String
Возврат
Броски
DeviceNotAvailableException
getAllocationState
public DeviceAllocationState getAllocationState ()
Возврат
DeviceAllocationState
getAndroidId
public String getAndroidId (int userId)
Параметры
userId
int
Возврат
String
Броски
DeviceNotAvailableException
getAndroidIds
public getAndroidIds ()
Возврат
Броски
DeviceNotAvailableException
getApiLevel
public int getApiLevel ()
Возврат
int
Броски
DeviceNotAvailableException
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Параметры
packageName
String
Возврат
PackageInfo
Броски
DeviceNotAvailableException
getAppPackageInfos
public getAppPackageInfos ()
Возврат
Броски
DeviceNotAvailableException
getBasebandVersion
public String getBasebandVersion ()
Возврат
String
Броски
DeviceNotAvailableException
getBattery
public Integer getBattery ()
Возврат
Integer
getBooleanProperty
public boolean getBooleanProperty (String name,
boolean defaultValue)
Параметры
name
String
defaultValue
boolean
Возврат
boolean
Броски
DeviceNotAvailableException
getBootHistory
public getBootHistory ()
Возврат
Броски
DeviceNotAvailableException
getBootHistorySince
public getBootHistorySince (long utcEpochTime,
TimeUnit timeUnit)
Параметры
utcEpochTime
long
timeUnit
TimeUnit
Возврат
Броски
DeviceNotAvailableException
getBootloaderVersion
public String getBootloaderVersion ()
Возврат
String
Броски
DeviceNotAvailableException
getBugreport
public InputStreamSource getBugreport ()
Возврат
InputStreamSource
getBugreportz
public InputStreamSource getBugreportz ()
Возврат
InputStreamSource
getBuildAlias
public String getBuildAlias ()
Возврат
String
Броски
DeviceNotAvailableException
getBuildFlavor
public String getBuildFlavor ()
Возврат
String
Броски
DeviceNotAvailableException
getBuildId
public String getBuildId ()
Возврат
String
Броски
DeviceNotAvailableException
getBuildSigningKeys
public String getBuildSigningKeys ()
Возврат
String
Броски
DeviceNotAvailableException
getCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor ()
Возврат
DeviceDescriptor
getChildren
public String[] getChildren (String path)
Параметры
path
String
Возврат
String[]
Броски
DeviceNotAvailableException
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
public String getFastbootVariable (String variableName)
Параметры
variableName
String
Возврат
String
Броски
DeviceNotAvailableException
getFastbootVersion
public String getFastbootVersion ()
Возврат
String
getFileEntry
public IFileEntry getFileEntry (String path)
Параметры
path
String
Возврат
IFileEntry
Броски
DeviceNotAvailableException
getFileEntry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
Неофициальный помощник , чтобы получить FileEntry от некорневого пути. FIXME: Реорганизуйте систему FileEntry, чтобы она была доступна по любому пути. (даже без root).
Параметры
entry
FileListingService.FileEntry : а FileEntry не обязательно корень , как требует Ddmlib.
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Параметры
packageFile
File
reinstall
boolean
userId
int
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
isAdbRoot
public boolean isAdbRoot ()
Возврат
boolean
Броски
DeviceNotAvailableException
isAdbTcp
public boolean isAdbTcp ()
Возврат
boolean
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Возврат
boolean
Броски
DeviceNotAvailableException
isDeviceEncrypted
public boolean isDeviceEncrypted ()
Возврат
boolean
Броски
DeviceNotAvailableException
isDirectory
public boolean isDirectory (String path)
Параметры
path
String
Возврат
boolean
Броски
DeviceNotAvailableException
isEnableAdbRoot
public boolean isEnableAdbRoot ()
Возврат
boolean
true , если ADB корень должен быть включен на устройстве
isEncryptionSupported
public boolean isEncryptionSupported ()
Возврат
boolean
Броски
DeviceNotAvailableException
isExecutable
public boolean isExecutable (String fullPath)
Параметры
fullPath
String
Возврат
boolean
Броски
DeviceNotAvailableException
isFastbootEnabled
public boolean isFastbootEnabled ()
Возврат
boolean
безголовый
public boolean isHeadless ()
Возврат
boolean
Броски
DeviceNotAvailableException
isMultiUserSupported
public boolean isMultiUserSupported ()
Возврат
boolean
Броски
DeviceNotAvailableException
isPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
Параметры
packageName
String
userId
String
Возврат
boolean
Броски
DeviceNotAvailableException
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Параметры
packageName
String
Возврат
boolean
Броски
DeviceNotAvailableException
isRuntimePermissionSupported
public boolean isRuntimePermissionSupported ()
Возврат
boolean
Броски
DeviceNotAvailableException
isStateBootloaderOrFastbootd
public boolean isStateBootloaderOrFastbootd ()
Возврат
boolean
isUserRunning
public boolean isUserRunning (int userId)
Параметры
userId
int
Возврат
boolean
Броски
DeviceNotAvailableException
isUserSecondary
public boolean isUserSecondary (int userId)
Параметры
userId
int
Возврат
boolean
Броски
DeviceNotAvailableException
isWifiEnabled
public boolean isWifiEnabled ()
Возврат
boolean
Броски
DeviceNotAvailableException
listDisplayIds
public listDisplayIds ()
Возврат
Броски
DeviceNotAvailableException
listUsers
public listUsers ()
Возврат
Броски
DeviceNotAvailableException
logBugreport
public boolean logBugreport (String dataName,
ITestLogger listener)
Параметры
dataName
String
listener
ITestLogger
Возврат
boolean
logOnDevice
public void logOnDevice (String tag,
Log.LogLevel level,
String format,
Object... args)
Параметры
tag
String
level
Log.LogLevel
format
String
args
Object
nonBlockingReboot
public void nonBlockingReboot ()
Броски
DeviceNotAvailableException
postAdbRootAction
public void postAdbRootAction ()
Переопределите, если устройству необходимо выполнить какие-то определенные действия после adb root и до того, как устройство снова подключится к сети. Реализация по умолчанию не включает никаких дополнительных действий. Не гарантируется, что adb root будет включен на этом этапе.
Броски
DeviceNotAvailableException
postAdbUnrootAction
public void postAdbUnrootAction ()
Переопределите, если устройству необходимо выполнить определенные действия после удаления root с помощью adb и до того, как устройство снова будет в сети. Реализация по умолчанию не включает никаких дополнительных действий. На данном этапе отключение adb root не гарантируется.
Броски
DeviceNotAvailableException
postBootSetup
public void postBootSetup ()
Броски
DeviceNotAvailableException
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Параметры
exception
Throwable
preInvocationSetup
public void preInvocationSetup (IBuildInfo info,
MultiMap<String, String> attributes)
Параметры
info
IBuildInfo
attributes
MultiMap
Броски
DeviceNotAvailableException
TargetSetupError
pullDir
public boolean pullDir (String deviceFilePath,
File localDir)
Параметры
deviceFilePath
String
localDir
File
Возврат
boolean
Броски
DeviceNotAvailableException
pullFile
public boolean pullFile (String remoteFilePath,
File localFile)
Параметры
remoteFilePath
String
localFile
File
Возврат
boolean
Броски
DeviceNotAvailableException
pullFile
public File pullFile (String remoteFilePath)
Параметры
remoteFilePath
String
Возврат
File
Броски
DeviceNotAvailableException
pullFileContents
public String pullFileContents (String remoteFilePath)
Параметры
remoteFilePath
String
Возврат
String
Броски
DeviceNotAvailableException
pullFileFromExternal
public File pullFileFromExternal (String remoteFilePath)
Параметры
remoteFilePath
String
Возврат
File
Броски
DeviceNotAvailableException
pushDir
public boolean pushDir (File localFileDir,
String deviceFilePath,
excludedDirectories)
Параметры
localFileDir
File
deviceFilePath
String
excludedDirectories
Возврат
boolean
Броски
DeviceNotAvailableException
pushDir
public boolean pushDir (File localFileDir,
String deviceFilePath)
Параметры
localFileDir
File
deviceFilePath
String
Возврат
boolean
Броски
DeviceNotAvailableException
pushFile
public boolean pushFile (File localFile,
String remoteFilePath)
Параметры
localFile
File
remoteFilePath
String
Возврат
boolean
Броски
DeviceNotAvailableException
pushString
public boolean pushString (String contents,
String remoteFilePath)
Параметры
contents
String
remoteFilePath
String
Возврат
boolean
Броски
DeviceNotAvailableException
перезагружать
public void reboot (String reason)
Параметры
reason
String
Броски
DeviceNotAvailableException
перезагружать
public void reboot ()
Броски
DeviceNotAvailableException
rebootIntoBootloader
public void rebootIntoBootloader ()
Броски
DeviceNotAvailableException
rebootIntoFastbootd
public void rebootIntoFastbootd ()
Броски
DeviceNotAvailableException
rebootIntoRecovery
public void rebootIntoRecovery ()
Броски
DeviceNotAvailableException
rebootIntoSideload
public void rebootIntoSideload ()
Броски
DeviceNotAvailableException
rebootIntoSideload
public void rebootIntoSideload (boolean autoReboot)
Параметры
autoReboot
boolean
Броски
DeviceNotAvailableException
rebootUntilOnline
public void rebootUntilOnline ()
Броски
DeviceNotAvailableException
rebootUntilOnline
public void rebootUntilOnline (String reason)
Параметры
reason
String
Броски
DeviceNotAvailableException
rebootUserspace
public void rebootUserspace ()
Броски
DeviceNotAvailableException
rebootUserspaceUntilOnline
public void rebootUserspaceUntilOnline ()
Броски
DeviceNotAvailableException
RecoveryDevice
public void recoverDevice ()
Попытки восстановить связь с устройством.
Броски
DeviceNotAvailableException
если устройство больше не доступно
remountSystemWritable
public void remountSystemWritable ()
Броски
DeviceNotAvailableException
remountVendorWritable
public void remountVendorWritable ()
Броски
DeviceNotAvailableException
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
Параметры
componentName
String
userId
int
Возврат
boolean
Броски
DeviceNotAvailableException
removeOwners
public void removeOwners ()
Броски
DeviceNotAvailableException
removeUser
public boolean removeUser (int userId)
Параметры
userId
int
Возврат
boolean
Броски
DeviceNotAvailableException
resetContentProviderSetup
public void resetContentProviderSetup ()
Сбросьте флаг для настройки поставщика контента, чтобы активировать его снова.
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,
ITestLifeCycleReceiver... listeners)
Параметры
runner
IRemoteAndroidTestRunner
listeners
ITestLifeCycleReceiver
Возврат
boolean
Броски
DeviceNotAvailableException
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,
listeners)
Параметры
runner
IRemoteAndroidTestRunner
listeners
Возврат
boolean
Броски
DeviceNotAvailableException
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner,
int userId,
ITestLifeCycleReceiver... listeners)
Параметры
runner
IRemoteAndroidTestRunner
userId
int
listeners
ITestLifeCycleReceiver
Возврат
boolean
Броски
DeviceNotAvailableException
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner,
int userId,
listeners)
Параметры
runner
IRemoteAndroidTestRunner
userId
int
listeners
Возврат
boolean
Броски
DeviceNotAvailableException
setConfiguration
public void setConfiguration (IConfiguration configuration)
Получить свойство устройства из кеша ddmlib по умолчанию и вернуться к `adb shell getprop` или` fastboot getvar` в зависимости от того, находится ли устройство в Fastboot или нет.
Параметры
propName
String : Имя свойства устройства, возвращаемый `ADB getprop` оболочки
fastbootVar
String : Имя эквивалентной переменной FastBoot для запроса. если null , запрос не быстрой загрузки будет предпринята попытка
description
String : Простое описание переменной. Первая буква должна быть заглавной.
Возврат
String
Строка, возможно , null или пустые, содержащее значение данного свойства
Возвращение true , если локальный файл новее , чем удаленный файл. IFileEntry быть с точностью до минуты, в случае равных промежутков времени, то файл будет считаться новее.
Параметры
localFile
File
entry
IFileEntry
Возврат
boolean
выполнитьDeviceAction
protected boolean performDeviceAction (String actionDescription,
com.android.tradefed.device.NativeDevice.DeviceAction action,
int retryAttempts)
Выполняет действие на этом устройстве. Пытается восстановить устройство и, при необходимости, повторить команду, если действие не удалось.
Параметры
actionDescription
String : краткое описание действий , которые будут выполнены. Используется только для целей регистрации.
action
com.android.tradefed.device.NativeDevice.DeviceAction : действие , которое будет выполняться
retryAttempts
int : попытки повтора , чтобы действовать , если это не удается , но восстановление успешно
Возврат
boolean
true , если действие было выполнено успешно
Броски
DeviceNotAvailableException
если попытка восстановления не удалась или максимальное количество попыток выполнено безуспешно
postAdbReboot
protected void postAdbReboot ()
Возможные дополнительные действия, которые можно предпринять после перезагрузки.
Броски
DeviceNotAvailableException
prePostBootSetup
protected void prePostBootSetup ()
Позволяет каждому типу устройства (AndroidNativeDevice, TestDevice) переопределять этот метод для конкретной настройки после загрузки.
Броски
DeviceNotAvailableException
setClock
protected void setClock (Clock clock)
Задайте экземпляр Clock для использования.
Параметры
clock
Clock
setLogStartDelay
protected void setLogStartDelay (int delay)
Устанавливает время ожидания в мс перед запуском записи logcat для онлайн-устройства.
Параметры
delay
int : задержки в мс
waitForDeviceNotAvailable
protected void waitForDeviceNotAvailable (String operationDesc,
long time)
Параметры
operationDesc
String
time
long
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.