INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Proporciona una API fiable y de un nivel ligeramente superior a un IDevice
ddmlib.
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 |
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 |
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 adb shell y devuelve el resultado como |
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 |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Método auxiliar que ejecuta un comando de shell adb y devuelve los resultados como un |
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 |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Devuelve un |
abstract String[] | getChildren (String deviceFilePath) Alternativa al uso |
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 |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Devuelve un |
abstract TestDeviceState | getDeviceState () Obtener el estado del dispositivo. |
abstract long | getDeviceTimeOffset (Date date) Ayudante para obtener la diferencia horaria entre el dispositivo y un |
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 conveniente para obtener el tipo de producto de este dispositivo cuando está en modo fastboot. |
abstract String | getFastbootProductVariant () Método conveniente 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 |
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 |
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 |
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 |
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 |
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 |
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 |
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 |
abstract File | pullFile (String remoteFilePath) Recupera un archivo del dispositivo, lo almacena en un |
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 |
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 |
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 |
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 |
abstract void | rebootUntilOnline (String reason) Una alternativa a |
abstract void | rebootUserspace () Reinicia solo la parte del espacio de usuario del dispositivo. |
abstract void | rebootUserspaceUntilOnline () Una alternativa a |
abstract void | remountSystemWritable () Haga que la partición del sistema en el dispositivo sea escribible. |
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 |
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 |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Igual que |
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 |
abstract boolean | setProperty (String propKey, String propValue) Establece el valor de propiedad dado en el dispositivo. |
abstract void | setRecovery ( IDeviceRecovery recovery) Configure |
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 |
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 queITestDevice#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 | |
---|---|
| 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 | |
---|---|
| 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 usarexecuteShellCommand(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 | |
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 aexecuteFastbootCommand(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 | |
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 adb shell y devuelve el resultado como ERROR(/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 deexecuteShellCommand(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. |
Ver también:
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. |
Ver también:
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. |
Ver también:
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. |
Ver también:
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
Método auxiliar que borra una partición del dispositivo.
SigetUseFastbootErase()
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 es posible que la versión devuelta aquí no coincida con la versión informada por fastboot y que no devuelva 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 ERROR(/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 abstractgetBootHistory ()
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 abstractgetBootHistorySince (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 ERROR(/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 ERROR(/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 conveniente 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éricogetProductType()
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 ERROR(/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 conveniente 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éricogetProductType()
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 ERROR(/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)
Recupere una referencia a un archivo remoto en el dispositivo.
Parámetros | |
---|---|
path | String : la ruta del archivo a recuperar. Puede ser una ruta absoluta o una ruta relativa a '/'. (es decir, se admite la sintaxis "/ system" y "system") |
Devoluciones | |
---|---|
IFileEntry | el IFileEntry o null si no se puede encontrar el archivo en path dada |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
obtenerIDevice
public abstract IDevice getIDevice ()
Devuelve una referencia al IDevice
ddmlib asociado.
IDevice
cada vez que el dispositivo se desconecta y se vuelve a conectar de adb. Por lo tanto, las personas que llaman no deben mantener una referencia al IDevice
, porque esa referencia puede volverse obsoleta.Devoluciones | |
---|---|
IDevice | el IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Devuelve el valor entero de la propiedad dada del dispositivo.
Parámetros | |
---|---|
name | String : el nombre de la propiedad |
defaultValue | long : valor predeterminado para devolver si la propiedad está vacía o no existe. |
Devoluciones | |
---|---|
long | el valor de la propiedad o defaultValue si la propiedad está vacía, no existe o no tiene un valor entero. |
Lanza | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Devuelve la última vez que las API de Tradefed activaron un reinicio en milisegundos desde EPOCH según lo devuelto por ERROR(/System#currentTimeMillis())
.
Devoluciones | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Obtenga el primer nivel de API lanzado del dispositivo. El valor predeterminado es UNKNOWN_API_LEVEL
.
Devoluciones | |
---|---|
int | un número entero que indica el primer nivel de API lanzado del dispositivo |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
obtenerLogcat
public abstract InputStreamSource getLogcat ()
Toma una secuencia instantánea de los datos logcat.
Funciona en dos modos:
TestDeviceOptions.getMaxLogcatDataSize()
bytes del contenido actual de la captura de logcat en segundo plano.Devoluciones | |
---|---|
InputStreamSource |
obtenerLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Toma un flujo de instantáneas de los últimos maxBytes
de datos de logcat capturados.
Útil para los casos en los que desea capturar instantáneas frecuentes de los datos de logcat capturados sin incurrir en la penalización de espacio en disco potencialmente grande de obtener la instantánea getLogcat()
completa.
Parámetros | |
---|---|
maxBytes | int : la cantidad máxima de datos a devolver. Debe ser una cantidad que pueda caber cómodamente en la memoria |
Devoluciones | |
---|---|
InputStreamSource |
getLogcatDump
public abstract InputStreamSource getLogcatDump ()
Obtenga un volcado del logcat actual para el dispositivo. A diferencia de getLogcat()
, este método siempre devolverá un volcado estático del logcat.
Tiene la desventaja de que no se devolverá nada si el dispositivo no está accesible.
Devoluciones | |
---|---|
InputStreamSource | un InputStreamSource de los datos logcat. Se devuelve una secuencia vacía si no se pueden capturar datos logcat. |
getLogcatDesde
public abstract InputStreamSource getLogcatSince (long date)
Toma un flujo de instantáneas de los datos de logcat capturados a partir de la fecha proporcionada. Se debe usar la hora en el dispositivo getDeviceDate()
.
Parámetros | |
---|---|
date | long : en milisegundos desde el formato de época de cuándo iniciar la instantánea hasta el presente. (se puede obtener usando 'fecha +%s') |
Devoluciones | |
---|---|
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 |
Devoluciones | |
---|---|
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 |
Devoluciones | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Lanza | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
Devoluciones | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Lanza | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
Parámetros | |
---|---|
partition | String |
Devoluciones | |
---|---|
long | the amount of free space in KB |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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. |
Devoluciones | |
---|---|
ProcessInfo | ProcessInfo of given processName |
Lanza | |
---|---|
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. |
Devoluciones | |
---|---|
String |
Lanza | |
---|---|
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.Devoluciones | |
---|---|
String | the ERROR(/String) product type name. Will not be null |
Lanza | |
---|---|
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.Devoluciones | |
---|---|
String | the ERROR(/String) product variant name or null if it cannot be determined |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
getProperty
public abstract String getProperty (String name)
Retrieve the given property value from the device.
Parámetros | |
---|---|
name | String : the property name |
Devoluciones | |
---|---|
String | the property value or null if it does not exist |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
Devoluciones | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
Devoluciones | |
---|---|
String | the ERROR(/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.
Devoluciones | |
---|---|
A list of tombstone files, empty if no tombstone. |
Lanza | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
Devoluciones | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
Devoluciones | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
Devoluciones | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
isAdbTcp
public abstract boolean isAdbTcp ()
Devoluciones | |
---|---|
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
Devoluciones | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Lanza | |
---|---|
| 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
Devoluciones | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
Devoluciones | |
---|---|
boolean | true if the device is encrypted. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
Parámetros | |
---|---|
deviceFilePath | String |
Devoluciones | |
---|---|
boolean |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
Devoluciones | |
---|---|
boolean | true if the device supports encryption. |
Lanza | |
---|---|
| 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.
Parámetros | |
---|---|
fullPath | String |
Devoluciones | |
---|---|
boolean |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
Devoluciones | |
---|---|
boolean |
Lanza | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
Devoluciones | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
Devoluciones | |
---|---|
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. |
Devoluciones | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Lanza | |
---|---|
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.
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.
Lanza | |
---|---|
| 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)Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Lanza | |
---|---|
| 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.
Parámetros | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
Devoluciones | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
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) |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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. |
Devoluciones | |
---|---|
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) |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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. |
Devoluciones | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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. |
Devoluciones | |
---|---|
String | A ERROR(/String) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
Lanza | |
---|---|
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 |
Devoluciones | |
---|---|
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) |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.Lanza | |
---|---|
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. |
Lanza | |
---|---|
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.Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recoveryLanza | |
---|---|
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 |
Lanza | |
---|---|
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
Lanza | |
---|---|
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.
Lanza | |
---|---|
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. |
Lanza | |
---|---|
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.
Lanza | |
---|---|
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.
Lanza | |
---|---|
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.
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Lanza | |
---|---|
| 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.
Parámetros | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
Devoluciones | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. 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 |
Devoluciones | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. 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.
Parámetros | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
Devoluciones | |
---|---|
boolean |
Lanza | |
---|---|
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.
Parámetros | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
Devoluciones | |
---|---|
boolean |
Lanza | |
---|---|
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 |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
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. |
Devoluciones | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Lanza | |
---|---|
| 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.
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.
Devoluciones | |
---|---|
String | the tcp serial number or null if device could not be switched |
Lanza | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
Devoluciones | |
---|---|
boolean | true if switch was successful, false otherwise. |
Lanza | |
---|---|
| 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.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 |
Devoluciones | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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.Devoluciones | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
| 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 |
Devoluciones | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Lanza | |
---|---|
| 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.
Devoluciones | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Lanza | |
---|---|
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.
Parámetros | |
---|---|
waitTime | long |
Devoluciones | |
---|---|
boolean | True if device is available, False if unavailable. |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
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 |
Devoluciones | |
---|---|
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 |
Devoluciones | |
---|---|
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.Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Lanza | |
---|---|
DeviceNotAvailableException | si se pierde la conexión con el dispositivo y no se puede recuperar. |
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 |
Devoluciones | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |