public interface IDevice extends IShellEnabledDevice
| Modifier and Type | Interface and Description |
|---|---|
static class |
IDevice.DeviceState
The state of a device.
|
static class |
IDevice.DeviceUnixSocketNamespace
Namespace of a Unix Domain Socket created on the device.
|
static class |
IDevice.Feature
Device level software features.
|
static class |
IDevice.HardwareFeature
Device level hardware features.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
CHANGE_BUILD_INFO
Device change bit mask: build info change.
|
static int |
CHANGE_CLIENT_LIST
Device change bit mask:
Client list change. |
static int |
CHANGE_STATE
Device change bit mask:
IDevice.DeviceState change. |
static java.lang.String |
FIRST_EMULATOR_SN
Serial number of the first connected emulator.
|
static java.lang.String |
MNT_DATA |
static java.lang.String |
MNT_EXTERNAL_STORAGE |
static java.lang.String |
MNT_ROOT |
static java.lang.String |
PROP_BUILD_API_LEVEL |
static java.lang.String |
PROP_BUILD_CHARACTERISTICS |
static java.lang.String |
PROP_BUILD_CODENAME |
static java.lang.String |
PROP_BUILD_TAGS |
static java.lang.String |
PROP_BUILD_TYPE |
static java.lang.String |
PROP_BUILD_VERSION |
static java.lang.String |
PROP_BUILD_VERSION_NUMBER
Deprecated.
Use
PROP_BUILD_API_LEVEL. |
static java.lang.String |
PROP_DEBUGGABLE |
static java.lang.String |
PROP_DEVICE_CPU_ABI |
static java.lang.String |
PROP_DEVICE_CPU_ABI_LIST |
static java.lang.String |
PROP_DEVICE_CPU_ABI2 |
static java.lang.String |
PROP_DEVICE_DENSITY |
static java.lang.String |
PROP_DEVICE_EMULATOR_DENSITY |
static java.lang.String |
PROP_DEVICE_LANGUAGE |
static java.lang.String |
PROP_DEVICE_MANUFACTURER |
static java.lang.String |
PROP_DEVICE_MODEL |
static java.lang.String |
PROP_DEVICE_REGION |
| Modifier and Type | Method and Description |
|---|---|
boolean |
arePropertiesSet()
Returns
true if properties have been cached |
void |
createForward(int localPort,
int remotePort)
Creates a port forwarding between a local and a remote port.
|
void |
createForward(int localPort,
java.lang.String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)
Creates a port forwarding between a local TCP port and a remote Unix Domain Socket.
|
default void |
executeBinderCommand(java.lang.String[] parameters,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
java.io.InputStream is)
Executes a Binder command on the device, and sends the result to a receiver
|
void |
executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver)
Executes a shell command on the device, and sends the result to a receiver
|
void |
executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver,
int maxTimeToOutputResponse)
|
default void |
executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
java.io.InputStream is)
A version of executeShell command that can take an input stream to send through stdin.
|
java.util.List<java.lang.String> |
getAbis()
Returns the ABIs supported by this device.
|
java.lang.String |
getAvdName()
Returns the name of the AVD the emulator is running.
|
java.util.concurrent.Future<java.lang.Integer> |
getBattery()
Return the device's battery level, from 0 to 100 percent.
|
java.util.concurrent.Future<java.lang.Integer> |
getBattery(long freshnessTime,
java.util.concurrent.TimeUnit timeUnit)
Return the device's battery level, from 0 to 100 percent.
|
java.lang.Integer |
getBatteryLevel()
Deprecated.
use
getBattery() |
java.lang.Integer |
getBatteryLevel(long freshnessMs)
Deprecated.
|
Client |
getClient(java.lang.String applicationName)
Returns a
Client by its application name. |
java.lang.String |
getClientName(int pid)
Returns the name of the client by pid or
null if pid is unknown |
Client[] |
getClients()
Returns the array of clients.
|
int |
getDensity()
Returns the density bucket of the device screen by reading the value for system property
PROP_DEVICE_DENSITY. |
FileListingService |
getFileListingService()
Returns a
FileListingService for this device. |
java.lang.String |
getLanguage()
Returns the user's language.
|
default InstallMetrics |
getLastInstallMetrics()
Gets the information about the most recent installation on this device.
|
java.lang.String |
getMountPoint(java.lang.String name)
Returns a mount point.
|
java.util.Map<java.lang.String,java.lang.String> |
getProperties()
Deprecated.
use
IShellEnabledDevice.getSystemProperty(String) instead |
java.lang.String |
getProperty(java.lang.String name)
Convenience method that attempts to retrieve a property via
IShellEnabledDevice.getSystemProperty(String) with a very short wait time, and swallows exceptions. |
java.lang.String |
getPropertyCacheOrSync(java.lang.String name)
Deprecated.
use
IShellEnabledDevice.getSystemProperty(String) instead |
int |
getPropertyCount()
Deprecated.
implementation detail
|
java.lang.String |
getPropertySync(java.lang.String name)
Deprecated.
|
java.lang.String |
getRegion()
Returns the user's region.
|
RawImage |
getScreenshot()
Takes a screen shot of the device and returns it as a
RawImage. |
RawImage |
getScreenshot(long timeout,
java.util.concurrent.TimeUnit unit) |
java.lang.String |
getSerialNumber()
Returns the serial number of the device.
|
IDevice.DeviceState |
getState()
Returns the state of the device.
|
SyncService |
getSyncService()
Returns a
SyncService object to push / pull files to and from the device. |
com.android.sdklib.AndroidVersion |
getVersion()
Returns the API level of the device.
|
boolean |
hasClients()
Returns whether the
Device has Clients. |
void |
installPackage(java.lang.String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
java.lang.String... extraArgs)
Installs an Android application on device.
|
void |
installPackage(java.lang.String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
java.lang.String... extraArgs)
Installs an Android application on device.
|
void |
installPackage(java.lang.String packageFilePath,
boolean reinstall,
java.lang.String... extraArgs)
Installs an Android application on device.
|
default void |
installPackages(java.util.List<java.io.File> apks,
boolean reinstall,
java.util.List<java.lang.String> installOptions)
Installs an Android application made of several APK files (one main and 0..n split packages)
with default timeout
|
void |
installPackages(java.util.List<java.io.File> apks,
boolean reinstall,
java.util.List<java.lang.String> installOptions,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Installs an Android application made of several APK files (one main and 0..n split packages)
|
void |
installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
java.lang.String... extraArgs)
Installs the application package that was pushed to a temporary location on the device.
|
void |
installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
java.lang.String... extraArgs)
Installs the application package that was pushed to a temporary location on the device.
|
void |
installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall,
java.lang.String... extraArgs)
Installs the application package that was pushed to a temporary location on the device.
|
default void |
installRemotePackages(java.util.List<java.lang.String> remoteApks,
boolean reinstall,
java.util.List<java.lang.String> installOptions)
Installs an Android application made of several APK files sitting locally on the device with
default timeout
|
default void |
installRemotePackages(java.util.List<java.lang.String> remoteApks,
boolean reinstall,
java.util.List<java.lang.String> installOptions,
long timeout,
java.util.concurrent.TimeUnit timeoutUnit)
Installs an Android application made of several APK files sitting locally on the device
|
boolean |
isBootLoader()
Returns if the device is in bootloader mode.
|
boolean |
isEmulator()
Returns
true if the device is an emulator. |
boolean |
isOffline()
Returns if the device is offline.
|
boolean |
isOnline()
Returns if the device is ready.
|
boolean |
isRoot()
Queries the current root-status of the device.
|
void |
pullFile(java.lang.String remote,
java.lang.String local)
Pulls a single file.
|
void |
pushFile(java.lang.String local,
java.lang.String remote)
Push a single file.
|
void |
reboot(java.lang.String into)
Reboot the device.
|
void |
removeForward(int localPort,
int remotePort)
Removes a port forwarding between a local and a remote port.
|
void |
removeForward(int localPort,
java.lang.String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)
Removes an existing port forwarding between a local and a remote port.
|
void |
removeRemotePackage(java.lang.String remoteFilePath)
Removes a file from device.
|
boolean |
root()
Ask the adb daemon to become root on the device.
|
void |
runEventLogService(LogReceiver receiver)
Runs the event log service and outputs the event log to the
LogReceiver. |
void |
runLogService(java.lang.String logname,
LogReceiver receiver)
Runs the log service for the given log and outputs the log to the
LogReceiver. |
void |
startScreenRecorder(java.lang.String remoteFilePath,
ScreenRecorderOptions options,
IShellOutputReceiver receiver)
Initiates screen recording on the device if the device supports
IDevice.Feature.SCREEN_RECORD. |
boolean |
supportsFeature(IDevice.Feature feature)
Returns whether this device supports the given software feature.
|
boolean |
supportsFeature(IDevice.HardwareFeature feature)
Returns whether this device supports the given hardware feature.
|
java.lang.String |
syncPackageToDevice(java.lang.String localFilePath)
Pushes a file to device
|
java.lang.String |
uninstallPackage(java.lang.String packageName)
Uninstalls an package from the device.
|
executeShellCommand, executeShellCommand, getName, getSystemPropertystatic final java.lang.String PROP_BUILD_VERSION
static final java.lang.String PROP_BUILD_API_LEVEL
static final java.lang.String PROP_BUILD_CODENAME
static final java.lang.String PROP_BUILD_TAGS
static final java.lang.String PROP_BUILD_TYPE
static final java.lang.String PROP_DEVICE_MODEL
static final java.lang.String PROP_DEVICE_MANUFACTURER
static final java.lang.String PROP_DEVICE_CPU_ABI_LIST
static final java.lang.String PROP_DEVICE_CPU_ABI
static final java.lang.String PROP_DEVICE_CPU_ABI2
static final java.lang.String PROP_BUILD_CHARACTERISTICS
static final java.lang.String PROP_DEVICE_DENSITY
static final java.lang.String PROP_DEVICE_EMULATOR_DENSITY
static final java.lang.String PROP_DEVICE_LANGUAGE
static final java.lang.String PROP_DEVICE_REGION
static final java.lang.String PROP_DEBUGGABLE
static final java.lang.String FIRST_EMULATOR_SN
static final int CHANGE_STATE
IDevice.DeviceState change.static final int CHANGE_CLIENT_LIST
Client list change.static final int CHANGE_BUILD_INFO
@Deprecated static final java.lang.String PROP_BUILD_VERSION_NUMBER
PROP_BUILD_API_LEVEL.static final java.lang.String MNT_EXTERNAL_STORAGE
static final java.lang.String MNT_ROOT
static final java.lang.String MNT_DATA
@NonNull java.lang.String getSerialNumber()
@Nullable java.lang.String getAvdName()
This is only valid if isEmulator() returns true.
If the emulator is not running any AVD (for instance it's running from an Android source
tree build), this method will return "<build>".
null if there isn't any.IDevice.DeviceState getState()
@Deprecated java.util.Map<java.lang.String,java.lang.String> getProperties()
IShellEnabledDevice.getSystemProperty(String) instead@Deprecated int getPropertyCount()
@Nullable
java.lang.String getProperty(@NonNull
java.lang.String name)
IShellEnabledDevice.getSystemProperty(String) with a very short wait time, and swallows exceptions.
Note: Prefer using IShellEnabledDevice.getSystemProperty(String) if you want control over the
timeout.
name - the name of the value to return.null if the property value was not immediately availableboolean arePropertiesSet()
true if properties have been cached@Deprecated
java.lang.String getPropertySync(java.lang.String name)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
IShellEnabledDevice.getSystemProperty(String)getProperty(String) that will attempt to retrieve the given
property from device directly, without using cache.
This method should (only) be used for any volatile properties.name - the name of the value to return.null if the property does not existTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandShellCommandUnresponsiveException - in case the shell command doesn't send output for a
given time.java.io.IOException - in case of I/O error on the connection.@Deprecated
java.lang.String getPropertyCacheOrSync(java.lang.String name)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
IShellEnabledDevice.getSystemProperty(String) insteadgetProperty(String) and getPropertySync(String) that
will attempt to retrieve the property from cache. If not found, will synchronously
attempt to query device directly and repopulate the cache if successful.name - the name of the value to return.null if the property does not existTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandShellCommandUnresponsiveException - in case the shell command doesn't send output for a
given time.java.io.IOException - in case of I/O error on the connection.boolean supportsFeature(@NonNull
IDevice.Feature feature)
boolean supportsFeature(@NonNull
IDevice.HardwareFeature feature)
@Nullable
java.lang.String getMountPoint(@NonNull
java.lang.String name)
name - the name of the mount point to returnMNT_EXTERNAL_STORAGE,
MNT_ROOT,
MNT_DATAboolean isOnline()
true if getState() returns IDevice.DeviceState.ONLINE.boolean isEmulator()
true if the device is an emulator.boolean isOffline()
true if getState() returns IDevice.DeviceState.OFFLINE.boolean isBootLoader()
true if getState() returns IDevice.DeviceState.BOOTLOADER.boolean hasClients()
Device has Clients.Client[] getClients()
Client getClient(java.lang.String applicationName)
Client by its application name.applicationName - the name of the applicationClient object or null if no match was found.SyncService getSyncService() throws TimeoutException, AdbCommandRejectedException, java.io.IOException
SyncService object to push / pull files to and from the device.null if the SyncService couldn't be created. This can happen if adb
refuse to open the connection because the IDevice is invalid
(or got disconnected).TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - if the connection with adb failed.FileListingService getFileListingService()
FileListingService for this device.RawImage getScreenshot() throws TimeoutException, AdbCommandRejectedException, java.io.IOException
RawImage.RawImage or null if something
went wrong.TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.RawImage getScreenshot(long timeout, java.util.concurrent.TimeUnit unit) throws TimeoutException, AdbCommandRejectedException, java.io.IOException
TimeoutExceptionAdbCommandRejectedExceptionjava.io.IOExceptionvoid startScreenRecorder(@NonNull
java.lang.String remoteFilePath,
@NonNull
ScreenRecorderOptions options,
@NonNull
IShellOutputReceiver receiver)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
ShellCommandUnresponsiveException
IDevice.Feature.SCREEN_RECORD.TimeoutExceptionAdbCommandRejectedExceptionjava.io.IOExceptionShellCommandUnresponsiveException@Deprecated
void executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver,
int maxTimeToOutputResponse)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
IShellEnabledDevice.executeShellCommand(String, IShellOutputReceiver, long, java.util.concurrent.TimeUnit).TimeoutExceptionAdbCommandRejectedExceptionShellCommandUnresponsiveExceptionjava.io.IOExceptionvoid executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
This is similar to calling
executeShellCommand(command, receiver, DdmPreferences.getTimeOut()).
command - the shell command to executereceiver - the IShellOutputReceiver that will receives the output of the shell
commandTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandShellCommandUnresponsiveException - in case the shell command doesn't send output
for a given time.java.io.IOException - in case of I/O error on the connection.executeShellCommand(String, IShellOutputReceiver, int),
DdmPreferences.getTimeOut()default void executeShellCommand(java.lang.String command,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
@Nullable
java.io.InputStream is)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
TimeoutExceptionAdbCommandRejectedExceptionShellCommandUnresponsiveExceptionjava.io.IOExceptiondefault void executeBinderCommand(java.lang.String[] parameters,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
@Nullable
java.io.InputStream is)
throws TimeoutException,
AdbCommandRejectedException,
ShellCommandUnresponsiveException,
java.io.IOException
This uses exec:cmd
command - the binder command to executereceiver - the IShellOutputReceiver that will receives the output of the binder
commandis - optional input stream to send through stdinTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandShellCommandUnresponsiveException - in case the binder command doesn't send output
for a given time.java.io.IOException - in case of I/O error on the connection.DdmPreferences.getTimeOut()void runEventLogService(LogReceiver receiver) throws TimeoutException, AdbCommandRejectedException, java.io.IOException
LogReceiver.
This call is blocking until LogReceiver.isCancelled() returns true.
receiver - the receiver to receive the event log entries.TimeoutException - in case of timeout on the connection. This can only be thrown if the
timeout happens during setup. Once logs start being received, no timeout will occur as it's
not possible to detect a difference between no log and timeout.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.void runLogService(java.lang.String logname,
LogReceiver receiver)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
LogReceiver.
This call is blocking until LogReceiver.isCancelled() returns true.
logname - the logname of the log to read from.receiver - the receiver to receive the event log entries.TimeoutException - in case of timeout on the connection. This can only be thrown if the
timeout happens during setup. Once logs start being received, no timeout will
occur as it's not possible to detect a difference between no log and timeout.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.void createForward(int localPort,
int remotePort)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
localPort - the local port to forwardremotePort - the remote port.TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.void createForward(int localPort,
java.lang.String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
localPort - the local port to forwardremoteSocketName - name of the unix domain socket created on the devicenamespace - namespace in which the unix domain socket was createdTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.void removeForward(int localPort,
int remotePort)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
localPort - the local port to forwardremotePort - the remote port.TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.void removeForward(int localPort,
java.lang.String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
localPort - the local port to forwardremoteSocketName - the remote unix domain socket name.namespace - namespace in which the unix domain socket was createdTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.java.lang.String getClientName(int pid)
null if pid is unknownpid - the pid of the client.void pushFile(java.lang.String local,
java.lang.String remote)
throws java.io.IOException,
AdbCommandRejectedException,
TimeoutException,
SyncException
local - the local filepath.remote - The remote filepath.java.io.IOException - in case of I/O error on the connection.AdbCommandRejectedException - if adb rejects the commandTimeoutException - in case of a timeout reading responses from the device.SyncException - if file could not be pushedvoid pullFile(java.lang.String remote,
java.lang.String local)
throws java.io.IOException,
AdbCommandRejectedException,
TimeoutException,
SyncException
remote - the full path to the remote filelocal - The local destination.java.io.IOException - in case of an IO exception.AdbCommandRejectedException - if adb rejects the commandTimeoutException - in case of a timeout reading responses from the device.SyncException - in case of a sync exception.void installPackage(java.lang.String packageFilePath,
boolean reinstall,
java.lang.String... extraArgs)
throws InstallException
packageFilePath - the absolute file system path to file on local host to installreinstall - set to true if re-install of app should be performedextraArgs - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.void installPackage(java.lang.String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
java.lang.String... extraArgs)
throws InstallException
packageFilePath - the absolute file system path to file on local host to installreinstall - set to true if re-install of app should be performedreceiver - The InstallReceiver to be used to monitor the install and get final
status.extraArgs - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.void installPackage(java.lang.String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
java.lang.String... extraArgs)
throws InstallException
packageFilePath - the absolute file system path to file on local host to installreinstall - set to true if re-install of app should be performedreceiver - The InstallReceiver to be used to monitor the install and get final
status.maxTimeout - the maximum timeout for the command to return. A value of 0 means no max
timeout will be applied.maxTimeToOutputResponse - the maximum amount of time during which the command is allowed
to not output any response. A value of 0 means the method will wait forever (until the
receiver cancels the execution) for command output and never throw.maxTimeUnits - Units for non-zero maxTimeout and maxTimeToOutputResponse
values.extraArgs - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.void installPackages(@NonNull
java.util.List<java.io.File> apks,
boolean reinstall,
@NonNull
java.util.List<java.lang.String> installOptions,
long timeout,
@NonNull
java.util.concurrent.TimeUnit timeoutUnit)
throws InstallException
apks - list of apks to install (1 main APK + 0..n split apks)reinstall - set to true if re-install of app should be performedinstallOptions - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.timeout - installation timeouttimeoutUnit - TimeUnit corresponding to the timeout parameterInstallException - if the installation fails.default void installPackages(@NonNull
java.util.List<java.io.File> apks,
boolean reinstall,
@NonNull
java.util.List<java.lang.String> installOptions)
throws InstallException
apks - list of apks to install (1 main APK + 0..n split apks)reinstall - set to true if re-install of app should be performedinstallOptions - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.default InstallMetrics getLastInstallMetrics()
InstallMetrics metrics describing the installation.default void installRemotePackages(@NonNull
java.util.List<java.lang.String> remoteApks,
boolean reinstall,
@NonNull
java.util.List<java.lang.String> installOptions,
long timeout,
@NonNull
java.util.concurrent.TimeUnit timeoutUnit)
throws InstallException
remoteApks - list of apk file paths sitting on the device to installreinstall - set to true if re-install of app should be performedinstallOptions - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.timeout - installation timeouttimeoutUnit - TimeUnit corresponding to the timeout parameterInstallException - if the installation fails.default void installRemotePackages(@NonNull
java.util.List<java.lang.String> remoteApks,
boolean reinstall,
@NonNull
java.util.List<java.lang.String> installOptions)
throws InstallException
apks - list of apk file paths on the device to installreinstall - set to true if re-install of app should be performedinstallOptions - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.java.lang.String syncPackageToDevice(java.lang.String localFilePath)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
SyncException
localFilePath - the absolute path to file on local hostString destination path on device for fileTimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOException - in case of I/O error on the connection.SyncException - if an error happens during the push of the package on the device.void installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall,
java.lang.String... extraArgs)
throws InstallException
remoteFilePath - absolute file path to package file on devicereinstall - set to true if re-install of app should be performedextraArgs - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.installRemotePackage(String, boolean, InstallReceiver, long, long, TimeUnit, String...)void installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
java.lang.String... extraArgs)
throws InstallException
remoteFilePath - absolute file path to package file on devicereinstall - set to true if re-install of app should be performedreceiver - The InstallReceiver to be used to monitor the install and get final
status.extraArgs - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.installRemotePackage(String, boolean, InstallReceiver, long, long, TimeUnit, String...)void installRemotePackage(java.lang.String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
java.util.concurrent.TimeUnit maxTimeUnits,
java.lang.String... extraArgs)
throws InstallException
remoteFilePath - absolute file path to package file on devicereinstall - set to true if re-install of app should be performedreceiver - The InstallReceiver to be used to monitor the install and get final
status.maxTimeout - the maximum timeout for the command to return. A value of 0 means no max
timeout will be applied.maxTimeToOutputResponse - the maximum amount of time during which the command is allowed
to not output any response. A value of 0 means the method will wait forever (until the
receiver cancels the execution) for command output and never throw.maxTimeUnits - Units for non-zero maxTimeout and maxTimeToOutputResponse
values.extraArgs - optional extra arguments to pass. See 'adb shell pm install --help' for
available options.InstallException - if the installation fails.void removeRemotePackage(java.lang.String remoteFilePath)
throws InstallException
remoteFilePath - path on device of file to removeInstallException - if the installation fails.java.lang.String uninstallPackage(java.lang.String packageName)
throws InstallException
packageName - the Android application package name to uninstallString with an error code, or null if success.InstallException - if the uninstallation fails.void reboot(java.lang.String into)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException
into - the bootloader name to reboot into, or null to just reboot the device.TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the commandjava.io.IOExceptionboolean root()
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
ShellCommandUnresponsiveException
TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the command.ShellCommandUnresponsiveException - if the root status cannot be queried.java.io.IOExceptionboolean isRoot()
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
ShellCommandUnresponsiveException
TimeoutException - in case of timeout on the connection.AdbCommandRejectedException - if adb rejects the command.java.io.IOExceptionShellCommandUnresponsiveException@Deprecated
java.lang.Integer getBatteryLevel()
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
ShellCommandUnresponsiveException
getBattery()The battery level may be cached. Only queries the device for its battery level if 5 minutes have expired since the last successful query.
null if it could not be retrievedTimeoutExceptionAdbCommandRejectedExceptionjava.io.IOExceptionShellCommandUnresponsiveException@Deprecated
java.lang.Integer getBatteryLevel(long freshnessMs)
throws TimeoutException,
AdbCommandRejectedException,
java.io.IOException,
ShellCommandUnresponsiveException
getBattery(long, TimeUnit)
The battery level may be cached. Only queries the device for its
battery level if freshnessMs ms have expired since the last successful query.
freshnessMs - null if it could not be retrievedShellCommandUnresponsiveExceptionTimeoutExceptionAdbCommandRejectedExceptionjava.io.IOException@NonNull java.util.concurrent.Future<java.lang.Integer> getBattery()
The battery level may be cached. Only queries the device for its battery level if 5 minutes have expired since the last successful query.
Future that can be used to query the battery level. The Future will return
a ExecutionException if battery level could not be retrieved.@NonNull
java.util.concurrent.Future<java.lang.Integer> getBattery(long freshnessTime,
@NonNull
java.util.concurrent.TimeUnit timeUnit)
The battery level may be cached. Only queries the device for its
battery level if freshnessTime has expired since the last successful query.
freshnessTime - the desired recency of battery leveltimeUnit - the TimeUnit of freshnessTimeFuture that can be used to query the battery level. The Future will return
a ExecutionException if battery level could not be retrieved.@NonNull java.util.List<java.lang.String> getAbis()
int getDensity()
PROP_DEVICE_DENSITY.@Nullable java.lang.String getLanguage()
@Nullable java.lang.String getRegion()
@NonNull com.android.sdklib.AndroidVersion getVersion()
AndroidVersion.DEFAULT otherwise.