INativeDevice

public interface INativeDevice

com.android.tradefed.device.INativeDevice


Proporciona una API fiable y de un nivel ligeramente superior a un IDevice ddmlib.

Vuelve a intentar los comandos del dispositivo por una cantidad configurable y proporciona una interfaz de recuperación del dispositivo para los dispositivos que no responden.

Resumen

constantes

int UNKNOWN_API_LEVEL

Valor predeterminado cuando no se puede detectar el nivel de API

Métodos públicos

abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Compruebe si una función es compatible actualmente o no dado un nivel mínimo compatible.

abstract void clearLogcat ()

Elimina cualquier dato logcat acumulado.

abstract void deleteFile (String deviceFilePath)

Método auxiliar para eliminar un archivo o directorio en el dispositivo.

abstract boolean deviceSoftRestarted ( ProcessInfo prevSystemServerProcess)

Método de ayuda para verificar si el dispositivo se reinició por software al comparar system_server actual con system_server ProcessInfo anterior.

abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)

Método auxiliar para comprobar si el dispositivo se reinició desde la hora UTC desde la época del dispositivo y su ERROR(/TimeUnit) .

abstract boolean disableAdbRoot ()

Desactiva adb root.

abstract boolean doesFileExist (String deviceFilePath)

Método auxiliar para determinar si existe un archivo en el dispositivo.

abstract boolean enableAdbRoot ()

Activa adb root.

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

Método auxiliar que ejecuta un comando adb como un comando del sistema con un tiempo de espera especificado.

abstract String executeAdbCommand (String... commandArgs)

Método auxiliar que ejecuta un comando adb como un comando del sistema.

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

Método auxiliar que ejecuta un comando adb como un comando del sistema con un tiempo de espera especificado.

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

Método auxiliar que ejecuta un comando fastboot como un comando del sistema.

abstract CommandResult executeFastbootCommand (String... commandArgs)

Método auxiliar que ejecuta un comando fastboot como un comando del sistema con un tiempo de espera predeterminado de 2 minutos.

abstract CommandResult executeLongFastbootCommand (String... commandArgs)

Método auxiliar que ejecuta un comando fastboot de ejecución prolongada como un comando del sistema.

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

Método auxiliar que ejecuta un comando fastboot de ejecución prolongada como un comando del sistema con variables de entorno del sistema.

abstract String executeShellCommand (String command)

Método auxiliar que ejecuta un comando de shell adb y devuelve el resultado como una String .

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

abstract void executeShellCommand (String command, IShellOutputReceiver receiver)

Ejecuta el comando adb shell dado y vuelve a intentarlo varias veces si el comando falla.

abstract CommandResult executeShellV2Command (String command)

Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un CommandResult correctamente poblado con la salida de estado del comando, stdout y stderr.

abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)

Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un CommandResult rellenado correctamente con la salida de estado del comando y stderr.

abstract CommandResult executeShellV2Command (String command, File pipeAsInput)

Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un CommandResult correctamente poblado con la salida de estado del comando, stdout y stderr.

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

abstract CommandResult fastbootWipePartition (String partition)

Método auxiliar que borra una partición del dispositivo.

abstract int getApiLevel ()

Obtenga el nivel de API del dispositivo.

abstract String getBasebandVersion ()

Método conveniente para obtener la versión de banda base (radio) de este dispositivo.

abstract Integer getBattery ()

Devuelve el nivel de batería actual de un dispositivo o Nulo si el nivel de batería no está disponible.

abstract boolean getBooleanProperty (String name, boolean defaultValue)

Devuelve el valor booleano de la propiedad dada.

abstract getBootHistory ()

El método auxiliar recopila el mapa del historial de arranque con el tiempo de arranque y el motivo del arranque.

abstract getBootHistorySince (long utcEpochTime, TimeUnit timeUnit)

El método auxiliar recopila el mapa del historial de arranque con la hora de arranque y el motivo de arranque desde la hora dada desde la época del dispositivo y la unidad de tiempo especificada.

abstract String getBootloaderVersion ()

Método de conveniencia para obtener la versión del gestor de arranque de este dispositivo.

abstract String getBuildAlias ()

Recupere el alias de la compilación que el dispositivo está ejecutando actualmente.

abstract String getBuildFlavor ()

Recupere el tipo de compilación para el dispositivo.

abstract String getBuildId ()

Recupere la compilación que el dispositivo está ejecutando actualmente.

abstract String getBuildSigningKeys ()

Devuelve el tipo de clave utilizada para firmar la imagen del dispositivo.

Por lo general, los dispositivos Android pueden firmarse con claves de prueba (como en AOSP) o claves de liberación (controladas por fabricantes de dispositivos individuales)

abstract DeviceDescriptor getCachedDeviceDescriptor ()

Devuelve un DeviceDescriptor almacenado en caché si el dispositivo está asignado; de lo contrario, devuelve el DeviceDescriptor actual.

abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Devuelve un DeviceDescriptor almacenado en caché si el dispositivo está asignado; de lo contrario, devuelve el DeviceDescriptor actual.

abstract String[] getChildren (String deviceFilePath)

Alternativa al uso IFileEntry que a veces no funciona debido a los permisos.

abstract AbstractConnection getConnection ()

Devuelve la conexión asociada al dispositivo.

abstract String getDeviceClass ()

Obtenga la clase de dispositivo.

abstract long getDeviceDate ()

Devuelve la fecha del dispositivo en milisegundos desde la época.

abstract DeviceDescriptor getDeviceDescriptor ()

Devuelve un DeviceDescriptor de la información del dispositivo para obtener información sobre él sin pasar el objeto del dispositivo real.

abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Devuelve un DeviceDescriptor de la información del dispositivo para obtener información sobre él sin pasar el objeto del dispositivo real.

abstract TestDeviceState getDeviceState ()

Obtener el estado del dispositivo.

abstract long getDeviceTimeOffset (Date date)

Ayudante para obtener la diferencia horaria entre el dispositivo y un ERROR(/Date) dado.

abstract InputStreamSource getEmulatorOutput ()

Obtenga la transmisión del emulador stdout y stderr

abstract long getExternalStoreFreeSpace ()

Método auxiliar para determinar la cantidad de espacio libre en el almacenamiento externo del dispositivo.

abstract String getFastbootProductType ()

Método de conveniencia para obtener el tipo de producto de este dispositivo cuando está en modo fastboot.

abstract String getFastbootProductVariant ()

Método de conveniencia para obtener el tipo de producto de este dispositivo cuando está en modo fastboot.

abstract String getFastbootSerialNumber ()

Devuelve el número de serie del modo fastboot.

abstract String getFastbootVariable (String variableName)

Recupere el valor de la variable fastboot dado del dispositivo.

abstract IFileEntry getFileEntry (String path)

Recupere una referencia a un archivo remoto en el dispositivo.

abstract IDevice getIDevice ()

Devuelve una referencia al IDevice ddmlib asociado.

abstract long getIntProperty (String name, long defaultValue)

Devuelve el valor entero de la propiedad dada del dispositivo.

abstract long getLastExpectedRebootTimeMillis ()

Devuelve la última vez que las API de Tradefed activaron un reinicio en milisegundos desde EPOCH según lo devuelto por System.currentTimeMillis() .

abstract int getLaunchApiLevel ()

Obtenga el primer nivel de API lanzado del dispositivo.

abstract InputStreamSource getLogcat ()

Toma una secuencia instantánea de los datos logcat.

abstract InputStreamSource getLogcat (int maxBytes)

Toma un flujo de instantáneas de los últimos maxBytes de datos de logcat capturados.

abstract InputStreamSource getLogcatDump ()

Obtenga un volcado del logcat actual para el dispositivo.

abstract InputStreamSource getLogcatSince (long date)

Toma un flujo de instantáneas de los datos de logcat capturados a partir de la fecha proporcionada.

abstract String getMountPoint (String mountName)

Devuelve un punto de montaje.

abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

Devuelve un MountPointInfo correspondiente a la ruta del punto de montaje especificado, o null si esa ruta no tiene nada montado o no aparece en /proc/mounts como un punto de montaje.

abstract getMountPointInfo ()

Devuelve una versión analizada de la información en /proc/mounts en el dispositivo

abstract long getPartitionFreeSpace (String partition)

Método auxiliar para determinar la cantidad de espacio libre en la partición del dispositivo.

abstract ProcessInfo getProcessByName (String processName)

El método auxiliar ejecuta el comando "pidof" y "stat" y devuelve el objeto ProcessInfo con el PID y la hora de inicio del proceso dado.

abstract String getProcessPid (String process)

Devuelve el pid del servicio o nulo si algo salió mal.

abstract String getProductType ()

Método de conveniencia para obtener el tipo de producto de este dispositivo.

abstract String getProductVariant ()

Método de conveniencia para obtener la variante de producto de este dispositivo.

abstract String getProperty (String name)

Recuperar el valor de propiedad dado del dispositivo.

abstract ITestDevice.RecoveryMode getRecoveryMode ()

Obtenga el modo de recuperación actual utilizado para el dispositivo.

abstract String getSerialNumber ()

Método de conveniencia para obtener el número de serie de este dispositivo.

abstract getTombstones ()

Obtenga y devuelva la lista de lápidas de los dispositivos.

abstract long getTotalMemory ()

Devuelve el tamaño total de la memoria física en bytes o -1 en caso de error interno

abstract boolean getUseFastbootErase ()

Obtenga información sobre si usar el borrado de inicio rápido o el formato de inicio rápido para borrar una partición en el dispositivo.

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

Compruebe si la plataforma en el dispositivo admite la enumeración de aplicaciones

abstract boolean isBypassLowTargetSdkBlockSupported ()

Verifique si la plataforma en el dispositivo admite la omisión del bloque SDK de destino bajo en las instalaciones de la aplicación

abstract boolean isDeviceEncrypted ()

Devuelve si el dispositivo está encriptado.

abstract boolean isDirectory (String deviceFilePath)

Retorna True si la ruta en el dispositivo es un directorio, false en caso contrario.

abstract boolean isEncryptionSupported ()

Devuelve si el cifrado es compatible con el dispositivo.

abstract boolean isExecutable (String fullPath)

Devuelve True si la ruta del archivo en el dispositivo es un archivo ejecutable; de ​​lo contrario, devuelve false.

abstract boolean isHeadless ()

Devuelve verdadero si el dispositivo no tiene cabeza (sin pantalla), falso en caso contrario.

abstract boolean isRuntimePermissionSupported ()

Compruebe si la plataforma en el dispositivo admite la concesión de permisos de tiempo de ejecución

abstract boolean isStateBootloaderOrFastbootd ()

Devuelve verdadero si el dispositivo está en TestDeviceState#FASTBOOT o TestDeviceState.FASTBOOTD .

abstract boolean logAnrs ( ITestLogger logger)

Recopila y registra ANR del dispositivo.

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

Registre un mensaje en el logcat del dispositivo.

abstract void nonBlockingReboot ()

Emite un comando para reiniciar el dispositivo y regresa al completar el comando y cuando el dispositivo ya no es visible para adb.

abstract void postBootSetup ()

Realice las instrucciones para configurar el dispositivo para probarlo después de cada arranque.

default void postInvocationTearDown ()

Este método está en desuso. Utilice postInvocationTearDown(Throwable) en su lugar.

abstract void postInvocationTearDown (Throwable invocationException)

Pasos adicionales para la limpieza requerida específica del dispositivo que se ejecutará después de que se realice la invocación.

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

Pasos adicionales para la configuración requerida específica del dispositivo que se ejecutará en el dispositivo antes del flujo de invocación.

abstract boolean pullDir (String deviceFilePath, File localDir)

Extraiga recursivamente el contenido del directorio del dispositivo.

abstract File pullFile (String remoteFilePath, int userId)

Recupera un archivo del dispositivo, lo almacena en un ERROR(/File) temporal local y devuelve ese File .

abstract File pullFile (String remoteFilePath)

Recupera un archivo del dispositivo, lo almacena en un ERROR(/File) temporal local y devuelve ese File .

abstract boolean pullFile (String remoteFilePath, File localFile)

Recupera un archivo del dispositivo.

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

Recupera un archivo del dispositivo.

abstract String pullFileContents (String remoteFilePath)

Recupera un archivo del dispositivo y devuelve el contenido.

abstract File pullFileFromExternal (String remoteFilePath)

Un método práctico para recuperar un archivo del almacenamiento externo del dispositivo, almacenarlo en un ERROR(/File) temporal local y devolver una referencia a ese File .

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

Empuje recursivamente los contenidos del directorio al dispositivo mientras excluye algunos directorios que se filtran.

abstract boolean pushDir (File localDir, String deviceFilePath)

Empuje recursivamente los contenidos del directorio al dispositivo.

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

Variante de pushFile(File, String) que opcionalmente puede considerar evaluar la necesidad del proveedor de contenido.

abstract boolean pushFile (File localFile, String deviceFilePath)

Empuje un archivo al dispositivo.

abstract boolean pushString (String contents, String deviceFilePath)

Empuje el archivo creado a partir de una cadena al dispositivo

abstract void reboot ()

Reinicia el dispositivo en modo adb.

abstract void reboot (String reason)

Reinicia el dispositivo en modo adb con reason dada para que persista durante el reinicio.

abstract void rebootIntoBootloader ()

Reinicia el dispositivo en modo cargador de arranque.

abstract void rebootIntoFastbootd ()

Reinicia el dispositivo en modo fastbootd.

abstract void rebootIntoRecovery ()

Reinicia el dispositivo en el modo de recuperación adb.

abstract void rebootIntoSideload (boolean autoReboot)

Reinicia el dispositivo en modo adb sideload (tenga en cuenta que este es un modo especial en recuperación)

Se bloquea hasta que el dispositivo ingresa al modo de carga lateral

abstract void rebootIntoSideload ()

Reinicia el dispositivo en modo adb sideload (tenga en cuenta que este es un modo especial en recuperación)

Se bloquea hasta que el dispositivo ingresa al modo de carga lateral

abstract void rebootUntilOnline ()

Una alternativa a reboot() que solo bloquea hasta que el dispositivo está en línea, es decir, visible para adb.

abstract void rebootUntilOnline (String reason)

Una alternativa a reboot() que solo bloquea hasta que el dispositivo está en línea, es decir, visible para adb.

abstract void rebootUserspace ()

Reinicia solo la parte del espacio de usuario del dispositivo.

abstract void rebootUserspaceUntilOnline ()

Una alternativa a rebootUserspace() ()} que solo bloquea hasta que el dispositivo está en línea, es decir, visible para adb.

abstract void remountSystemReadOnly ()

Haga que la partición del sistema en el dispositivo sea de solo lectura.

abstract void remountSystemWritable ()

Haga que la partición del sistema en el dispositivo sea escribible.

abstract void remountVendorReadOnly ()

Haga que la partición del proveedor en el dispositivo sea de solo lectura.

abstract void remountVendorWritable ()

Haga que la partición del proveedor en el dispositivo sea escribible.

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

Método conveniente para realizar ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) con uno o más oyentes pasados ​​como parámetros.

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

Ejecuta pruebas de instrumentación y proporciona recuperación de dispositivos.

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

Igual que ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) pero ejecuta la prueba para el usuario dado.

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

Igual que ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) pero ejecuta la prueba para un usuario determinado.

abstract void setDate (Date date)

Establece la fecha en el dispositivo

Nota: la configuración de la fecha en el dispositivo requiere root

abstract void setOptions ( TestDeviceOptions options)

Establezca TestDeviceOptions para el dispositivo

abstract boolean setProperty (String propKey, String propValue)

Establece el valor de propiedad dado en el dispositivo.

abstract void setRecovery ( IDeviceRecovery recovery)

Configure IDeviceRecovery para usar con este dispositivo.

abstract void setRecoveryMode ( ITestDevice.RecoveryMode mode)

Establezca el modo de recuperación actual para usar con el dispositivo.

abstract void setUseFastbootErase (boolean useFastbootErase)

Establezca si usar el borrado de inicio rápido o el formato de inicio rápido para borrar una partición en el dispositivo.

abstract void startLogcat ()

Comience a capturar la salida logcat del dispositivo en segundo plano.

abstract void stopEmulatorOutput ()

Cierre y elimine la salida del emulador.

abstract void stopLogcat ()

Deje de capturar la salida de logcat del dispositivo y deseche los datos de logcat guardados actualmente.

abstract String switchToAdbTcp ()

Cambie el dispositivo al modo adb-over-tcp.

abstract boolean switchToAdbUsb ()

Cambie el dispositivo a adb en modo usb.

abstract boolean syncFiles (File localFileDir, String deviceFilePath)

Sincroniza de forma incremental el contenido de un directorio de archivos local con el dispositivo.

abstract boolean unlockDevice ()

Desbloquea el dispositivo si el dispositivo está en un estado cifrado.

abstract boolean waitForBootComplete (long timeOut)

Bloquea hasta que se establece el indicador de inicio completo del dispositivo.

abstract boolean waitForDeviceAvailable ()

Espera a que el dispositivo responda y esté disponible para la prueba.

abstract boolean waitForDeviceAvailable (long waitTime)

Espera a que el dispositivo responda y esté disponible para la prueba.

abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

Espera a que el dispositivo responda y esté disponible sin considerar la ruta de recuperación.

abstract void waitForDeviceBootloader ()

Bloquea hasta que el dispositivo sea visible a través de fastboot.

abstract boolean waitForDeviceInRecovery (long waitTime)

Bloquea para que el dispositivo esté en el estado de 'recuperación de adb' (tenga en cuenta que esto es distinto de IDeviceRecovery ).

abstract boolean waitForDeviceInSideload (long waitTime)

Bloqueos para que el dispositivo esté en el estado 'adb sideload'

abstract boolean waitForDeviceNotAvailable (long waitTime)

Bloques para que el dispositivo no esté disponible, es decir, falta en adb

abstract void waitForDeviceOnline ()

Bloquea hasta que el dispositivo sea visible a través de adb.

abstract void waitForDeviceOnline (long waitTime)

Bloquea hasta que el dispositivo sea visible a través de adb.

abstract boolean waitForDeviceShell (long waitTime)

Espera a que el dispositivo responda a un comando básico de adb shell.

constantes

NIVEL_API_DESCONOCIDO

public static final int UNKNOWN_API_LEVEL

Valor predeterminado cuando no se puede detectar el nivel de API

Valor constante: -1 (0xffffffff)

Métodos públicos

comprobarApiLevelAgainstNextRelease

public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Compruebe si una función es compatible actualmente o no dado un nivel mínimo compatible. Este método tiene en cuenta funciones inéditas aún, antes de que se eleve el nivel de la API.

Parámetros
strictMinLevel int : el nivel posible mínimo estricto que admite la característica.

Devoluciones
boolean True si el nivel es compatible. Falso en caso contrario.

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

borrarLogcat

public abstract void clearLogcat ()

Elimina cualquier dato logcat acumulado.

Esto es útil para los casos en los que desea asegurarse de que ITestDevice#getLogcat() solo devuelva los datos de registro producidos después de cierto punto (como después de actualizar una nueva versión del dispositivo, etc.).

borrar archivo

public abstract void deleteFile (String deviceFilePath)

Método auxiliar para eliminar un archivo o directorio en el dispositivo.

Parámetros
deviceFilePath String : la ruta absoluta del archivo en el dispositivo.

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

dispositivoSoftRestarted

public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

Método de ayuda para verificar si el dispositivo se reinició por software al comparar system_server actual con system_server ProcessInfo anterior. Use getProcessByName(String) para obtener ProcessInfo .

Parámetros
prevSystemServerProcess ProcessInfo : el proceso system_server anterior ProcessInfo .

Devoluciones
boolean true si el dispositivo se reinicia suavemente

Lanza
RuntimeException si el dispositivo tiene un motivo de arranque anormal
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

dispositivoSoftRestartedDesde

public abstract boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

Método auxiliar para comprobar si el dispositivo se reinició desde la hora UTC desde la época del dispositivo y su ERROR(/TimeUnit) . Soft-Restart se refiere a system_server reiniciado fuera de un reinicio completo del dispositivo (por ejemplo: reinicio solicitado). El dispositivo actual utcEpochTime en Milliseccond se puede obtener mediante el método getDeviceDate() .

Parámetros
utcEpochTime long : el tiempo del dispositivo en segundos desde la época.

timeUnit TimeUnit : la unidad de tiempo TimeUnit para el utcEpochTime dado.

Devoluciones
boolean true si el dispositivo se reinicia suavemente

Lanza
RuntimeException si el dispositivo tiene un motivo de arranque anormal
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

deshabilitarAdbRoot

public abstract boolean disableAdbRoot ()

Desactiva adb root.

Deshabilitar adb root puede hacer que el dispositivo se desconecte de adb. Este método se bloqueará hasta que el dispositivo esté disponible.

Devoluciones
boolean true si tiene éxito.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

existe el archivo

public abstract boolean doesFileExist (String deviceFilePath)

Método auxiliar para determinar si existe un archivo en el dispositivo.

Parámetros
deviceFilePath String : la ruta absoluta del archivo en el dispositivo para verificar

Devoluciones
boolean true si el archivo existe, false en caso contrario.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

habilitarAdbRoot

public abstract boolean enableAdbRoot ()

Activa adb root. Si la configuración "habilitar raíz" es "falsa", registrará un mensaje y regresará sin habilitar la raíz.

Habilitar adb root puede hacer que el dispositivo se desconecte de adb. Este método se bloqueará hasta que el dispositivo esté disponible.

Devoluciones
boolean true si tiene éxito.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarAdbCommand

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

Método auxiliar que ejecuta un comando adb como un comando del sistema con un tiempo de espera especificado.

En su lugar, se debe usar executeShellCommand(String) siempre que sea posible, ya que ese método proporciona una mejor detección de fallas y rendimiento.

Parámetros
timeout long : el tiempo en milisegundos antes de que el dispositivo se considere que no responde, 0L para ningún tiempo de espera

commandArgs String : el comando adb y los argumentos para ejecutar

Devoluciones
String la salida estándar del comando. null si el comando no se pudo ejecutar.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarAdbCommand

public abstract String executeAdbCommand (String... commandArgs)

Método auxiliar que ejecuta un comando adb como un comando del sistema.

En su lugar, se debe usar executeShellCommand(String) siempre que sea posible, ya que ese método proporciona una mejor detección de fallas y rendimiento.

Parámetros
commandArgs String : el comando adb y los argumentos para ejecutar

Devoluciones
String la salida estándar del comando. null si el comando no se pudo ejecutar.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarAdbCommand

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

Método auxiliar que ejecuta un comando adb como un comando del sistema con un tiempo de espera especificado.

En su lugar, se debe usar executeShellCommand(String) siempre que sea posible, ya que ese método proporciona una mejor detección de fallas y rendimiento.

Parámetros
timeout long : el tiempo en milisegundos antes de que el dispositivo se considere que no responde, 0L para ningún tiempo de espera

envMap : entorno a configurar para el comando

commandArgs String : el comando adb y los argumentos para ejecutar

Devoluciones
String la salida estándar del comando. null si el comando no se pudo ejecutar.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarFastbootCommand

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

Método auxiliar que ejecuta un comando fastboot como un comando del sistema.

Se espera que se use cuando el dispositivo ya está en modo fastboot.

Parámetros
timeout long : el tiempo en milisegundos antes de que caduque el comando

commandArgs String : el comando fastboot y los argumentos para ejecutar

Devoluciones
CommandResult el CommandResult que contiene la salida del comando

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarFastbootCommand

public abstract CommandResult executeFastbootCommand (String... commandArgs)

Método auxiliar que ejecuta un comando fastboot como un comando del sistema con un tiempo de espera predeterminado de 2 minutos.

Se espera que se use cuando el dispositivo ya está en modo fastboot.

Parámetros
commandArgs String : el comando fastboot y los argumentos para ejecutar

Devoluciones
CommandResult el CommandResult que contiene la salida del comando

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarLongFastbootCommand

public abstract CommandResult executeLongFastbootCommand (String... commandArgs)

Método auxiliar que ejecuta un comando fastboot de ejecución prolongada como un comando del sistema.

Idéntico a executeFastbootCommand(String) excepto que usa un tiempo de espera más largo.

Parámetros
commandArgs String : el comando fastboot y los argumentos para ejecutar

Devoluciones
CommandResult el CommandResult que contiene la salida del comando

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarLongFastbootCommand

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

Método auxiliar que ejecuta un comando fastboot de ejecución prolongada como un comando del sistema con variables de entorno del sistema.

Idéntico a executeFastbootCommand(String) excepto que usa un tiempo de espera más largo.

Parámetros
envVarMap : las variables de entorno del sistema con las que se ejecuta el comando fastboot

commandArgs String : el comando fastboot y los argumentos para ejecutar

Devoluciones
CommandResult el CommandResult que contiene la salida del comando

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellCommand

public abstract String executeShellCommand (String command)

Método auxiliar que ejecuta un comando de shell adb y devuelve el resultado como una String .

Parámetros
command String : el comando adb shell para ejecutar

Devoluciones
String la salida de la cáscara

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellCommand

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

Parámetros
command String : el comando adb shell para ejecutar

receiver IShellOutputReceiver : el IShellOutputReceiver al que se dirige la salida del shell.

maxTimeToOutputShellResponse long : la cantidad máxima de tiempo durante el cual se permite que el comando no emita ninguna respuesta; unidad como se especifica en timeUnit

timeUnit TimeUnit : unidad para maxTimeToOutputShellResponse

retryAttempts int : el número máximo de veces para reintentar el comando si falla debido a una excepción. Se lanzará DeviceNotResponsiveException si se realizan retryAttempts sin éxito.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellCommand

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

Parámetros
command String : el comando adb shell para ejecutar

receiver IShellOutputReceiver : el IShellOutputReceiver al que se dirige la salida del shell.

maxTimeoutForCommand long : el tiempo de espera máximo para que se complete el comando; unidad como se especifica en timeUnit

maxTimeToOutputShellResponse long : la cantidad máxima de tiempo durante el cual se permite que el comando no emita ninguna respuesta; unidad como se especifica en timeUnit

timeUnit TimeUnit : unidad para maxTimeToOutputShellResponse

retryAttempts int : el número máximo de veces para reintentar el comando si falla debido a una excepción. Se lanzará DeviceNotResponsiveException si se realizan retryAttempts sin éxito.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellCommand

public abstract void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

Ejecuta el comando adb shell dado y vuelve a intentarlo varias veces si el comando falla.

Una forma más simple de executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int) con valores predeterminados.

Parámetros
command String : el comando adb shell para ejecutar

receiver IShellOutputReceiver : el IShellOutputReceiver al que se dirige la salida del shell.

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

public abstract CommandResult executeShellV2Command (String command)

Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un CommandResult correctamente poblado con la salida de estado del comando, stdout y stderr.

Parámetros
command String : El comando que debe ejecutarse.

Devoluciones
CommandResult El resultado en CommandResult .

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

public abstract CommandResult executeShellV2Command (String command, 
                OutputStream pipeToOutput)

Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un CommandResult rellenado correctamente con la salida de estado del comando y stderr. stdout se dirige a la secuencia especificada.

Parámetros
command String : El comando que debe ejecutarse.

pipeToOutput OutputStream : ERROR(/OutputStream) donde la salida estándar será redirigida o nula.

Devoluciones
CommandResult El resultado en CommandResult .

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

public abstract CommandResult executeShellV2Command (String command, 
                File pipeAsInput)

Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un CommandResult correctamente poblado con la salida de estado del comando, stdout y stderr.

Parámetros
command String : El comando que debe ejecutarse.

pipeAsInput File : un ERROR(/File) que se canalizará como entrada al comando, o nulo.

Devoluciones
CommandResult El resultado en CommandResult .

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

Parámetros
command String : el comando adb shell para ejecutar

maxTimeoutForCommand long : el tiempo de espera máximo para que se complete el comando; unidad como se especifica en timeUnit

timeUnit TimeUnit : unidad para maxTimeToOutputShellResponse

retryAttempts int : el número máximo de veces para reintentar el comando si falla debido a una excepción. Se lanzará DeviceNotResponsiveException si se realizan retryAttempts sin éxito.

Devoluciones
CommandResult

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

Parámetros
command String : el comando adb shell para ejecutar

maxTimeoutForCommand long : el tiempo de espera máximo para que se complete el comando; unidad como se especifica en timeUnit

timeUnit TimeUnit : unidad para maxTimeToOutputShellResponse

Devoluciones
CommandResult

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

Parámetros
command String : el comando adb shell para ejecutar

pipeAsInput File : un ERROR(/File) que se canalizará como entrada al comando, o nulo.

pipeToOutput OutputStream : ERROR(/OutputStream) donde la salida estándar será redirigida o nula.

maxTimeoutForCommand long : el tiempo de espera máximo para que se complete el comando; unidad como se especifica en timeUnit

timeUnit TimeUnit : unidad para maxTimeToOutputShellResponse

retryAttempts int : el número máximo de veces para reintentar el comando si falla debido a una excepción. Se lanzará DeviceNotResponsiveException si se realizan retryAttempts sin éxito.

Devoluciones
CommandResult

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

ejecutarShellV2Command

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

Ejecuta un comando de shell adb, con más parámetros para controlar el comportamiento del comando.

Parámetros
command String : el comando adb shell para ejecutar

pipeAsInput File : un ERROR(/File) que se canalizará como entrada al comando, o nulo.

pipeToOutput OutputStream : ERROR(/OutputStream) donde la salida estándar será redirigida o nula.

pipeToError OutputStream : ERROR(/OutputStream) donde el error estándar será redirigido o nulo.

maxTimeoutForCommand long : el tiempo de espera máximo para que se complete el comando; unidad como se especifica en timeUnit

timeUnit TimeUnit : unidad para maxTimeToOutputShellResponse

retryAttempts int : el número máximo de veces para reintentar el comando si falla debido a una excepción. Se lanzará DeviceNotResponsiveException si se realizan retryAttempts sin éxito.

Devoluciones
CommandResult

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

fastbootWipePartition

public abstract CommandResult fastbootWipePartition (String partition)

Método auxiliar que borra una partición del dispositivo.

Si getUseFastbootErase() es true , se usará fastboot erase para borrar la partición. El dispositivo debe crear un sistema de archivos la próxima vez que arranque. De lo contrario, se usa el formato fastboot que creará un nuevo sistema de archivos en el dispositivo.

Se espera que se use cuando el dispositivo ya está en modo fastboot.

Parámetros
partition String : la partición para borrar

Devoluciones
CommandResult el CommandResult que contiene la salida del comando

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

obtenerApiLevel

public abstract int getApiLevel ()

Obtenga el nivel de API del dispositivo. El valor predeterminado es UNKNOWN_API_LEVEL .

Devoluciones
int un número entero que indica el nivel de API del dispositivo

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBasebandVersion

public abstract String getBasebandVersion ()

Método conveniente para obtener la versión de banda base (radio) de este dispositivo. Obtener la versión de radio es específico del dispositivo, por lo que es posible que no devuelva la información correcta para todos los dispositivos. Este método se basa en la propiedad gsm.version.baseband para devolver la información de versión correcta. Esto no es exacto para algunos dispositivos CDMA y la versión devuelta aquí podría no coincidir con la versión informada por fastboot y podría no devolver la versión para la radio CDMA. TL; DR, este método solo informa la versión precisa si la propiedad gsm.version.baseband es la misma que la versión devuelta por fastboot getvar version-baseband .

Devoluciones
String la versión de banda base String o null si no se puede determinar (el dispositivo no tiene radio o la cadena de versión no se puede leer)

Lanza
DeviceNotAvailableException si la conexión con el dispositivo se pierde y no se puede recuperar.

obtenerBatería

public abstract Integer getBattery ()

Devuelve el nivel de batería actual de un dispositivo o Nulo si el nivel de batería no está disponible.

Devoluciones
Integer

getBooleanProperty

public abstract boolean getBooleanProperty (String name, 
                boolean defaultValue)

Devuelve el valor booleano de la propiedad dada.

Parámetros
name String : el nombre de la propiedad

defaultValue boolean : valor predeterminado para devolver si la propiedad está vacía o no existe.

Devoluciones
boolean true si la propiedad tiene el valor "1" , "y" , "yes" , "on" o "true" , false si la propiedad tiene el valor "0" , "n" , "no" , "off" , "false" o defaultValue de lo contrario.

Lanza
DeviceNotAvailableException

getBootHistory

public abstract  getBootHistory ()

El método auxiliar recopila el mapa del historial de arranque con el tiempo de arranque y el motivo del arranque.

Devoluciones
Mapa del tiempo de arranque (hora UTC en segundos desde Epoch) y motivo de arranque

Lanza
DeviceNotAvailableException

getBootHistorySince

public abstract  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

El método auxiliar recopila el mapa del historial de arranque con la hora de arranque y el motivo de arranque desde la hora dada desde la época del dispositivo y la unidad de tiempo especificada. El dispositivo actual utcEpochTime en milisegundos se puede obtener mediante el método getDeviceDate() .

Parámetros
utcEpochTime long : el tiempo del dispositivo desde Epoch.

timeUnit TimeUnit : la unidad de tiempo TimeUnit .

Devoluciones
Mapa del tiempo de arranque (hora UTC en segundos desde Epoch) y motivo de arranque

Lanza
DeviceNotAvailableException

getBootloaderVersion

public abstract String getBootloaderVersion ()

Método de conveniencia para obtener la versión del gestor de arranque de este dispositivo.

Intentará recuperar la versión del gestor de arranque desde el estado actual del dispositivo. (es decir, si el dispositivo está en modo fastboot, intentará recuperar la versión de fastboot)

Devoluciones
String la versión del cargador de arranque String o null si no se puede encontrar

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

getBuildAlias

public abstract String getBuildAlias ()

Recupere el alias de la compilación que el dispositivo está ejecutando actualmente.

El alias de compilación suele ser una cadena más legible que el ID de compilación (generalmente, un número para las compilaciones de Nexus). Por ejemplo, la versión final de Android 4.2 tiene el alias de compilación JDQ39 y el ID de compilación 573038.

Devoluciones
String el alias de compilación o recurra a la identificación de compilación si no se pudo recuperar

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildFlavor

public abstract String getBuildFlavor ()

Recupere el tipo de compilación para el dispositivo.

Devoluciones
String el tipo de compilación o nulo si no se pudo recuperar

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildId

public abstract String getBuildId ()

Recupere la compilación que el dispositivo está ejecutando actualmente.

Devoluciones
String el ID de compilación o IBuildInfo#UNKNOWN_BUILD_ID si no se pudo recuperar

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getBuildSigningKeys

public abstract String getBuildSigningKeys ()

Devuelve el tipo de clave utilizada para firmar la imagen del dispositivo.

Por lo general, los dispositivos Android pueden firmarse con claves de prueba (como en AOSP) o claves de liberación (controladas por fabricantes de dispositivos individuales)

Devoluciones
String La clave de firma si se encuentra, nulo de lo contrario.

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getCachedDeviceDescriptor

public abstract DeviceDescriptor getCachedDeviceDescriptor ()

Devuelve un DeviceDescriptor almacenado en caché si el dispositivo está asignado; de lo contrario, devuelve el DeviceDescriptor actual.

Devoluciones
DeviceDescriptor

getCachedDeviceDescriptor

public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Devuelve un DeviceDescriptor almacenado en caché si el dispositivo está asignado; de lo contrario, devuelve el DeviceDescriptor actual.

Parámetros
shortDescriptor boolean : si limitar o no el descriptor a la información mínima

Devoluciones
DeviceDescriptor

obtenerniños

public abstract String[] getChildren (String deviceFilePath)

Alternativa al uso IFileEntry que a veces no funciona debido a los permisos.

Parámetros
deviceFilePath String : es la ruta en el dispositivo donde hacer la búsqueda

Devoluciones
String[] Matriz de cadena que contiene todo el archivo en una ruta en el dispositivo.

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

obtenerConexión

public abstract AbstractConnection getConnection ()

Devuelve la conexión asociada al dispositivo.

Devoluciones
AbstractConnection

getDeviceClass

public abstract String getDeviceClass ()

Obtenga la clase de dispositivo.

Devoluciones
String la clase de dispositivo String .

getDeviceDate

public abstract long getDeviceDate ()

Devuelve la fecha del dispositivo en milisegundos desde la época.

Devoluciones
long la fecha del dispositivo en formato de época.

Lanza
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getDeviceDescriptor

public abstract DeviceDescriptor getDeviceDescriptor ()

Devuelve un DeviceDescriptor de la información del dispositivo para obtener información sobre él sin pasar el objeto del dispositivo real.

Devoluciones
DeviceDescriptor

getDeviceDescriptor

public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Devuelve un DeviceDescriptor de la información del dispositivo para obtener información sobre él sin pasar el objeto del dispositivo real.

Parámetros
shortDescriptor boolean : si limitar o no el descriptor a la información mínima

Devoluciones
DeviceDescriptor

getDeviceState

public abstract TestDeviceState getDeviceState ()

Obtener el estado del dispositivo.

Devoluciones
TestDeviceState

getDeviceTimeOffset

public abstract long getDeviceTimeOffset (Date date)

Ayudante para obtener la diferencia horaria entre el dispositivo y un ERROR(/Date) dado. Utilice el tiempo de Epoch internamente.

Parámetros
date Date

Devoluciones
long la diferencia en milisegundos

Lanza
DeviceNotAvailableException

getEmulatorOutput

public abstract InputStreamSource getEmulatorOutput ()

Obtenga la transmisión del emulador stdout y stderr

Devoluciones
InputStreamSource salida del emulador

getExternalStoreFreeSpace

public abstract long getExternalStoreFreeSpace ()

Método auxiliar para determinar la cantidad de espacio libre en el almacenamiento externo del dispositivo.

Devoluciones
long la cantidad de espacio libre en KB

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

getFastbootProductType

public abstract String getFastbootProductType ()

Método de conveniencia para obtener el tipo de producto de este dispositivo cuando está en modo fastboot.

Este método solo debe usarse si el dispositivo debe estar en fastboot. Es una variante un poco más segura que el método genérico getProductType() en este caso, porque ITestDevice sabrá recuperar el dispositivo en fastboot si el dispositivo está en un estado incorrecto o no responde.

Devoluciones
String el nombre del tipo de producto String o null si no se puede determinar

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

getFastbootProductVariant

public abstract String getFastbootProductVariant ()

Método de conveniencia para obtener el tipo de producto de este dispositivo cuando está en modo fastboot.

Este método solo debe usarse si el dispositivo debe estar en fastboot. Es una variante un poco más segura que el método genérico getProductType() en este caso, porque ITestDevice sabrá recuperar el dispositivo en fastboot si el dispositivo está en un estado incorrecto o no responde.

Devoluciones
String el nombre del tipo de producto String o null si no se puede determinar

Lanza
DeviceNotAvailableException si se pierde la conexión con el dispositivo y no se puede recuperar.

getFastbootSerialNumber

public abstract String getFastbootSerialNumber ()

Devuelve el número de serie del modo fastboot.

Devoluciones
String

getFastbootVariable

public abstract String getFastbootVariable (String variableName)

Recupere el valor de la variable fastboot dado del dispositivo.

Parámetros
variableName String : el nombre de la variable

Devoluciones
String el valor de la propiedad o null si no existe

Lanza
UnsupportedOperationException
DeviceNotAvailableException

getFileEntry

public abstract IFileEntry getFileEntry (String path)

Retrieve a reference to a remote file on device.

Parameters
path String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported)

Returns
IFileEntry the IFileEntry or null if file at given path cannot be found

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getIDevice

public abstract IDevice getIDevice ()

Returns a reference to the associated ddmlib IDevice .

A new 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.

Returns
IDevice the IDevice

getIntProperty

public abstract long getIntProperty (String name, 
                long defaultValue)

Returns integer value of the given property from the device.

Parameters
name String : the property name

defaultValue long : default value to return if property is empty or doesn't exist.

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

Throws
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public abstract long getLastExpectedRebootTimeMillis ()

Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis() .

Returns
long

getLaunchApiLevel

public abstract int getLaunchApiLevel ()

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

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

Throws
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException

getLogcat

public abstract InputStreamSource getLogcat ()

Grabs a snapshot stream of the logcat data.

Works in two modes:

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

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

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

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

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

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

    Returns
    InputStreamSource

    getMountPoint

    public abstract String getMountPoint (String mountName)

    Returns a mount point.

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

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

    Parameters
    mountName String : the name of the mount point

    Returns
    String the mount point or null

    getMountPointInfo

    public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    Returns a MountPointInfo corresponding to the specified mountpoint path, or null if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.

    Parameters
    mountpoint String

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

    Throws
    DeviceNotAvailableException

    getMountPointInfo

    public abstract  getMountPointInfo ()

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

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

    Throws
    DeviceNotAvailableException

    getPartitionFreeSpace

    public abstract long getPartitionFreeSpace (String partition)

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

    Parameters
    partition String

    Returns
    long the amount of free space in KB

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

    getProcessByName

    public abstract ProcessInfo getProcessByName (String processName)

    Helper method runs the "pidof" and "stat" command and returns ProcessInfo object with PID and process start time of the given process.

    Parameters
    processName String : the proces name String.

    Returns
    ProcessInfo ProcessInfo of given processName

    Throws
    DeviceNotAvailableException

    getProcessPid

    public abstract String getProcessPid (String process)

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

    Parameters
    process String : The proces name String.

    Returns
    String

    Throws
    DeviceNotAvailableException

    getProductType

    public abstract String getProductType ()

    Convenience method to get the product type of this device.

    This method will work if device is in either adb or fastboot mode.

    Returns
    String the String product type name. Will not be null

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered, or if product type can not be determined

    getProductVariant

    public abstract String getProductVariant ()

    Convenience method to get the product variant of this device.

    This method will work if device is in either adb or fastboot mode.

    Returns
    String the String product variant name or null if it cannot be determined

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

    getProperty

    public abstract String getProperty (String name)

    Retrieve the given property value from the device.

    Parameters
    name String : the property name

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    getRecoveryMode

    public abstract ITestDevice.RecoveryMode getRecoveryMode ()

    Get the current recovery mode used for the device.

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

    getSerialNumber

    public abstract String getSerialNumber ()

    Convenience method to get serial number of this device.

    Returns
    String the String serial number

    getTombstones

    public abstract  getTombstones ()

    Fetch and return the list of tombstones from the devices. Requires root.

    method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException will terminate the method early.

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

    Throws
    DeviceNotAvailableException

    getTotalMemory

    public abstract long getTotalMemory ()

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

    Returns
    long

    getUseFastbootErase

    public abstract boolean getUseFastbootErase ()

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

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

    isAdbRoot

    public abstract boolean isAdbRoot ()

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

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

    isAdbTcp

    public abstract boolean isAdbTcp ()

    Returns
    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

    Returns
    boolean True if app enumeration is supported, false otherwise

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isBypassLowTargetSdkBlockSupported

    public abstract boolean isBypassLowTargetSdkBlockSupported ()

    Check whether platform on device supports bypassing low target sdk block on app installs

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isDeviceEncrypted

    public abstract boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    Returns
    boolean true if the device is encrypted.

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

    isDirectory

    public abstract boolean isDirectory (String deviceFilePath)

    Return True if the path on the device is a directory, false otherwise.

    Parameters
    deviceFilePath String

    Returns
    boolean

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isEncryptionSupported

    public abstract boolean isEncryptionSupported ()

    Returns if encryption is supported on the device.

    Returns
    boolean true if the device supports encryption.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isExecutable

    public abstract boolean isExecutable (String fullPath)

    Returns True if the file path on the device is an executable file, false otherwise.

    Parameters
    fullPath String

    Returns
    boolean

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isHeadless

    public abstract boolean isHeadless ()

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

    Returns
    boolean

    Throws
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public abstract boolean isRuntimePermissionSupported ()

    Check whether platform on device supports runtime permission granting

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    isStateBootloaderOrFastbootd

    public abstract boolean isStateBootloaderOrFastbootd ()

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

    Returns
    boolean

    logAnrs

    public abstract boolean logAnrs (ITestLogger logger)

    Collects and log ANRs from the device.

    Parameters
    logger ITestLogger : an ITestLogger to log the ANRs.

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

    Throws
    DeviceNotAvailableException

    logOnDevice

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

    Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.

    Parameters
    tag String : The tag under which we log our message in the logcat.

    level Log.LogLevel : The debug level of the message in the logcat.

    format String : The message format.

    args Object : the args to be replaced via String.format().

    nonBlockingReboot

    public abstract void nonBlockingReboot ()

    Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    postBootSetup

    public abstract void postBootSetup ()

    Perform instructions to configure device for testing that after every boot.

    Should be called after device is fully booted/available

    In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot.

    Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)

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

    postInvocationTearDown

    public void postInvocationTearDown ()

    This method is deprecated.
    Use postInvocationTearDown(Throwable) instead.

    Extra steps for device specific required clean up that will be executed after the invocation is done.

    postInvocationTearDown

    public abstract void postInvocationTearDown (Throwable invocationException)

    Extra steps for device specific required clean up that will be executed after the invocation is done.

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

    Parameters
    info IBuildInfo : The IBuildInfo of the device.

    attributes MultiMap : The attributes stored in the invocation context

    Throws
    com.android.tradefed.targetprep.TargetSetupError
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException
    TargetSetupError

    pullDir

    public abstract boolean pullDir (String deviceFilePath, 
                    File localDir)

    Recursively pull directory contents from device.

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

    localDir File : the local directory to pull files into

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

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

    pullFile

    public abstract File pullFile (String remoteFilePath, 
                    int userId)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

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

    userId int : The user id to pull from

    Returns
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

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

    pullFile

    public abstract File pullFile (String remoteFilePath)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

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

    Returns
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

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

    pullFile

    public abstract boolean pullFile (String remoteFilePath, 
                    File localFile)

    Retrieves a file off device.

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

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

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

    pullFile

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

    Retrieves a file off device.

    Parameters
    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

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

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

    pullFileContents

    public abstract String pullFileContents (String remoteFilePath)

    Retrieves a file off device, and returns the contents.

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

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

    Throws
    DeviceNotAvailableException

    pullFileFromExternal

    public abstract File pullFileFromExternal (String remoteFilePath)

    A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File) , and return a reference to that File .

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

    Returns
    File A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem)

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

    pushDir

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

    Recursively push directory contents to device while excluding some directories that are filtered.

    Parameters
    localDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

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

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

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

    pushDir

    public abstract boolean pushDir (File localDir, 
                    String deviceFilePath)

    Recursively push directory contents to device.

    Parameters
    localDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

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

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

    pushFile

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

    Variant of pushFile(File, String) which can optionally consider evaluating the need for the content provider.

    Parameters
    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

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

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

    pushFile

    public abstract boolean pushFile (File localFile, 
                    String deviceFilePath)

    Push a file to device. By default using a content provider.

    Parameters
    localFile File : the local file to push

    deviceFilePath String : the remote destination absolute file path

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

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

    pushString

    public abstract boolean pushString (String contents, 
                    String deviceFilePath)

    Push file created from a string to device

    Parameters
    contents String : the contents of the file to push

    deviceFilePath String : the remote destination absolute file path

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

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

    reboot

    public abstract void reboot ()

    Reboots the device into adb mode.

    Blocks until device becomes available.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    reboot

    public abstract void reboot (String reason)

    Reboots the device into adb mode with given reason to be persisted across reboot.

    Blocks until device becomes available.

    Last reboot reason can be obtained by querying sys.boot.reason propety.

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

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootIntoBootloader

    public abstract void rebootIntoBootloader ()

    Reboots the device into bootloader mode.

    Blocks until device is in bootloader mode.

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

    rebootIntoFastbootd

    public abstract void rebootIntoFastbootd ()

    Reboots the device into fastbootd mode.

    Blocks until device is in fastbootd mode.

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

    rebootIntoRecovery

    public abstract void rebootIntoRecovery ()

    Reboots the device into adb recovery mode.

    Blocks until device enters recovery

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootIntoSideload

    public abstract void rebootIntoSideload (boolean autoReboot)

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

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

    Throws
    DeviceNotAvailableException if device is not in sideload after reboot

    rebootIntoSideload

    public abstract void rebootIntoSideload ()

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    Throws
    DeviceNotAvailableException if device is not in sideload after reboot

    rebootUntilOnline

    public abstract void rebootUntilOnline ()

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootUntilOnline

    public abstract void rebootUntilOnline (String reason)

    An alternate to reboot() that only blocks until device is online ie visible to adb.

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

    Throws
    DeviceNotAvailableException if device is not available after reboot

    See also:

    rebootUserspace

    public abstract void rebootUserspace ()

    Reboots only userspace part of device.

    Blocks until device becomes available.

    WARNING. Userspace reboot is currently under active development, use it on your own risk.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    rebootUserspaceUntilOnline

    public abstract void rebootUserspaceUntilOnline ()

    An alternate to rebootUserspace() ()} that only blocks until device is online ie visible to adb.

    Throws
    DeviceNotAvailableException if device is not available after reboot

    remountSystemReadOnly

    public abstract void remountSystemReadOnly ()

    Make the system partition on the device read-only. May reboot the device.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountSystemWritable

    public abstract void remountSystemWritable ()

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountVendorReadOnly

    public abstract void remountVendorReadOnly ()

    Make the vendor partition on the device read-only. May reboot the device.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    remountVendorWritable

    public abstract void remountVendorWritable ()

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    runInstrumentationTests

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

    Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) with one or more listeners passed as parameters.

    Parameters
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners ITestLifeCycleReceiver : the test result listener(s)

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

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed.

    runInstrumentationTests

    public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    Runs instrumentation tests, and provides device recovery.

    If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.

    If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.

    Parameters
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners : the test result listeners

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

    Throws
    DeviceNotAvailableException if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed.

    runInstrumentationTestsAsUser

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

    Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) but runs the test for the given user.

    Parameters
    runner IRemoteAndroidTestRunner

    userId int

    listeners

    Returns
    boolean

    Throws
    DeviceNotAvailableException

    runInstrumentationTestsAsUser

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

    Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) but runs the test for a given user.

    Parameters
    runner IRemoteAndroidTestRunner

    userId int

    listeners ITestLifeCycleReceiver

    Returns
    boolean

    Throws
    DeviceNotAvailableException

    setDate

    public abstract void setDate (Date date)

    Sets the date on device

    Note: setting date on device requires root

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    setOptions

    public abstract void setOptions (TestDeviceOptions options)

    Set the TestDeviceOptions for the device

    Parameters
    options TestDeviceOptions

    setProperty

    public abstract boolean setProperty (String propKey, 
                    String propValue)

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

    Parameters
    propKey String : The key targeted to be set.

    propValue String : The property value to be set.

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    setRecovery

    public abstract void setRecovery (IDeviceRecovery recovery)

    Set the IDeviceRecovery to use for this device. Should be set when device is first allocated.

    Parameters
    recovery IDeviceRecovery : the IDeviceRecovery

    setRecoveryMode

    public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)

    Set the current recovery mode to use for the device.

    Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc

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

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

    startLogcat

    public abstract void startLogcat ()

    Start capturing logcat output from device in the background.

    Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat.

    When the device is no longer in use, stopLogcat() must be called.

    startLogcat() and stopLogcat() do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.

    stopEmulatorOutput

    public abstract void stopEmulatorOutput ()

    Close and delete the emulator output.

    stopLogcat

    public abstract void stopLogcat ()

    Stop capturing logcat output from device, and discard currently saved logcat data.

    Will have no effect if logcat output is not being captured.

    switchToAdbTcp

    public abstract String switchToAdbTcp ()

    Switch device to adb-over-tcp mode.

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    switchToAdbUsb

    public abstract boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    Returns
    boolean true if switch was successful, false otherwise.

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    syncFiles

    public abstract boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    Incrementally syncs the contents of a local file directory to device.

    Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date.

    Hidden files (with names starting with ".") will be ignored.

    Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.

    Parameters
    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

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

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

    unlockDevice

    public abstract boolean unlockDevice ()

    Unlocks the device if the device is in an encrypted state.

    This method may restart the framework but will not call postBootSetup() . Therefore, the device might not be fully ready to be tested when this method returns.

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

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

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

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

    Throws
    com.android.tradefed.device.DeviceNotAvailableException
    DeviceNotAvailableException

    waitForDeviceAvailable

    public abstract boolean waitForDeviceAvailable ()

    Waits for the device to be responsive and available for testing. Uses default timeout.

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

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

    waitForDeviceAvailable

    public abstract boolean waitForDeviceAvailable (long waitTime)

    Waits for the device to be responsive and available for testing.

    Parameters
    waitTime long : the time in ms to wait

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

    Throws
    DeviceNotAvailableException if device is still unresponsive after waitTime expires.

    waitForDeviceAvailableInRecoverPath

    public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)

    Waits for the device to be responsive and available without considering recovery path.

    Parameters
    waitTime long

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

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

    waitForDeviceBootloader

    public abstract void waitForDeviceBootloader ()

    Blocks until device is visible via fastboot. Use default timeout.

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

    waitForDeviceInRecovery

    public abstract boolean waitForDeviceInRecovery (long waitTime)

    Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery ).

    Parameters
    waitTime long : the time in ms to wait

    Returns
    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

    Parameters
    waitTime long : the time in ms to wait

    Returns
    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

    Parameters
    waitTime long : the time in ms to wait

    Returns
    boolean true if device becomes not available before time expires. false otherwise

    waitForDeviceOnline

    public abstract void waitForDeviceOnline ()

    Blocks until device is visible via adb. Uses default timeout

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

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

    waitForDeviceOnline

    public abstract void waitForDeviceOnline (long waitTime)

    Blocks until device is visible via adb.

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    Parameters
    waitTime long : the time in ms to wait

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

    waitForDeviceShell

    public abstract boolean waitForDeviceShell (long waitTime)

    Waits for device to be responsive to a basic adb shell command.

    Parameters
    waitTime long : the time in ms to wait

    Returns
    boolean true if device becomes responsive before waitTime elapses.