INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Fornece uma API confiável e de nível ligeiramente superior para um ddmlib IDevice
.
Resumo
Constantes | |
---|---|
int | UNKNOWN_API_LEVEL Valor padrão quando o nível de API não pode ser detectado |
Métodos públicos | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Verifique se um recurso é compatível no momento com um nível de suporte mínimo. |
abstract void | clearLogcat () Exclui todos os dados acumulados do logcat. |
abstract void | deleteFile (String deviceFilePath) Método auxiliar para excluir um arquivo ou diretório no dispositivo. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) Método auxiliar para verificar se o dispositivo foi reiniciado por software comparando o system_server atual com o system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Método auxiliar para verificar se o dispositivo foi reiniciado desde o horário UTC desde a época do dispositivo e seu |
abstract boolean | disableAdbRoot () Desativa a raiz do adb. |
abstract boolean | doesFileExist (String deviceFilePath) Método auxiliar para determinar se o arquivo no dispositivo existe. |
abstract boolean | enableAdbRoot () Ativa a raiz do adb. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) Método auxiliar que executa um comando adb como um comando do sistema com um tempo limite especificado. |
abstract String | executeAdbCommand (String... commandArgs) Método auxiliar que executa um comando adb como um comando do sistema. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) Método auxiliar que executa um comando fastboot como um comando do sistema com um tempo limite padrão de 2 minutos. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) Método auxiliar que executa um comando fastboot como um comando do sistema. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Método auxiliar que executa um comando fastboot de longa duração como um comando do sistema com variáveis de ambiente do sistema. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) Método auxiliar que executa um comando fastboot de longa duração como um comando do sistema. |
abstract String | executeShellCommand (String command) Método auxiliar que executa um comando shell adb e retorna a saída como uma |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) Executa o comando de shell adb fornecido, tentando novamente várias vezes se o comando falhar. |
abstract CommandResult | executeShellV2Command (String command) Método auxiliar que executa um comando shell adb e retorna os resultados como um |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Método auxiliar que executa um comando shell adb e retorna os resultados como um |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Método auxiliar que executa um comando shell adb e retorna os resultados como um |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando. |
abstract CommandResult | fastbootWipePartition (String partition) Método auxiliar que limpa uma partição para o dispositivo. |
abstract int | getApiLevel () Obtenha o nível de API do dispositivo. |
abstract String | getBasebandVersion () Método de conveniência para obter a versão de banda base (rádio) deste dispositivo. |
abstract Integer | getBattery () Retorna o nível atual da bateria de um dispositivo ou Nulo se o nível da bateria não estiver disponível. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Retorna o valor booleano da propriedade fornecida. |
abstract | getBootHistory () O método auxiliar coleta o mapa do histórico de inicialização com o tempo de inicialização e o motivo da inicialização. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) O método auxiliar coleta o mapa do histórico de inicialização com o tempo de inicialização e o motivo da inicialização desde o tempo determinado desde a época do dispositivo e a unidade de tempo especificada. |
abstract String | getBootloaderVersion () Método de conveniência para obter a versão do bootloader deste dispositivo. |
abstract InputStreamSource | getBugreport () Recupera um relatório de bug do dispositivo. |
abstract InputStreamSource | getBugreportz () Recupera um bugreportz do dispositivo. |
abstract String | getBuildAlias () Recupere o alias da compilação que o dispositivo está executando no momento. |
abstract String | getBuildFlavor () Recupere o tipo de compilação para o dispositivo. |
abstract String | getBuildId () Recupere a compilação que o dispositivo está executando no momento. |
abstract String | getBuildSigningKeys () Retorna o tipo de chave usado para assinar a imagem do dispositivo Normalmente, os dispositivos Android podem ser assinados com chaves de teste (como no AOSP) ou chaves de liberação (controladas por fabricantes de dispositivos individuais) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Retorna um |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Retorna um |
abstract String[] | getChildren (String deviceFilePath) Alternativa ao uso de |
abstract String | getDeviceClass () Obtenha a classe do dispositivo. |
abstract long | getDeviceDate () Retorna a data do dispositivo em milissegundos desde a época. |
abstract DeviceDescriptor | getDeviceDescriptor () Retorne um |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Retorne um |
abstract TestDeviceState | getDeviceState () Obtenha o estado do dispositivo. |
abstract long | getDeviceTimeOffset (Date date) Helper para obter a diferença de tempo entre o dispositivo e um determinado |
abstract InputStreamSource | getEmulatorOutput () Obtenha o fluxo do emulador stdout e stderr |
abstract long | getExternalStoreFreeSpace () Método auxiliar para determinar a quantidade de espaço livre no armazenamento externo do dispositivo. |
abstract String | getFastbootProductType () Método de conveniência para obter o tipo de produto deste dispositivo quando estiver no modo fastboot. |
abstract String | getFastbootProductVariant () Método de conveniência para obter o tipo de produto deste dispositivo quando estiver no modo fastboot. |
abstract String | getFastbootSerialNumber () Retorna o número de série do modo fastboot. |
abstract String | getFastbootVariable (String variableName) Recupere o valor da variável fastboot fornecido do dispositivo. |
abstract IFileEntry | getFileEntry (String path) Recupere uma referência a um arquivo remoto no dispositivo. |
abstract IDevice | getIDevice () Retorna uma referência ao ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Retorna o valor inteiro da propriedade fornecida do dispositivo. |
abstract long | getLastExpectedRebootTimeMillis () Retorna a última vez que as APIs Tradefed acionaram uma reinicialização em milissegundos desde EPOCH conforme retornado por |
abstract int | getLaunchApiLevel () Obtenha o primeiro nível de API lançado do dispositivo. |
abstract InputStreamSource | getLogcat () Pega um fluxo de instantâneo dos dados do logcat. |
abstract InputStreamSource | getLogcat (int maxBytes) Pega um fluxo de instantâneo dos últimos |
abstract InputStreamSource | getLogcatDump () Obtenha um dump do logcat atual para o dispositivo. |
abstract InputStreamSource | getLogcatSince (long date) Obtém um fluxo de instantâneo de dados logcat capturados a partir da data fornecida. |
abstract String | getMountPoint (String mountName) Retorna um ponto de montagem. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Retorna um |
abstract | getMountPointInfo () Retorna uma versão analisada das informações em /proc/mounts no dispositivo |
abstract long | getPartitionFreeSpace (String partition) Método auxiliar para determinar a quantidade de espaço livre na partição do dispositivo. |
abstract ProcessInfo | getProcessByName (String processName) O método auxiliar executa o comando "pidof" e "stat" e retorna o objeto |
abstract String | getProcessPid (String process) Retorna o pid do serviço ou null se algo deu errado. |
abstract String | getProductType () Método de conveniência para obter o tipo de produto deste dispositivo. |
abstract String | getProductVariant () Método de conveniência para obter a variante de produto deste dispositivo. |
abstract String | getProperty (String name) Recupere o valor de propriedade fornecido do dispositivo. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () Obtenha o modo de recuperação atual usado para o dispositivo. |
abstract String | getSerialNumber () Método de conveniência para obter o número de série deste dispositivo. |
abstract | getTombstones () Busque e retorne a lista de lápides dos dispositivos. |
abstract long | getTotalMemory () Retorna o tamanho total da memória física em bytes ou -1 em caso de erro interno |
abstract boolean | getUseFastbootErase () Obtenha se deseja usar o formato fastboot erase ou fastboot para limpar uma partição no dispositivo. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () Verifique se a plataforma no dispositivo oferece suporte à enumeração de aplicativos |
abstract boolean | isDeviceEncrypted () Retorna se o dispositivo estiver criptografado. |
abstract boolean | isDirectory (String deviceFilePath) Retorna True se o caminho no dispositivo for um diretório, caso contrário, false. |
abstract boolean | isEncryptionSupported () Retorna se a criptografia for compatível com o dispositivo. |
abstract boolean | isExecutable (String fullPath) Retorna True se o caminho do arquivo no dispositivo for um arquivo executável, false caso contrário. |
abstract boolean | isHeadless () Retorna true se o dispositivo for sem cabeça (sem tela), false caso contrário. |
abstract boolean | isRuntimePermissionSupported () Verifique se a plataforma no dispositivo suporta a concessão de permissão de tempo de execução |
abstract boolean | isStateBootloaderOrFastbootd () Retorna true se o dispositivo estiver em |
abstract boolean | logAnrs ( ITestLogger logger) Coleta e registra ANRs do dispositivo. |
abstract boolean | logBugreport (String dataName, ITestLogger listener) Método auxiliar para obter um relatório de bug e registrá-lo nos relatores. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Registre uma mensagem no logcat do dispositivo. |
abstract void | nonBlockingReboot () Emite um comando para reinicializar o dispositivo e retorna quando o comando é concluído e quando o dispositivo não está mais visível para o adb. |
abstract void | postBootSetup () Execute instruções para configurar o dispositivo para teste após cada inicialização. |
default void | postInvocationTearDown () Este método está obsoleto. Em vez disso, use |
abstract void | postInvocationTearDown (Throwable invocationException) Etapas extras para limpeza necessária específica do dispositivo que será executada após a conclusão da chamada. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) Etapas extras para a configuração necessária específica do dispositivo que será executada no dispositivo antes do fluxo de invocação. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Extraia recursivamente o conteúdo do diretório do dispositivo. |
abstract File | pullFile (String remoteFilePath, int userId) Recupera um arquivo do dispositivo, armazena-o em um |
abstract File | pullFile (String remoteFilePath) Recupera um arquivo do dispositivo, armazena-o em um |
abstract boolean | pullFile (String remoteFilePath, File localFile) Recupera um arquivo do dispositivo. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Recupera um arquivo do dispositivo. |
abstract String | pullFileContents (String remoteFilePath) Recupera um arquivo do dispositivo e retorna o conteúdo. |
abstract File | pullFileFromExternal (String remoteFilePath) Um método conveniente para recuperar um arquivo do armazenamento externo do dispositivo, armazená-lo em um |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) Envie o conteúdo do diretório recursivamente para o dispositivo, excluindo alguns diretórios filtrados. |
abstract boolean | pushDir (File localDir, String deviceFilePath) Empurre recursivamente o conteúdo do diretório para o dispositivo. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) Variante de |
abstract boolean | pushFile (File localFile, String deviceFilePath) Envie um arquivo para o dispositivo. |
abstract boolean | pushString (String contents, String deviceFilePath) Enviar arquivo criado de uma string para o dispositivo |
abstract void | reboot () Reinicia o dispositivo no modo adb. |
abstract void | reboot (String reason) Reinicia o dispositivo no modo adb com determinado |
abstract void | rebootIntoBootloader () Reinicia o dispositivo no modo bootloader. |
abstract void | rebootIntoFastbootd () Reinicia o dispositivo no modo fastbootd. |
abstract void | rebootIntoRecovery () Reinicia o dispositivo no modo de recuperação adb. |
abstract void | rebootIntoSideload (boolean autoReboot) Reinicia o dispositivo no modo adb sideload (observe que este é um modo especial em recuperação) Bloqueia até que o dispositivo entre no modo sideload |
abstract void | rebootIntoSideload () Reinicia o dispositivo no modo adb sideload (observe que este é um modo especial em recuperação) Bloqueia até que o dispositivo entre no modo sideload |
abstract void | rebootUntilOnline () Uma alternativa para |
abstract void | rebootUntilOnline (String reason) Uma alternativa para |
abstract void | rebootUserspace () Reinicia apenas a parte do espaço do usuário do dispositivo. |
abstract void | rebootUserspaceUntilOnline () Uma alternativa para |
abstract void | remountSystemWritable () Torne a partição do sistema no dispositivo gravável. |
abstract void | remountVendorWritable () Torne a partição do fornecedor no dispositivo gravável. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) Método de conveniência para executar |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) Executa testes de instrumentação e fornece recuperação de dispositivos. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) O mesmo que |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) O mesmo que |
abstract void | setDate (Date date) Define a data no dispositivo Nota: a configuração da data no dispositivo requer root |
abstract void | setOptions ( TestDeviceOptions options) Defina as |
abstract boolean | setProperty (String propKey, String propValue) Define o valor de propriedade fornecido no dispositivo. |
abstract void | setRecovery ( IDeviceRecovery recovery) Defina o |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) Defina o modo de recuperação atual a ser usado para o dispositivo. |
abstract void | setUseFastbootErase (boolean useFastbootErase) Defina se deseja usar o formato fastboot erase ou fastboot para limpar uma partição no dispositivo. |
abstract void | startLogcat () Comece a capturar a saída do logcat do dispositivo em segundo plano. |
abstract void | stopEmulatorOutput () Feche e exclua a saída do emulador. |
abstract void | stopLogcat () Pare de capturar a saída do logcat do dispositivo e descarte os dados do logcat salvos no momento. |
abstract String | switchToAdbTcp () Alterne o dispositivo para o modo adb-over-tcp. |
abstract boolean | switchToAdbUsb () Alterne o dispositivo para o modo adb sobre usb. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) Sincroniza incrementalmente o conteúdo de um diretório de arquivos local com o dispositivo. |
abstract Bugreport | takeBugreport () Pegue um relatório de bug e o retorne dentro de um objeto |
abstract boolean | unlockDevice () Desbloqueia o dispositivo se o dispositivo estiver em um estado criptografado. |
abstract boolean | waitForBootComplete (long timeOut) Bloqueia até que o sinalizador de inicialização completa do dispositivo seja definido. |
abstract boolean | waitForDeviceAvailable () Aguarda que o dispositivo seja responsivo e esteja disponível para teste. |
abstract boolean | waitForDeviceAvailable (long waitTime) Aguarda que o dispositivo seja responsivo e esteja disponível para teste. |
abstract void | waitForDeviceBootloader () Bloqueia até que o dispositivo fique visível via fastboot. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Blocos para que o dispositivo esteja no estado 'adb recovery' (observe que isso é diferente de |
abstract boolean | waitForDeviceInSideload (long waitTime) Blocos para que o dispositivo esteja no estado 'adb sideload' |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Blocos para o dispositivo não estar disponível, ou seja, ausente do adb |
abstract void | waitForDeviceOnline () Bloqueia até que o dispositivo fique visível via adb. |
abstract void | waitForDeviceOnline (long waitTime) Bloqueia até que o dispositivo fique visível via adb. |
abstract boolean | waitForDeviceShell (long waitTime) Aguarda que o dispositivo responda a um comando básico do shell do adb. |
Constantes
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
Valor padrão quando o nível de API não pode ser detectado
Valor constante: -1 (0xffffffff)
Métodos públicos
checkApiLevelAgainstNextLançamento
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Verifique se um recurso é compatível no momento com um nível de suporte mínimo. Esse método leva em consideração recursos ainda não lançados, antes que o nível da API seja elevado.
Parâmetros | |
---|---|
strictMinLevel | int : O nível mínimo estrito possível que suporta o recurso. |
Devoluções | |
---|---|
boolean | True se o nível for suportado. Falso caso contrário. |
Lança | |
---|---|
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
Exclui todos os dados acumulados do logcat.
Isso é útil para casos em que você deseja garantir queITestDevice#getLogcat()
retorne apenas dados de log produzidos após um determinado ponto (como após a atualização de uma nova compilação de dispositivo etc.). deleteFile
public abstract void deleteFile (String deviceFilePath)
Método auxiliar para excluir um arquivo ou diretório no dispositivo.
Parâmetros | |
---|---|
deviceFilePath | String : O caminho absoluto do arquivo no dispositivo. |
Lança | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Método auxiliar para verificar se o dispositivo foi reiniciado por software comparando o system_server atual com o system_server ProcessInfo
anterior. Use getProcessByName(String)
para obter ProcessInfo
.
Parâmetros | |
---|---|
prevSystemServerProcess | ProcessInfo : o processo anterior do system_server ProcessInfo . |
Devoluções | |
---|---|
boolean | true se o dispositivo for reinicializado por software |
Lança | |
---|---|
RuntimeException | se o dispositivo tiver um motivo de inicialização anormal |
DeviceNotAvailableException |
deviceSoftRestartedDesde
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Método auxiliar para verificar se o dispositivo foi reiniciado desde o horário UTC desde a época do dispositivo e seu ERROR(/TimeUnit)
. Soft-Restart refere-se ao system_server reiniciado fora de uma reinicialização forçada do dispositivo (por exemplo: reinicialização solicitada). O dispositivo atual utcEpochTime em Milliseccond pode ser obtido pelo método getDeviceDate()
.
Parâmetros | |
---|---|
utcEpochTime | long : o tempo do dispositivo em segundos desde a época. |
timeUnit | TimeUnit : a unidade de tempo TimeUnit para o utcEpochTime fornecido. |
Devoluções | |
---|---|
boolean | true se o dispositivo for reinicializado por software |
Lança | |
---|---|
RuntimeException | se o dispositivo tiver um motivo de inicialização anormal |
DeviceNotAvailableException |
disableAdbRoot
public abstract boolean disableAdbRoot ()
Desativa a raiz do adb.
A desativação do adb root pode fazer com que o dispositivo se desconecte do adb. Este método irá bloquear até que o dispositivo esteja disponível.Devoluções | |
---|---|
boolean | true se for bem sucedido. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
fazFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Método auxiliar para determinar se o arquivo no dispositivo existe.
Parâmetros | |
---|---|
deviceFilePath | String : o caminho absoluto do arquivo no dispositivo para verificar |
Devoluções | |
---|---|
boolean | true se o arquivo existir, false caso contrário. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
Ativa a raiz do adb. Se a configuração "enable-root" for "false", registrará uma mensagem e retornará sem habilitar o root.
Habilitar o adb root pode fazer com que o dispositivo se desconecte do adb. Este método irá bloquear até que o dispositivo esteja disponível.Devoluções | |
---|---|
boolean | true se for bem sucedido. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Método auxiliar que executa um comando adb como um comando do sistema com um tempo limite especificado.
executeShellCommand(String)
deve ser usado sempre que possível, pois esse método fornece melhor detecção de falhas e desempenho.
Parâmetros | |
---|---|
timeout | long : o tempo em milissegundos antes que o dispositivo seja considerado sem resposta, 0L para nenhum tempo limite |
commandArgs | String : o comando adb e argumentos a serem executados |
Devoluções | |
---|---|
String | o stdout do comando. null se o comando falhou ao executar. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
executeAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Método auxiliar que executa um comando adb como um comando do sistema.
executeShellCommand(String)
deve ser usado sempre que possível, pois esse método fornece melhor detecção de falhas e desempenho.Parâmetros | |
---|---|
commandArgs | String : o comando adb e argumentos a serem executados |
Devoluções | |
---|---|
String | o stdout do comando. null se o comando falhou ao executar. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeFastbootCommand
public abstract CommandResult executeFastbootCommand (String... commandArgs)
Método auxiliar que executa um comando fastboot como um comando do sistema com um tempo limite padrão de 2 minutos.
Espera-se que seja usado quando o dispositivo já estiver no modo fastboot.Parâmetros | |
---|---|
commandArgs | String : o comando fastboot e argumentos a serem executados |
Devoluções | |
---|---|
CommandResult | o CommandResult contendo a saída do comando |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
Método auxiliar que executa um comando fastboot como um comando do sistema.
Espera-se que seja usado quando o dispositivo já estiver no modo fastboot.Parâmetros | |
---|---|
timeout | long : o tempo em milissegundos antes do comando expirar |
commandArgs | String : o comando fastboot e argumentos a serem executados |
Devoluções | |
---|---|
CommandResult | o CommandResult contendo a saída do comando |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeLongFastboot
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Método auxiliar que executa um comando fastboot de longa duração como um comando do sistema com variáveis de ambiente do sistema.
Idêntico ao executeFastbootCommand(String)
, exceto que usa um tempo limite maior.
Parâmetros | |
---|---|
envVarMap | |
commandArgs | String : o comando fastboot e argumentos a serem executados |
Devoluções | |
---|---|
CommandResult | o CommandResult contendo a saída do comando |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeLongFastboot
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Método auxiliar que executa um comando fastboot de longa duração como um comando do sistema.
Idêntico aoexecuteFastbootCommand(String)
, exceto que usa um tempo limite maior.Parâmetros | |
---|---|
commandArgs | String : o comando fastboot e argumentos a serem executados |
Devoluções | |
---|---|
CommandResult | o CommandResult contendo a saída do comando |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
executeShellCommand
public abstract String executeShellCommand (String command)
Método auxiliar que executa um comando shell adb e retorna a saída como uma String
.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
Devoluções | |
---|---|
String | a saída do shell |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
receiver | IShellOutputReceiver : o IShellOutputReceiver para o qual direcionar a saída do shell. |
maxTimeToOutputShellResponse | long : a quantidade máxima de tempo durante a qual o comando pode não gerar nenhuma resposta; unidade conforme especificado em timeUnit |
timeUnit | TimeUnit : unidade para maxTimeToOutputShellResponse |
retryAttempts | int : o número máximo de vezes para repetir o comando se ele falhar devido a uma exceção. DeviceNotResponsiveException será lançado se retryAttempts forem executados sem sucesso. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
receiver | IShellOutputReceiver : o IShellOutputReceiver para o qual direcionar a saída do shell. |
maxTimeoutForCommand | long : o tempo limite máximo para a conclusão do comando; unidade conforme especificado em timeUnit |
maxTimeToOutputShellResponse | long : a quantidade máxima de tempo durante a qual o comando pode não gerar nenhuma resposta; unidade conforme especificado em timeUnit |
timeUnit | TimeUnit : unidade para maxTimeToOutputShellResponse |
retryAttempts | int : o número máximo de vezes para repetir o comando se ele falhar devido a uma exceção. DeviceNotResponsiveException será lançado se retryAttempts forem executados sem sucesso. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
Executa o comando de shell adb fornecido, tentando novamente várias vezes se o comando falhar.
Uma forma mais simples deexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
com valores padrão.Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
receiver | IShellOutputReceiver : o IShellOutputReceiver para o qual direcionar a saída do shell. |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command)
Método auxiliar que executa um comando shell adb e retorna os resultados como um CommandResult
preenchido corretamente com a saída de status do comando, stdout e stderr.
Parâmetros | |
---|---|
command | String : O comando que deve ser executado. |
Devoluções | |
---|---|
CommandResult | O resultado em CommandResult . |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
Método auxiliar que executa um comando shell adb e retorna os resultados como um CommandResult
preenchido corretamente com a saída de status do comando e stderr. stdout é direcionado para o fluxo especificado.
Parâmetros | |
---|---|
command | String : O comando que deve ser executado. |
pipeToOutput | OutputStream : ERROR(/OutputStream) onde a saída std será redirecionada ou nula. |
Devoluções | |
---|---|
CommandResult | O resultado em CommandResult . |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
Método auxiliar que executa um comando shell adb e retorna os resultados como um CommandResult
preenchido corretamente com a saída de status do comando, stdout e stderr.
Parâmetros | |
---|---|
command | String : O comando que deve ser executado. |
pipeAsInput | File : Um ERROR(/File) que será canalizado como entrada para o comando ou nulo. |
Devoluções | |
---|---|
CommandResult | O resultado em CommandResult . |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
maxTimeoutForCommand | long : o tempo limite máximo para a conclusão do comando; unidade conforme especificado em timeUnit |
timeUnit | TimeUnit : unidade para maxTimeToOutputShellResponse |
retryAttempts | int : o número máximo de vezes para repetir o comando se ele falhar devido a uma exceção. DeviceNotResponsiveException será lançado se retryAttempts forem executados sem sucesso. |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
Veja também:
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
maxTimeoutForCommand | long : o tempo limite máximo para a conclusão do comando; unidade conforme especificado em timeUnit |
timeUnit | TimeUnit : unidade para maxTimeToOutputShellResponse |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
Veja também:
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
pipeAsInput | File : Um ERROR(/File) que será canalizado como entrada para o comando ou nulo. |
pipeToOutput | OutputStream : ERROR(/OutputStream) onde a saída std será redirecionada ou nula. |
maxTimeoutForCommand | long : o tempo limite máximo para a conclusão do comando; unidade conforme especificado em timeUnit |
timeUnit | TimeUnit : unidade para maxTimeToOutputShellResponse |
retryAttempts | int : o número máximo de vezes para repetir o comando se ele falhar devido a uma exceção. DeviceNotResponsiveException será lançado se retryAttempts forem executados sem sucesso. |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
Veja também:
comando executeShellV2
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executa um comando shell adb, com mais parâmetros para controlar o comportamento do comando.
Parâmetros | |
---|---|
command | String : o comando do shell adb a ser executado |
pipeAsInput | File : Um ERROR(/File) que será canalizado como entrada para o comando ou nulo. |
pipeToOutput | OutputStream : ERROR(/OutputStream) onde a saída std será redirecionada ou nula. |
pipeToError | OutputStream : ERROR(/OutputStream) onde o erro std será redirecionado, ou null. |
maxTimeoutForCommand | long : o tempo limite máximo para a conclusão do comando; unidade conforme especificado em timeUnit |
timeUnit | TimeUnit : unidade para maxTimeToOutputShellResponse |
retryAttempts | int : o número máximo de vezes para repetir o comando se ele falhar devido a uma exceção. DeviceNotResponsiveException será lançado se retryAttempts forem executados sem sucesso. |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
Veja também:
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
Método auxiliar que limpa uma partição para o dispositivo.
SegetUseFastbootErase()
for true
, o fastboot erase será usado para limpar a partição. O dispositivo deve então criar um sistema de arquivos na próxima vez que o dispositivo for inicializado. Caso contrário, o formato fastboot será usado, o que criará um novo sistema de arquivos no dispositivo. Espera-se que seja usado quando o dispositivo já estiver no modo fastboot.Parâmetros | |
---|---|
partition | String : a partição a ser limpa |
Devoluções | |
---|---|
CommandResult | o CommandResult contendo a saída do comando |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
getApiLevel
public abstract int getApiLevel ()
Obtenha o nível de API do dispositivo. O padrão é UNKNOWN_API_LEVEL
.
Devoluções | |
---|---|
int | um número inteiro que indica o nível de API do dispositivo |
Lança | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
Método de conveniência para obter a versão de banda base (rádio) deste dispositivo. Obter a versão do rádio é específico do dispositivo, portanto, pode não retornar as informações corretas para todos os dispositivos. Este método depende da propriedade gsm.version.baseband para retornar as informações de versão corretas. Isso não é preciso para alguns dispositivos CDMA e a versão retornada aqui pode não corresponder à versão relatada do fastboot e pode não retornar a versão do rádio CDMA. TL;DR este método só informa a versão precisa se a propriedade gsm.version.baseband for a mesma que a versão retornada por fastboot getvar version-baseband
.
Devoluções | |
---|---|
String | a versão de banda base da String ou null se não puder ser determinada (o dispositivo não possui rádio ou a string de versão não pode ser lida) |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
obterBateria
public abstract Integer getBattery ()
Retorna o nível atual da bateria de um dispositivo ou Nulo se o nível da bateria não estiver disponível.
Devoluções | |
---|---|
Integer |
getBooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
Retorna o valor booleano da propriedade fornecida.
Parâmetros | |
---|---|
name | String : o nome da propriedade |
defaultValue | boolean : valor padrão a ser retornado se a propriedade estiver vazia ou não existir. |
Devoluções | |
---|---|
boolean | true se a propriedade tiver o valor "1" , "y" , "yes" , "on" ou "true" , false se a propriedade tiver o valor "0" , "n" , "no" , "off" , "false" ou defaultValue caso contrário. |
Lança | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
O método auxiliar coleta o mapa do histórico de inicialização com o tempo de inicialização e o motivo da inicialização.
Devoluções | |
---|---|
Mapa do tempo de inicialização (hora UTC em segundo desde a Epoch) e motivo da inicialização |
Lança | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
O método auxiliar coleta o mapa do histórico de inicialização com o tempo de inicialização e o motivo da inicialização desde o tempo determinado desde a época do dispositivo e a unidade de tempo especificada. O dispositivo atual utcEpochTime em milissegundos pode ser obtido pelo método getDeviceDate()
.
Parâmetros | |
---|---|
utcEpochTime | long : o tempo do dispositivo desde a Epoch. |
timeUnit | TimeUnit : a unidade de tempo TimeUnit . |
Devoluções | |
---|---|
Mapa do tempo de inicialização (hora UTC em segundo desde a Epoch) e motivo da inicialização |
Lança | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
Método de conveniência para obter a versão do bootloader deste dispositivo.
Tentará recuperar a versão do carregador de inicialização do estado atual do dispositivo. (ou seja, se o dispositivo estiver no modo fastboot, ele tentará recuperar a versão do fastboot)Devoluções | |
---|---|
String | a versão do carregador de inicialização String ou null se não puder ser encontrada |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
getBugreport
public abstract InputStreamSource getBugreport ()
Recupera um relatório de bug do dispositivo.
A implementação disso é garantida para continuar funcionando em um dispositivo sem cartão SD (ou onde o cartão SD ainda não está montado).Devoluções | |
---|---|
InputStreamSource | Um InputStreamSource que produzirá o conteúdo do relatório de bug sob demanda. Em caso de falha, o InputStreamSource produzirá um ERROR(/InputStream) vazio. |
getBugreportz
public abstract InputStreamSource getBugreportz ()
Recupera um bugreportz do dispositivo. O relatório de bug em formato zip contém o relatório de bug principal e outros arquivos de log que são úteis para depuração.
Compatível apenas com 'versão adb' > 1.0.36Devoluções | |
---|---|
InputStreamSource | um InputStreamSource do arquivo zip contendo o bugreportz, retorna null em caso de falha. |
getBuildAlias
public abstract String getBuildAlias ()
Recupere o alias da compilação que o dispositivo está executando no momento.
O alias de compilação geralmente é uma string mais legível do que o ID de compilação (normalmente um número para compilações do Nexus). Por exemplo, a versão final do Android 4.2 tem o alias de compilação JDQ39 e o ID de compilação 573038
Devoluções | |
---|---|
String | o alias de compilação ou volte para o ID de compilação se não puder ser recuperado |
Lança | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
Recupere o tipo de compilação para o dispositivo.
Devoluções | |
---|---|
String | o tipo de compilação ou nulo se não puder ser recuperado |
Lança | |
---|---|
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Recupere a compilação que o dispositivo está executando no momento.
Devoluções | |
---|---|
String | o id de compilação ou IBuildInfo#UNKNOWN_BUILD_ID se não puder ser recuperado |
Lança | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
Retorna o tipo de chave usado para assinar a imagem do dispositivo
Normalmente, os dispositivos Android podem ser assinados com chaves de teste (como no AOSP) ou chaves de liberação (controladas por fabricantes de dispositivos individuais)
Devoluções | |
---|---|
String | A chave de assinatura se encontrada, nula caso contrário. |
Lança | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Retorna um DeviceDescriptor
armazenado em cache se o dispositivo estiver alocado, caso contrário, retorna o DeviceDescriptor
atual.
Devoluções | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Retorna um DeviceDescriptor
armazenado em cache se o dispositivo estiver alocado, caso contrário, retorna o DeviceDescriptor
atual.
Parâmetros | |
---|---|
shortDescriptor | boolean : se deve ou não limitar o descritor às informações mínimas |
Devoluções | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
Alternativa ao uso de IFileEntry
que às vezes não funciona devido a permissões.
Parâmetros | |
---|---|
deviceFilePath | String : é o caminho no dispositivo onde fazer a busca |
Devoluções | |
---|---|
String[] | Matriz de string contendo todo o arquivo em um caminho no dispositivo. |
Lança | |
---|---|
DeviceNotAvailableException |
getDeviceClass
public abstract String getDeviceClass ()
Obtenha a classe do dispositivo.
Devoluções | |
---|---|
String | a classe de dispositivo String . |
getDeviceDate
public abstract long getDeviceDate ()
Retorna a data do dispositivo em milissegundos desde a época.
Devoluções | |
---|---|
long | a data do dispositivo no formato de época. |
Lança | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Retorne um DeviceDescriptor
das informações do dispositivo para obter informações sobre ele sem passar o objeto de dispositivo real.
Devoluções | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Retorne um DeviceDescriptor
das informações do dispositivo para obter informações sobre ele sem passar o objeto de dispositivo real.
Parâmetros | |
---|---|
shortDescriptor | boolean : se deve ou não limitar o descritor às informações mínimas |
Devoluções | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Obtenha o estado do dispositivo.
Devoluções | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Helper para obter a diferença de tempo entre o dispositivo e um determinado ERROR(/Date)
. Use o tempo Epoch internamente.
Parâmetros | |
---|---|
date | Date |
Devoluções | |
---|---|
long | a diferença em milissegundos |
Lança | |
---|---|
DeviceNotAvailableException |
getEmulatorSaída
public abstract InputStreamSource getEmulatorOutput ()
Obtenha o fluxo do emulador stdout e stderr
Devoluções | |
---|---|
InputStreamSource | saída do emulador |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Método auxiliar para determinar a quantidade de espaço livre no armazenamento externo do dispositivo.
Devoluções | |
---|---|
long | a quantidade de espaço livre em KB |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
getFastbootProductType
public abstract String getFastbootProductType ()
Método de conveniência para obter o tipo de produto deste dispositivo quando estiver no modo fastboot.
Este método só deve ser usado se o dispositivo estiver em fastboot. É uma variante um pouco mais segura do que o método genéricogetProductType()
neste caso, porque ITestDevice saberá como recuperar o dispositivo no fastboot se o dispositivo estiver em estado incorreto ou não responder.Devoluções | |
---|---|
String | o nome do tipo de produto String ou null se não puder ser determinado |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
Método de conveniência para obter o tipo de produto deste dispositivo quando estiver no modo fastboot.
Este método só deve ser usado se o dispositivo estiver em fastboot. É uma variante um pouco mais segura do que o método genéricogetProductType()
neste caso, porque ITestDevice saberá como recuperar o dispositivo no fastboot se o dispositivo estiver em estado incorreto ou não responder.Devoluções | |
---|---|
String | o nome do tipo de produto String ou null se não puder ser determinado |
Lança | |
---|---|
DeviceNotAvailableException | se a conexão com o dispositivo for perdida e não puder ser recuperada. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Retorna o número de série do modo fastboot.
Devoluções | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
Recupere o valor da variável fastboot fornecido do dispositivo.
Parâmetros | |
---|---|
variableName | String : o nome da variável |
Devoluções | |
---|---|
String | o valor da propriedade ou null se não existir |
Lança | |
---|---|
| UnsupportedOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
Recupere uma referência a um arquivo remoto no dispositivo.
Parâmetros | |
---|---|
path | String : o caminho do arquivo a ser recuperado. Pode ser um caminho absoluto ou um caminho relativo a '/'. (ou seja, ambas as sintaxes "/system" e "system" são suportadas) |
Devoluções | |
---|---|
IFileEntry | o IFileEntry ou null se o arquivo no path fornecido não puder ser encontrado |
Lança | |
---|---|
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Retorna uma referência ao ddmlib IDevice
associado.
IDevice
pode ser alocado pelo DDMS cada vez que o dispositivo se desconecta e se reconecta do adb. Assim, os chamadores não devem manter uma referência ao IDevice
, porque essa referência pode se tornar obsoleta.Devoluções | |
---|---|
IDevice | o IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Retorna o valor inteiro da propriedade fornecida do dispositivo.
Parâmetros | |
---|---|
name | String : o nome da propriedade |
defaultValue | long : valor padrão a ser retornado se a propriedade estiver vazia ou não existir. |
Devoluções | |
---|---|
long | o valor da propriedade ou defaultValue se a propriedade estiver vazia, não existir ou não tiver um valor inteiro. |
Lança | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Retorna a última vez que as APIs Tradefed acionaram uma reinicialização em milissegundos desde EPOCH conforme retornado por System.currentTimeMillis()
.
Devoluções | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Obtenha o primeiro nível de API lançado do dispositivo. O padrão é UNKNOWN_API_LEVEL
.
Devoluções | |
---|---|
int | um número inteiro que indica o primeiro nível de API lançado do dispositivo |
Lança | |
---|---|
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Pega um fluxo de instantâneo dos dados do logcat.
Funciona em dois modos:
TestDeviceOptions.getMaxLogcatDataSize()
bytes do conteúdo atual da captura de logcat em segundo planoDevoluções | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Pega um fluxo de instantâneo dos últimos maxBytes
de dados logcat capturados.
Útil para casos em que você deseja capturar instantâneos frequentes dos dados logcat capturados sem incorrer na penalidade de espaço em disco potencialmente grande de obter o instantâneo getLogcat()
inteiro.
Parâmetros | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
Devoluções | |
---|---|
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.
Devoluções | |
---|---|
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()
.
Parâmetros | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
Devoluções | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
Parâmetros | |
---|---|
mountName | String : the name of the mount point |
Devoluções | |
---|---|
String | the mount point or null |
See also:
getMountPointInfo
public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
Parâmetros | |
---|---|
mountpoint | String |
Devoluções | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Lança | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
Devoluções | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Lança | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
Parâmetros | |
---|---|
partition | String |
Devoluções | |
---|---|
long | the amount of free space in KB |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
processName | String : the proces name String. |
Devoluções | |
---|---|
ProcessInfo | ProcessInfo of given processName |
Lança | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
Parâmetros | |
---|---|
process | String : The proces name String. |
Devoluções | |
---|---|
String |
Lança | |
---|---|
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.Devoluções | |
---|---|
String | the String product type name. Will not be null |
Lança | |
---|---|
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.Devoluções | |
---|---|
String | the String product variant name or null if it cannot be determined |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
name | String : the property name |
Devoluções | |
---|---|
String | the property value or null if it does not exist |
Lança | |
---|---|
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
Devoluções | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
Devoluções | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
Devoluções | |
---|---|
A list of tombstone files, empty if no tombstone. |
Lança | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
Devoluções | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
Devoluções | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
Devoluções | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
Devoluções | |
---|---|
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
Devoluções | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Lança | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
Devoluções | |
---|---|
boolean | true if the device is encrypted. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
deviceFilePath | String |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
Devoluções | |
---|---|
boolean | true if the device supports encryption. |
Lança | |
---|---|
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
Parâmetros | |
---|---|
fullPath | String |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
Devoluções | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
Devoluções | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
Parâmetros | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
Devoluções | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
logBugreport
public abstract boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
Parâmetros | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
Devoluções | |
---|---|
boolean | True if the logging was successful, false otherwise. |
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.
Parâmetros | |
---|---|
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.
Lança | |
---|---|
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)Lança | |
---|---|
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.
Parâmetros | |
---|---|
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.
Parâmetros | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
Lança | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
Parâmetros | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
Devoluções | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
Lança | |
---|---|
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
.
Parâmetros | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
Devoluções | |
---|---|
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) |
Lança | |
---|---|
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
.
Parâmetros | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Devoluções | |
---|---|
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) |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
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. |
Devoluções | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
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 |
Devoluções | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Devoluções | |
---|---|
String | A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Lança | |
---|---|
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
.
Parâmetros | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
Devoluções | |
---|---|
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) |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
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 |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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
Parâmetros | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
Devoluções | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Lança | |
---|---|
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.Lança | |
---|---|
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.
Parâmetros | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Lança | |
---|---|
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.Lança | |
---|---|
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.
Lança | |
---|---|
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 recoveryLança | |
---|---|
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
Parâmetros | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
Lança | |
---|---|
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
Lança | |
---|---|
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.
Lança | |
---|---|
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.
Parâmetros | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Lança | |
---|---|
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.
Lança | |
---|---|
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.
Lança | |
---|---|
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.
Lança | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Lança | |
---|---|
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.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
Devoluções | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
Devoluções | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Lança | |
---|---|
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, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
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.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
setDate
public abstract void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
Parâmetros | |
---|---|
date | Date : specify a particular date; will use host date if null |
Lança | |
---|---|
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
Parâmetros | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
Parâmetros | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
Devoluções | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
setRecovery
public abstract void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
Parâmetros | |
---|---|
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, etcParâmetros | |
---|---|
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.
Parâmetros | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
See also:
startLogcat
public abstract void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
Devoluções | |
---|---|
String | the tcp serial number or null if device could not be switched |
Lança | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
Devoluções | |
---|---|
boolean | true if switch was successful, false otherwise. |
Lança | |
---|---|
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.Parâmetros | |
---|---|
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 |
Devoluções | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
takeBugreport
public abstract Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue.
Bugreport#close()
.Devoluções | |
---|---|
Bugreport |
unlockDevice
public abstract boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.Devoluções | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
Parâmetros | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
Devoluções | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Lança | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
Devoluções | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Lança | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Lança | |
---|---|
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
).
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
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
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
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
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public abstract void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |
INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Provides an reliable and slightly higher level API to a ddmlib IDevice
.
Resumo
Constants | |
---|---|
int | UNKNOWN_API_LEVEL Default value when API Level cannot be detected |
Métodos públicos | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Check whether or not a feature is currently supported given a minimally supported level. |
abstract void | clearLogcat () Deletes any accumulated logcat data. |
abstract void | deleteFile (String deviceFilePath) Helper method to delete a file or directory on the device. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) Helper method to check if device soft-restarted by comparing current system_server with previous system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Helper method to check whether device soft-restarted since the UTC time since epoch from device and its |
abstract boolean | disableAdbRoot () Turns off adb root. |
abstract boolean | doesFileExist (String deviceFilePath) Helper method to determine if file on device exists. |
abstract boolean | enableAdbRoot () Turns on adb root. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) Helper method which executes a adb command as a system command with a specified timeout. |
abstract String | executeAdbCommand (String... commandArgs) Helper method which executes a adb command as a system command. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) Helper method which executes a fastboot command as a system command with a default timeout of 2 minutes. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) Helper method which executes a fastboot command as a system command. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Helper method which executes a long running fastboot command as a system command with system environment variables. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) Helper method which executes a long running fastboot command as a system command. |
abstract String | executeShellCommand (String command) Helper method which executes a adb shell command and returns output as a |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) Executes the given adb shell command, retrying multiple times if command fails. |
abstract CommandResult | executeShellV2Command (String command) Helper method which executes a adb shell command and returns the results as a |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Helper method which executes an adb shell command and returns the results as a |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Helper method which executes an adb shell command and returns the results as a |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | fastbootWipePartition (String partition) Helper method which wipes a partition for the device. |
abstract int | getApiLevel () Get the device API Level. |
abstract String | getBasebandVersion () Convenience method to get baseband (radio) version of this device. |
abstract Integer | getBattery () Returns the current battery level of a device or Null if battery level unavailable. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Returns boolean value of the given property. |
abstract | getBootHistory () Helper method collects the boot history map with boot time and boot reason. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. |
abstract String | getBootloaderVersion () Convenience method to get the bootloader version of this device. |
abstract InputStreamSource | getBugreport () Retrieves a bugreport from the device. |
abstract InputStreamSource | getBugreportz () Retrieves a bugreportz from the device. |
abstract String | getBuildAlias () Retrieve the alias of the build that the device is currently running. |
abstract String | getBuildFlavor () Retrieve the build flavor for the device. |
abstract String | getBuildId () Retrieve the build the device is currently running. |
abstract String | getBuildSigningKeys () Returns the key type used to sign the device image Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Returns a cached |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Returns a cached |
abstract String[] | getChildren (String deviceFilePath) Alternative to using |
abstract String | getDeviceClass () Get the device class. |
abstract long | getDeviceDate () Return the date of the device in millisecond since epoch. |
abstract DeviceDescriptor | getDeviceDescriptor () Return a |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Return a |
abstract TestDeviceState | getDeviceState () Get the device's state. |
abstract long | getDeviceTimeOffset (Date date) Helper to get the time difference between the device and a given |
abstract InputStreamSource | getEmulatorOutput () Get the stream of emulator stdout and stderr |
abstract long | getExternalStoreFreeSpace () Helper method to determine amount of free space on device external storage. |
abstract String | getFastbootProductType () Convenience method to get the product type of this device when its in fastboot mode. |
abstract String | getFastbootProductVariant () Convenience method to get the product type of this device when its in fastboot mode. |
abstract String | getFastbootSerialNumber () Returns the fastboot mode serial number. |
abstract String | getFastbootVariable (String variableName) Retrieve the given fastboot variable value from the device. |
abstract IFileEntry | getFileEntry (String path) Retrieve a reference to a remote file on device. |
abstract IDevice | getIDevice () Returns a reference to the associated ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Returns integer value of the given property from the device. |
abstract long | getLastExpectedRebootTimeMillis () Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by |
abstract int | getLaunchApiLevel () Get the device's first launched API Level. |
abstract InputStreamSource | getLogcat () Grabs a snapshot stream of the logcat data. |
abstract InputStreamSource | getLogcat (int maxBytes) Grabs a snapshot stream of the last |
abstract InputStreamSource | getLogcatDump () Get a dump of the current logcat for device. |
abstract InputStreamSource | getLogcatSince (long date) Grabs a snapshot stream of captured logcat data starting the date provided. |
abstract String | getMountPoint (String mountName) Returns a mount point. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Returns a |
abstract | getMountPointInfo () Returns a parsed version of the information in /proc/mounts on the device |
abstract long | getPartitionFreeSpace (String partition) Helper method to determine amount of free space on device partition. |
abstract ProcessInfo | getProcessByName (String processName) Helper method runs the "pidof" and "stat" command and returns |
abstract String | getProcessPid (String process) Returns the pid of the service or null if something went wrong. |
abstract String | getProductType () Convenience method to get the product type of this device. |
abstract String | getProductVariant () Convenience method to get the product variant of this device. |
abstract String | getProperty (String name) Retrieve the given property value from the device. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () Get the current recovery mode used for the device. |
abstract String | getSerialNumber () Convenience method to get serial number of this device. |
abstract | getTombstones () Fetch and return the list of tombstones from the devices. |
abstract long | getTotalMemory () Returns total physical memory size in bytes or -1 in case of internal error |
abstract boolean | getUseFastbootErase () Get whether to use fastboot erase or fastboot format to wipe a partition on the device. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () Check whether platform on device supports app enumeration |
abstract boolean | isDeviceEncrypted () Returns if the device is encrypted. |
abstract boolean | isDirectory (String deviceFilePath) Return True if the path on the device is a directory, false otherwise. |
abstract boolean | isEncryptionSupported () Returns if encryption is supported on the device. |
abstract boolean | isExecutable (String fullPath) Returns True if the file path on the device is an executable file, false otherwise. |
abstract boolean | isHeadless () Return true if the device is headless (no screen), false otherwise. |
abstract boolean | isRuntimePermissionSupported () Check whether platform on device supports runtime permission granting |
abstract boolean | isStateBootloaderOrFastbootd () Returns true if device is in |
abstract boolean | logAnrs ( ITestLogger logger) Collects and log ANRs from the device. |
abstract boolean | logBugreport (String dataName, ITestLogger listener) Helper method to take a bugreport and log it to the reporters. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Log a message in the logcat of the device. |
abstract void | nonBlockingReboot () Issues a command to reboot device and returns on command complete and when device is no longer visible to adb. |
abstract void | postBootSetup () Perform instructions to configure device for testing that after every boot. |
default void | postInvocationTearDown () This method is deprecated. Use |
abstract void | postInvocationTearDown (Throwable invocationException) Extra steps for device specific required clean up that will be executed after the invocation is done. |
default 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. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Recursively pull directory contents from device. |
abstract File | pullFile (String remoteFilePath, int userId) Retrieves a file off device, stores it in a local temporary |
abstract File | pullFile (String remoteFilePath) Retrieves a file off device, stores it in a local temporary |
abstract boolean | pullFile (String remoteFilePath, File localFile) Retrieves a file off device. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Retrieves a file off device. |
abstract String | pullFileContents (String remoteFilePath) Retrieves a file off device, and returns the contents. |
abstract File | pullFileFromExternal (String remoteFilePath) A convenience method to retrieve a file from the device's external storage, stores it in a local temporary |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) Recursively push directory contents to device while excluding some directories that are filtered. |
abstract boolean | pushDir (File localDir, String deviceFilePath) Recursively push directory contents to device. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) Variant of |
abstract boolean | pushFile (File localFile, String deviceFilePath) Push a file to device. |
abstract boolean | pushString (String contents, String deviceFilePath) Push file created from a string to device |
abstract void | reboot () Reboots the device into adb mode. |
abstract void | reboot (String reason) Reboots the device into adb mode with given |
abstract void | rebootIntoBootloader () Reboots the device into bootloader mode. |
abstract void | rebootIntoFastbootd () Reboots the device into fastbootd mode. |
abstract void | rebootIntoRecovery () Reboots the device into adb recovery mode. |
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 |
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 |
abstract void | rebootUntilOnline () An alternate to |
abstract void | rebootUntilOnline (String reason) An alternate to |
abstract void | rebootUserspace () Reboots only userspace part of device. |
abstract void | rebootUserspaceUntilOnline () An alternate to |
abstract void | remountSystemWritable () Make the system partition on the device writable. |
abstract void | remountVendorWritable () Make the vendor partition on the device writable. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) Convenience method for performing |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) Runs instrumentation tests, and provides device recovery. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Same as |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) Same as |
abstract void | setDate (Date date) Sets the date on device Note: setting date on device requires root |
abstract void | setOptions ( TestDeviceOptions options) Set the |
abstract boolean | setProperty (String propKey, String propValue) Sets the given property value on the device. |
abstract void | setRecovery ( IDeviceRecovery recovery) Set the |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) Set the current recovery mode to use for the device. |
abstract void | setUseFastbootErase (boolean useFastbootErase) Set whether to use fastboot erase or fastboot format to wipe a partition on the device. |
abstract void | startLogcat () Start capturing logcat output from device in the background. |
abstract void | stopEmulatorOutput () Close and delete the emulator output. |
abstract void | stopLogcat () Stop capturing logcat output from device, and discard currently saved logcat data. |
abstract String | switchToAdbTcp () Switch device to adb-over-tcp mode. |
abstract boolean | switchToAdbUsb () Switch device to adb over usb mode. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) Incrementally syncs the contents of a local file directory to device. |
abstract Bugreport | takeBugreport () Take a bugreport and returns it inside a |
abstract boolean | unlockDevice () Unlocks the device if the device is in an encrypted state. |
abstract boolean | waitForBootComplete (long timeOut) Blocks until the device's boot complete flag is set. |
abstract boolean | waitForDeviceAvailable () Waits for the device to be responsive and available for testing. |
abstract boolean | waitForDeviceAvailable (long waitTime) Waits for the device to be responsive and available for testing. |
abstract void | waitForDeviceBootloader () Blocks until device is visible via fastboot. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Blocks for the device to be in the 'adb recovery' state (note this is distinct from |
abstract boolean | waitForDeviceInSideload (long waitTime) Blocks for the device to be in the 'adb sideload' state |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Blocks for the device to be not available ie missing from adb |
abstract void | waitForDeviceOnline () Blocks until device is visible via adb. |
abstract void | waitForDeviceOnline (long waitTime) Blocks until device is visible via adb. |
abstract boolean | waitForDeviceShell (long waitTime) Waits for device to be responsive to a basic adb shell command. |
Constants
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
Default value when API Level cannot be detected
Constant Value: -1 (0xffffffff)
Métodos públicos
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Check whether or not a feature is currently supported given a minimally supported level. This method takes into account unreleased features yet, before API level is raised.
Parâmetros | |
---|---|
strictMinLevel | int : The strict min possible level that supports the feature. |
Devoluções | |
---|---|
boolean | True if the level is supported. False otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
Deletes any accumulated logcat data.
This is useful for cases when you want to ensureITestDevice#getLogcat()
only returns log data produced after a certain point (such as after flashing a new device build, etc). deleteFile
public abstract void deleteFile (String deviceFilePath)
Helper method to delete a file or directory on the device.
Parâmetros | |
---|---|
deviceFilePath | String : The absolute path of the file on the device. |
Lança | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Helper method to check if device soft-restarted by comparing current system_server with previous system_server ProcessInfo
. Use getProcessByName(String)
to get ProcessInfo
.
Parâmetros | |
---|---|
prevSystemServerProcess | ProcessInfo : the previous system_server process ProcessInfo . |
Devoluções | |
---|---|
boolean | true if device soft-restarted |
Lança | |
---|---|
RuntimeException | if device has abnormal boot reason |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Helper method to check whether device soft-restarted since the UTC time since epoch from device and its ERROR(/TimeUnit)
. Soft-Restart refers to system_server restarted outside of a device hard reboot (for example: requested reboot). The current device utcEpochTime in Milliseccond can be obtained by method getDeviceDate()
.
Parâmetros | |
---|---|
utcEpochTime | long : the device time in second since epoch. |
timeUnit | TimeUnit : the time unit TimeUnit for the given utcEpochTime. |
Devoluções | |
---|---|
boolean | true if device soft-restarted |
Lança | |
---|---|
RuntimeException | if device has abnormal boot reason |
DeviceNotAvailableException |
disableAdbRoot
public abstract boolean disableAdbRoot ()
Turns off adb root.
Disabling adb root may cause device to disconnect from adb. This method will block until device is available.Devoluções | |
---|---|
boolean | true if successful. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Helper method to determine if file on device exists.
Parâmetros | |
---|---|
deviceFilePath | String : the absolute path of file on device to check |
Devoluções | |
---|---|
boolean | true if file exists, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
Turns on adb root. If the "enable-root" setting is "false", will log a message and return without enabling root.
Enabling adb root may cause device to disconnect from adb. This method will block until device is available.Devoluções | |
---|---|
boolean | true if successful. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Helper method which executes a adb command as a system command with a specified timeout.
executeShellCommand(String)
should be used instead wherever possible, as that method provides better failure detection and performance.
Parâmetros | |
---|---|
timeout | long : the time in milliseconds before the device is considered unresponsive, 0L for no timeout |
commandArgs | String : the adb command and arguments to run |
Devoluções | |
---|---|
String | the stdout from command. null if command failed to execute. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Helper method which executes a adb command as a system command.
executeShellCommand(String)
should be used instead wherever possible, as that method provides better failure detection and performance.Parâmetros | |
---|---|
commandArgs | String : the adb command and arguments to run |
Devoluções | |
---|---|
String | the stdout from command. null if command failed to execute. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (String... commandArgs)
Helper method which executes a fastboot command as a system command with a default timeout of 2 minutes.
Expected to be used when device is already in fastboot mode.Parâmetros | |
---|---|
commandArgs | String : the fastboot command and arguments to run |
Devoluções | |
---|---|
CommandResult | the CommandResult containing output of command |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
Helper method which executes a fastboot command as a system command.
Expected to be used when device is already in fastboot mode.Parâmetros | |
---|---|
timeout | long : the time in milliseconds before the command expire |
commandArgs | String : the fastboot command and arguments to run |
Devoluções | |
---|---|
CommandResult | the CommandResult containing output of command |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Helper method which executes a long running fastboot command as a system command with system environment variables.
Identical to executeFastbootCommand(String)
except uses a longer timeout.
Parâmetros | |
---|---|
envVarMap | |
commandArgs | String : the fastboot command and arguments to run |
Devoluções | |
---|---|
CommandResult | the CommandResult containing output of command |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Helper method which executes a long running fastboot command as a system command.
Identical toexecuteFastbootCommand(String)
except uses a longer timeout.Parâmetros | |
---|---|
commandArgs | String : the fastboot command and arguments to run |
Devoluções | |
---|---|
CommandResult | the CommandResult containing output of command |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract String executeShellCommand (String command)
Helper method which executes a adb shell command and returns output as a String
.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
Devoluções | |
---|---|
String | the shell output |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
maxTimeToOutputShellResponse | long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
maxTimeToOutputShellResponse | long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
Executes the given adb shell command, retrying multiple times if command fails.
A simpler form ofexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
with default values.Parâmetros | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command)
Helper method which executes a adb shell command and returns the results as a CommandResult
properly populated with the command status output, stdout and stderr.
Parâmetros | |
---|---|
command | String : The command that should be run. |
Devoluções | |
---|---|
CommandResult | The result in CommandResult . |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
Helper method which executes an adb shell command and returns the results as a CommandResult
properly populated with the command status output and stderr. stdout is directed to the specified stream.
Parâmetros | |
---|---|
command | String : The command that should be run. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
Devoluções | |
---|---|
CommandResult | The result in CommandResult . |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
Helper method which executes an adb shell command and returns the results as a CommandResult
properly populated with the command status output, stdout and stderr.
Parâmetros | |
---|---|
command | String : The command that should be run. |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
Devoluções | |
---|---|
CommandResult | The result in CommandResult . |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
See also:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Executes a adb shell command, with more parameters to control command behavior.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
See also:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
See also:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
Parâmetros | |
---|---|
command | String : the adb shell command to run |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
pipeToError | OutputStream : ERROR(/OutputStream) where the std error will be redirected, or null. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
Devoluções | |
---|---|
CommandResult |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
See also:
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
Helper method which wipes a partition for the device.
IfgetUseFastbootErase()
is true
, then fastboot erase will be used to wipe the partition. The device must then create a filesystem the next time the device boots. Otherwise, fastboot format is used which will create a new filesystem on the device. Expected to be used when device is already in fastboot mode.Parâmetros | |
---|---|
partition | String : the partition to wipe |
Devoluções | |
---|---|
CommandResult | the CommandResult containing output of command |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getApiLevel
public abstract int getApiLevel ()
Get the device API Level. Defaults to UNKNOWN_API_LEVEL
.
Devoluções | |
---|---|
int | an integer indicating the API Level of device |
Lança | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
Convenience method to get baseband (radio) version of this device. Getting the radio version is device specific, so it might not return the correct information for all devices. This method relies on the gsm.version.baseband propery to return the correct version information. This is not accurate for some CDMA devices and the version returned here might not match the version reported from fastboot and might not return the version for the CDMA radio. TL;DR this method only reports accurate version if the gsm.version.baseband property is the same as the version returned by fastboot getvar version-baseband
.
Devoluções | |
---|---|
String | the String baseband version or null if it cannot be determined (device has no radio or version string cannot be read) |
Lança | |
---|---|
DeviceNotAvailableException | if the connection with the device is lost and cannot be recovered. |
getBattery
public abstract Integer getBattery ()
Returns the current battery level of a device or Null if battery level unavailable.
Devoluções | |
---|---|
Integer |
getBooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
Returns boolean value of the given property.
Parâmetros | |
---|---|
name | String : the property name |
defaultValue | boolean : default value to return if property is empty or doesn't exist. |
Devoluções | |
---|---|
boolean | true if the property has value "1" , "y" , "yes" , "on" , or "true" , false if the property has value of "0" , "n" , "no" , "off" , "false" , or defaultValue otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
Helper method collects the boot history map with boot time and boot reason.
Devoluções | |
---|---|
Map of boot time (UTC time in second since Epoch) and boot reason |
Lança | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. The current device utcEpochTime in Millisecond can be obtained by method getDeviceDate()
.
Parâmetros | |
---|---|
utcEpochTime | long : the device time since Epoch. |
timeUnit | TimeUnit : the time unit TimeUnit . |
Devoluções | |
---|---|
Map of boot time (UTC time in second since Epoch) and boot reason |
Lança | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
Convenience method to get the bootloader version of this device.
Will attempt to retrieve bootloader version from the device's current state. (ie if device is in fastboot mode, it will attempt to retrieve version from fastboot)Devoluções | |
---|---|
String | the String bootloader version or null if it cannot be found |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getBugreport
public abstract InputStreamSource getBugreport ()
Retrieves a bugreport from the device.
The implementation of this is guaranteed to continue to work on a device without an sdcard (or where the sdcard is not yet mounted).Devoluções | |
---|---|
InputStreamSource | An InputStreamSource which will produce the bugreport contents on demand. In case of failure, the InputStreamSource will produce an empty ERROR(/InputStream) . |
getBugreportz
public abstract InputStreamSource getBugreportz ()
Retrieves a bugreportz from the device. Zip format bugreport contains the main bugreport and other log files that are useful for debugging.
Only supported for 'adb version' > 1.0.36Devoluções | |
---|---|
InputStreamSource | a InputStreamSource of the zip file containing the bugreportz, return null in case of failure. |
getBuildAlias
public abstract String getBuildAlias ()
Retrieve the alias of the build that the device is currently running.
Build alias is usually a more readable string than build id (typically a number for Nexus builds). For example, final Android 4.2 release has build alias JDQ39, and build id 573038
Devoluções | |
---|---|
String | the build alias or fall back to build id if it could not be retrieved |
Lança | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
Retrieve the build flavor for the device.
Devoluções | |
---|---|
String | the build flavor or null if it could not be retrieved |
Lança | |
---|---|
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Retrieve the build the device is currently running.
Devoluções | |
---|---|
String | the build id or IBuildInfo#UNKNOWN_BUILD_ID if it could not be retrieved |
Lança | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
Returns the key type used to sign the device image
Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers)
Devoluções | |
---|---|
String | The signing key if found, null otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
Devoluções | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
Parâmetros | |
---|---|
shortDescriptor | boolean : Whether or not to limit descriptor to bare minimum info |
Devoluções | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
Alternative to using IFileEntry
that sometimes won't work because of permissions.
Parâmetros | |
---|---|
deviceFilePath | String : is the path on the device where to do the search |
Devoluções | |
---|---|
String[] | Array of string containing all the file in a path on the device. |
Lança | |
---|---|
DeviceNotAvailableException |
getDeviceClass
public abstract String getDeviceClass ()
Get the device class.
Devoluções | |
---|---|
String | the String device class. |
getDeviceDate
public abstract long getDeviceDate ()
Return the date of the device in millisecond since epoch.
Devoluções | |
---|---|
long | the date of the device in epoch format. |
Lança | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
Devoluções | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
Parâmetros | |
---|---|
shortDescriptor | boolean : Whether or not to limit descriptor to bare minimum info |
Devoluções | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Get the device's state.
Devoluções | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Helper to get the time difference between the device and a given ERROR(/Date)
. Use Epoch time internally.
Parâmetros | |
---|---|
date | Date |
Devoluções | |
---|---|
long | the difference in milliseconds |
Lança | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
Get the stream of emulator stdout and stderr
Devoluções | |
---|---|
InputStreamSource | emulator output |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Helper method to determine amount of free space on device external storage.
Devoluções | |
---|---|
long | the amount of free space in KB |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getFastbootProductType
public abstract String getFastbootProductType ()
Convenience method to get the product type of this device when its in fastboot mode.
This method should only be used if device should be in fastboot. Its a bit safer variant than the genericgetProductType()
method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.Devoluções | |
---|---|
String | the String product type name or null if it cannot be determined |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
Convenience method to get the product type of this device when its in fastboot mode.
This method should only be used if device should be in fastboot. Its a bit safer variant than the genericgetProductType()
method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.Devoluções | |
---|---|
String | the String product type name or null if it cannot be determined |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Returns the fastboot mode serial number.
Devoluções | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
Retrieve the given fastboot variable value from the device.
Parâmetros | |
---|---|
variableName | String : the variable name |
Devoluções | |
---|---|
String | the property value or null if it does not exist |
Lança | |
---|---|
| UnsupportedOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
Retrieve a reference to a remote file on device.
Parâmetros | |
---|---|
path | String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported) |
Devoluções | |
---|---|
IFileEntry | the IFileEntry or null if file at given path cannot be found |
Lança | |
---|---|
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Returns a reference to the associated ddmlib IDevice
.
IDevice
may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice
, because that reference may become stale.Devoluções | |
---|---|
IDevice | the IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Returns integer value of the given property from the device.
Parâmetros | |
---|---|
name | String : the property name |
defaultValue | long : default value to return if property is empty or doesn't exist. |
Devoluções | |
---|---|
long | the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value. |
Lança | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis()
.
Devoluções | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
Devoluções | |
---|---|
int | an integer indicating the first launched API Level of device |
Lança | |
---|---|
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat captureDevoluções | |
---|---|
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.
Parâmetros | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
Devoluções | |
---|---|
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.
Devoluções | |
---|---|
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()
.
Parâmetros | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
Devoluções | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
Parâmetros | |
---|---|
mountName | String : the name of the mount point |
Devoluções | |
---|---|
String | the mount point or null |
See also:
getMountPointInfo
public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
Parâmetros | |
---|---|
mountpoint | String |
Devoluções | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Lança | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
Devoluções | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Lança | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
Parâmetros | |
---|---|
partition | String |
Devoluções | |
---|---|
long | the amount of free space in KB |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
processName | String : the proces name String. |
Devoluções | |
---|---|
ProcessInfo | ProcessInfo of given processName |
Lança | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
Parâmetros | |
---|---|
process | String : The proces name String. |
Devoluções | |
---|---|
String |
Lança | |
---|---|
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.Devoluções | |
---|---|
String | the String product type name. Will not be null |
Lança | |
---|---|
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.Devoluções | |
---|---|
String | the String product variant name or null if it cannot be determined |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
name | String : the property name |
Devoluções | |
---|---|
String | the property value or null if it does not exist |
Lança | |
---|---|
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
Devoluções | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
Devoluções | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
Devoluções | |
---|---|
A list of tombstone files, empty if no tombstone. |
Lança | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
Devoluções | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
Devoluções | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
Devoluções | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
Devoluções | |
---|---|
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
Devoluções | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Lança | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
Devoluções | |
---|---|
boolean | true if the device is encrypted. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
deviceFilePath | String |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
Devoluções | |
---|---|
boolean | true if the device supports encryption. |
Lança | |
---|---|
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
Parâmetros | |
---|---|
fullPath | String |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
Devoluções | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
Devoluções | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
Parâmetros | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
Devoluções | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
logBugreport
public abstract boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
Parâmetros | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
Devoluções | |
---|---|
boolean | True if the logging was successful, false otherwise. |
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.
Parâmetros | |
---|---|
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.
Lança | |
---|---|
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)Lança | |
---|---|
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.
Parâmetros | |
---|---|
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.
Parâmetros | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
Lança | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
Parâmetros | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
Devoluções | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
Lança | |
---|---|
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
.
Parâmetros | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
Devoluções | |
---|---|
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) |
Lança | |
---|---|
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
.
Parâmetros | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Devoluções | |
---|---|
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) |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
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. |
Devoluções | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
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 |
Devoluções | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Devoluções | |
---|---|
String | A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Lança | |
---|---|
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
.
Parâmetros | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
Devoluções | |
---|---|
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) |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
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 |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
Devoluções | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lança | |
---|---|
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
Parâmetros | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
Devoluções | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Lança | |
---|---|
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.Lança | |
---|---|
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.
Parâmetros | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Lança | |
---|---|
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.Lança | |
---|---|
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.
Lança | |
---|---|
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 recoveryLança | |
---|---|
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
Parâmetros | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
Lança | |
---|---|
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
Lança | |
---|---|
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.
Lança | |
---|---|
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.
Parâmetros | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Lança | |
---|---|
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.
Lança | |
---|---|
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.
Lança | |
---|---|
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.
Lança | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Lança | |
---|---|
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.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
Devoluções | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
Devoluções | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Lança | |
---|---|
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, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
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.
Parâmetros | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
Devoluções | |
---|---|
boolean |
Lança | |
---|---|
DeviceNotAvailableException |
setDate
public abstract void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
Parâmetros | |
---|---|
date | Date : specify a particular date; will use host date if null |
Lança | |
---|---|
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
Parâmetros | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
Parâmetros | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
Devoluções | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Lança | |
---|---|
DeviceNotAvailableException |
setRecovery
public abstract void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
Parâmetros | |
---|---|
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, etcParâmetros | |
---|---|
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.
Parâmetros | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
See also:
startLogcat
public abstract void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
Devoluções | |
---|---|
String | the tcp serial number or null if device could not be switched |
Lança | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
Devoluções | |
---|---|
boolean | true if switch was successful, false otherwise. |
Lança | |
---|---|
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.Parâmetros | |
---|---|
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 |
Devoluções | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
takeBugreport
public abstract Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue.
Bugreport#close()
.Devoluções | |
---|---|
Bugreport |
unlockDevice
public abstract boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.Devoluções | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
Parâmetros | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
Devoluções | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Lança | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
Devoluções | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Lança | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Lança | |
---|---|
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
).
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
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
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
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
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public abstract void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Lança | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Lança | |
---|---|
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.
Parâmetros | |
---|---|
waitTime | long : the time in ms to wait |
Devoluções | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |