StubDevice
public
class
StubDevice
extends Object
implements
IDevice
| java.lang.Object | |
| ↳ | com.android.tradefed.device.StubDevice |
Stub placeholder implementation of a IDevice.
Summary
Public constructors | |
|---|---|
StubDevice(String serial)
|
|
StubDevice(String serial, boolean isEmulator)
|
|
Public methods | |
|---|---|
boolean
|
arePropertiesSet()
Returns |
void
|
createForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)
Creates a port forwarding between a local TCP port and a remote Unix Domain Socket. |
void
|
createForward(int localPort, int remotePort)
Creates a port forwarding between a local and a remote port. |
void
|
createReverse(int remotePort, int localPort)
Creates a port reversing between a remote and a local port. |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
Executes a shell command on the device, and sends the result to a receiver. |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver)
Executes a shell command on the device, and sends the result to a receiver This is similar to calling |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, int maxTimeToOutputResponse)
This method is deprecated.
use |
void
|
executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
Executes a shell command on the device, and sends the result to a receiver. |
|
getAbis()
Returns the ABIs supported by this device. |
String
|
getAvdName()
Returns the name of the AVD the emulator is running. |
String
|
getAvdPath()
Returns the absolute path to the virtual device in the file system. |
|
getBattery(long freshnessTime, TimeUnit timeUnit)
Return the device's battery level, from 0 to 100 percent. |
|
getBattery()
Return the device's battery level, from 0 to 100 percent. |
Integer
|
getBatteryLevel(long freshnessMs)
This method is deprecated.
use |
Integer
|
getBatteryLevel()
This method is deprecated.
use |
Client
|
getClient(String applicationName)
Returns a |
String
|
getClientName(int pid)
Returns the name of the client by pid or |
Client[]
|
getClients()
Returns the array of clients. |
int
|
getDensity()
Returns the density bucket of the device screen by reading the value for system property
|
FileListingService
|
getFileListingService()
Returns a |
String
|
getLanguage()
Returns the user's language. |
String
|
getMountPoint(String name)
Returns a mount point. |
String
|
getName()
Returns a (humanized) name for this device. |
|
getProperties()
This method is deprecated.
use |
String
|
getProperty(String name)
Convenience method that attempts to retrieve a property via |
String
|
getPropertyCacheOrSync(String name)
This method is deprecated.
use |
int
|
getPropertyCount()
This method is deprecated. deprecated in ddmlib with "implementation detail" as reason. |
String
|
getPropertySync(String name)
This method is deprecated.
use |
String
|
getRegion()
Returns the user's region. |
RawImage
|
getScreenshot()
Takes a screen shot of the device and returns it as a |
RawImage
|
getScreenshot(long timeout, TimeUnit unit)
|
String
|
getSerialNumber()
Returns the serial number of the device. |
IDevice.DeviceState
|
getState()
Returns the state of the device. |
SyncService
|
getSyncService()
Returns a |
ListenableFuture<String>
|
getSystemProperty(String name)
Do a potential asynchronous query for a system property. |
boolean
|
hasClients()
|
void
|
installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)
Installs an Android application on device. |
void
|
installPackage(String packageFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)
Installs an Android application on device. |
void
|
installPackage(String packageFilePath, boolean reinstall, String... extraArgs)
Installs an Android application on device. |
void
|
installPackages(
Installs an Android application made of several APK files (one main and 0..n split packages) |
void
|
installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, String... extraArgs)
Installs the application package that was pushed to a temporary location on the device. |
void
|
installRemotePackage(String remoteFilePath, boolean reinstall, String... extraArgs)
Installs the application package that was pushed to a temporary location on the device. |
void
|
installRemotePackage(String remoteFilePath, boolean reinstall, InstallReceiver receiver, long maxTimeout, long maxTimeToOutputResponse, TimeUnit maxTimeUnits, String... extraArgs)
Installs the application package that was pushed to a temporary location on the device. |
boolean
|
isBootLoader()
Returns if the device is in bootloader mode. |
boolean
|
isEmulator()
Returns |
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(String remote, String local)
Pulls a single file. |
void
|
pushFile(String local, String remote)
Pushes a single file. |
void
|
reboot(String into)
Reboot the device. |
void
|
removeForward(int localPort)
Removes a port forwarding between a local and a remote port. |
void
|
removeForward(int localPort, int remotePort)
|
void
|
removeForward(int localPort, String remoteSocketName, IDevice.DeviceUnixSocketNamespace namespace)
|
void
|
removeRemotePackage(String remoteFilePath)
Removes a file from device. |
void
|
removeReverse(int remotePort)
Removes a port reversing between a remote and a local port. |
boolean
|
root()
Ask the adb daemon to become root on the device. |
void
|
setSerial(String serial)
|
void
|
startScreenRecorder(String remoteFilePath, ScreenRecorderOptions options, IShellOutputReceiver receiver)
Initiates screen recording on the device if the device supports |
boolean
|
supportsFeature(IDevice.HardwareFeature arg0)
Returns whether this device supports the given hardware feature. |
boolean
|
supportsFeature(IDevice.Feature feature)
Returns whether this device supports the given software feature. |
String
|
syncPackageToDevice(String localFilePath)
Pushes a file to device |
String
|
uninstallApp(String applicationID, String... extraArgs)
Uninstalls an app from the device. |
String
|
uninstallPackage(String packageName)
Uninstalls a package from the device. |
Public constructors
StubDevice
public StubDevice (String serial)
| Parameters | |
|---|---|
serial |
String |
StubDevice
public StubDevice (String serial,
boolean isEmulator)| Parameters | |
|---|---|
serial |
String |
isEmulator |
boolean |
Public methods
arePropertiesSet
public boolean arePropertiesSet ()
Returns true if properties have been cached
| Returns | |
|---|---|
boolean |
|
createForward
public void createForward (int localPort,
String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)Creates a port forwarding between a local TCP port and a remote Unix Domain Socket.
| Parameters | |
|---|---|
localPort |
int: the local port to forward |
remoteSocketName |
String: name of the unix domain socket created on the device |
namespace |
IDevice.DeviceUnixSocketNamespace: namespace in which the unix domain socket was created |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
createForward
public void createForward (int localPort,
int remotePort)Creates a port forwarding between a local and a remote port.
| Parameters | |
|---|---|
localPort |
int: the local port to forward |
remotePort |
int: the remote port. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
createReverse
public void createReverse (int remotePort,
int localPort)Creates a port reversing between a remote and a local port.
| Parameters | |
|---|---|
remotePort |
int: the remote port to reverse. |
localPort |
int: the local port |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits)Executes a shell command on the device, and sends the result to a receiver.
maxTimeToOutputResponse is used as a maximum waiting time when expecting the
command output from the device.
At any time, if the shell command does not output anything for a period longer than
maxTimeToOutputResponse, then the method will throw ShellCommandUnresponsiveException.
For commands like log output, a maxTimeToOutputResponse value of 0, meaning
that the method will never throw and will block until the receiver's IShellOutputReceiver.isCancelled() returns true, should be used.
| Parameters | |
|---|---|
command |
String: the shell command to execute |
receiver |
IShellOutputReceiver: the IShellOutputReceiver that will receives the output of the shell
command |
maxTimeToOutputResponse |
long: 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 |
TimeUnit: Units for non-zero maxTimeToOutputResponse values. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver)Executes a shell command on the device, and sends the result to a receiver
This is similar to calling
executeShellCommand(command, receiver, DdmPreferences.getTimeOut()).
| Parameters | |
|---|---|
command |
String: the shell command to execute |
receiver |
IShellOutputReceiver: the IShellOutputReceiver that will receives the output of the shell
command |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
int maxTimeToOutputResponse)
This method is deprecated.
use executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit).
| Parameters | |
|---|---|
command |
String |
receiver |
IShellOutputReceiver |
maxTimeToOutputResponse |
int |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits)Executes a shell command on the device, and sends the result to a receiver.
maxTimeToOutputResponse is used as a maximum waiting time when expecting the
command output from the device.
At any time, if the shell command does not output anything for a period longer than
maxTimeToOutputResponse, then the method will throw ShellCommandUnresponsiveException.
For commands like log output, a maxTimeToOutputResponse value of 0, meaning
that the method will never throw and will block until the receiver's IShellOutputReceiver.isCancelled() returns true, should be used.
| Parameters | |
|---|---|
command |
String: the shell command to execute |
receiver |
IShellOutputReceiver: the IShellOutputReceiver that will receives the output of the shell
command |
maxTimeout |
long: the maximum timeout for the command to return. A value of 0 means no max
timeout will be applied. |
maxTimeToOutputResponse |
long: 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 |
TimeUnit: Units for non-zero maxTimeout and maxTimeToOutputResponse
values. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
getAbis
publicgetAbis ()
Returns the ABIs supported by this device. The ABIs are sorted in preferred order, with the first ABI being the most preferred.
| Returns | |
|---|---|
|
the list of ABIs. |
getAvdName
public String getAvdName ()
Returns the name of the AVD the emulator is running.
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>".
Note: Prefer using getAvdData() if you want control over the timeout.
| Returns | |
|---|---|
String |
the name of the AVD or null if there isn't any. |
getAvdPath
public String getAvdPath ()
Returns the absolute path to the virtual device in the file system. The path is operating system dependent; it will have / name separators on Linux and \ separators on Windows.
Note: Prefer using getAvdData() if you want control over the timeout.
| Returns | |
|---|---|
String |
the AVD path or null if this is a physical device, the emulator console subcommand failed, or the emulator's version is older than 30.0.18 |
getBattery
publicgetBattery (long freshnessTime, TimeUnit timeUnit)
Return the device's battery level, from 0 to 100 percent.
The battery level may be cached. Only queries the device for its battery level if
freshnessTime has expired since the last successful query.
| Parameters | |
|---|---|
freshnessTime |
long: the desired recency of battery level |
timeUnit |
TimeUnit: the ERROR(/TimeUnit) of freshnessTime |
| Returns | |
|---|---|
|
a ERROR(/Future) that can be used to query the battery level. The Future will return
a ERROR(/ExecutionException) if battery level could not be retrieved. |
getBattery
publicgetBattery ()
Return the device's battery level, from 0 to 100 percent.
The battery level may be cached. Only queries the device for its battery level if 5 minutes have expired since the last successful query.
| Returns | |
|---|---|
|
a ERROR(/Future) that can be used to query the battery level. The Future will return
a ERROR(/ExecutionException) if battery level could not be retrieved. |
getBatteryLevel
public Integer getBatteryLevel (long freshnessMs)
This method is deprecated.
use getBattery(long, TimeUnit) instead.
Return the device's battery level, from 0 to 100 percent.
The battery level may be cached. Only queries the device for its battery level if
freshnessMs ms have expired since the last successful query.
| Returns | |
|---|---|
Integer |
the battery level or null if it could not be retrieved |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
getBatteryLevel
public Integer getBatteryLevel ()
This method is deprecated.
use getBattery() instead.
Return the device's battery level, from 0 to 100 percent.
The battery level may be cached. Only queries the device for its battery level if 5 minutes have expired since the last successful query.
| Returns | |
|---|---|
Integer |
the battery level or null if it could not be retrieved |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
getClient
public Client getClient (String applicationName)
Returns a Client by its application name.
| Parameters | |
|---|---|
applicationName |
String: the name of the application |
| Returns | |
|---|---|
Client |
the Client object or null if no match was found. |
getClientName
public String getClientName (int pid)
Returns the name of the client by pid or null if pid is unknown
| Parameters | |
|---|---|
pid |
int: the pid of the client. |
| Returns | |
|---|---|
String |
|
getDensity
public int getDensity ()
Returns the density bucket of the device screen by reading the value for system property
PROP_DEVICE_DENSITY.
| Returns | |
|---|---|
int |
the density, or -1 if it cannot be determined. |
getFileListingService
public FileListingService getFileListingService ()
Returns a FileListingService for this device.
| Returns | |
|---|---|
FileListingService |
|
getLanguage
public String getLanguage ()
Returns the user's language.
| Returns | |
|---|---|
String |
the user's language, or null if it's unknown |
getMountPoint
public String getMountPoint (String name)
Returns a mount point.
| Parameters | |
|---|---|
name |
String: the name of the mount point to return |
| Returns | |
|---|---|
String |
|
getName
public String getName ()
Returns a (humanized) name for this device. Typically this is the AVD name for AVD's, and a combination of the manufacturer name, model name & serial number for devices.
| Returns | |
|---|---|
String |
|
getProperties
publicgetProperties ()
This method is deprecated.
use getSystemProperty(String) instead.
Returns the cached device properties. It contains the whole output of 'getprop'
| Returns | |
|---|---|
|
|
getProperty
public String getProperty (String name)
Convenience method that attempts to retrieve a property via 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.
| Parameters | |
|---|---|
name |
String: the name of the value to return. |
| Returns | |
|---|---|
String |
the value or null if the property value was not immediately available |
getPropertyCacheOrSync
public String getPropertyCacheOrSync (String name)
This method is deprecated.
use getProperty(String) instead.
A combination of getProperty(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.
| Parameters | |
|---|---|
name |
String: the name of the value to return. |
| Returns | |
|---|---|
String |
the value or null if the property does not exist |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
getPropertyCount
public int getPropertyCount ()
This method is deprecated.
deprecated in ddmlib with "implementation detail" as reason.
Returns the number of property for this device.
| Returns | |
|---|---|
int |
|
getPropertySync
public String getPropertySync (String name)
This method is deprecated.
use getProperty(String) instead.
A variant of 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.
| Parameters | |
|---|---|
name |
String: the name of the value to return. |
| Returns | |
|---|---|
String |
the value or null if the property does not exist |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
getRegion
public String getRegion ()
Returns the user's region.
| Returns | |
|---|---|
String |
the user's region, or null if it's unknown |
getScreenshot
public RawImage getScreenshot ()
Takes a screen shot of the device and returns it as a RawImage.
| Returns | |
|---|---|
RawImage |
the screenshot as a RawImage or null if something went
wrong. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
getScreenshot
public RawImage getScreenshot (long timeout, TimeUnit unit)
| Parameters | |
|---|---|
timeout |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
RawImage |
|
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
getSerialNumber
public String getSerialNumber ()
Returns the serial number of the device.
| Returns | |
|---|---|
String |
|
getState
public IDevice.DeviceState getState ()
Returns the state of the device.
| Returns | |
|---|---|
IDevice.DeviceState |
|
getSyncService
public SyncService getSyncService ()
Returns a SyncService object to push / pull files to and from the device.
| Returns | |
|---|---|
SyncService |
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). |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
getSystemProperty
public ListenableFuture<String> getSystemProperty (String name)
Do a potential asynchronous query for a system property.
| Parameters | |
|---|---|
name |
String: the name of the value to return. |
| Returns | |
|---|---|
ListenableFuture<String> |
a ListenableFuture. ERROR(get/Future#get() get) may return
null. |
installPackage
public void installPackage (String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits,
String... extraArgs)Installs an Android application on device. This is a helper method that combines the syncPackageToDevice, installRemotePackage, and removePackage steps
| Parameters | |
|---|---|
packageFilePath |
String: the absolute file system path to file on local host to install |
reinstall |
boolean: set to true if re-install of app should be performed |
receiver |
InstallReceiver: The InstallReceiver to be used to monitor the install and get final
status. |
maxTimeout |
long: the maximum timeout for the command to return. A value of 0 means no max
timeout will be applied. |
maxTimeToOutputResponse |
long: 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 |
TimeUnit: Units for non-zero maxTimeout and maxTimeToOutputResponse
values. |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Throws | |
|---|---|
InstallException |
|
installPackage
public void installPackage (String packageFilePath,
boolean reinstall,
InstallReceiver receiver,
String... extraArgs)Installs an Android application on device. This is a helper method that combines the syncPackageToDevice, installRemotePackage, and removePackage steps
| Parameters | |
|---|---|
packageFilePath |
String: the absolute file system path to file on local host to install |
reinstall |
boolean: set to true if re-install of app should be performed |
receiver |
InstallReceiver: The InstallReceiver to be used to monitor the install and get final
status. |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Throws | |
|---|---|
InstallException |
|
installPackage
public void installPackage (String packageFilePath,
boolean reinstall,
String... extraArgs)Installs an Android application on device. This is a helper method that combines the syncPackageToDevice, installRemotePackage, and removePackage steps
| Parameters | |
|---|---|
packageFilePath |
String: the absolute file system path to file on local host to install |
reinstall |
boolean: set to true if re-install of app should be performed |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Throws | |
|---|---|
InstallException |
|
installPackages
public void installPackages (apkFilePaths, boolean reinstall, extraArgs, long timeOutInMs, TimeUnit timeunit)
Installs an Android application made of several APK files (one main and 0..n split packages)
| Parameters | |
|---|---|
apkFilePaths |
: list of apks to install (1 main APK + 0..n split apks) |
reinstall |
boolean: set to true if re-install of app should be performed |
extraArgs |
: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
timeOutInMs |
long: installation timeout |
timeunit |
TimeUnit: ERROR(/TimeUnit) corresponding to the timeout parameter |
| Throws | |
|---|---|
InstallException |
|
installRemotePackage
public void installRemotePackage (String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
String... extraArgs)Installs the application package that was pushed to a temporary location on the device.
| Parameters | |
|---|---|
remoteFilePath |
String: absolute file path to package file on device |
reinstall |
boolean: set to true if re-install of app should be performed |
receiver |
InstallReceiver: The InstallReceiver to be used to monitor the install and get final
status. |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Throws | |
|---|---|
InstallException |
|
installRemotePackage
public void installRemotePackage (String remoteFilePath,
boolean reinstall,
String... extraArgs)Installs the application package that was pushed to a temporary location on the device.
| Parameters | |
|---|---|
remoteFilePath |
String: absolute file path to package file on device |
reinstall |
boolean: set to true if re-install of app should be performed |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Throws | |
|---|---|
InstallException |
|
installRemotePackage
public void installRemotePackage (String remoteFilePath,
boolean reinstall,
InstallReceiver receiver,
long maxTimeout,
long maxTimeToOutputResponse,
TimeUnit maxTimeUnits,
String... extraArgs)Installs the application package that was pushed to a temporary location on the device.
| Parameters | |
|---|---|
remoteFilePath |
String: absolute file path to package file on device |
reinstall |
boolean: set to true if re-install of app should be performed |
receiver |
InstallReceiver: The InstallReceiver to be used to monitor the install and get final
status. |
maxTimeout |
long: the maximum timeout for the command to return. A value of 0 means no max
timeout will be applied. |
maxTimeToOutputResponse |
long: 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 |
TimeUnit: Units for non-zero maxTimeout and maxTimeToOutputResponse
values. |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Throws | |
|---|---|
InstallException |
|
isBootLoader
public boolean isBootLoader ()
Returns if the device is in bootloader mode.
| Returns | |
|---|---|
boolean |
true if getState() returns DeviceState.BOOTLOADER. |
isEmulator
public boolean isEmulator ()
Returns true if the device is an emulator.
| Returns | |
|---|---|
boolean |
|
isOffline
public boolean isOffline ()
Returns if the device is offline.
| Returns | |
|---|---|
boolean |
true if getState() returns DeviceState.OFFLINE. |
isOnline
public boolean isOnline ()
Returns if the device is ready.
| Returns | |
|---|---|
boolean |
true if getState() returns DeviceState.ONLINE. |
isRoot
public boolean isRoot ()
Queries the current root-status of the device. See "adb root" for more information.
| Returns | |
|---|---|
boolean |
true if the adb daemon is running as root, otherwise false. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
pullFile
public void pullFile (String remote,
String local)Pulls a single file.
| Parameters | |
|---|---|
remote |
String: the full path to the remote file |
local |
String: The local destination. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
pushFile
public void pushFile (String local,
String remote)Pushes a single file.
| Parameters | |
|---|---|
local |
String: the local filepath. |
remote |
String: the remote filepath |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
reboot
public void reboot (String into)
Reboot the device.
| Parameters | |
|---|---|
into |
String: the bootloader name to reboot into, or null to just reboot the device. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
removeForward
public void removeForward (int localPort)
Removes a port forwarding between a local and a remote port.
| Parameters | |
|---|---|
localPort |
int: the local port to forward |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
removeForward
public void removeForward (int localPort,
int remotePort)| Parameters | |
|---|---|
localPort |
int |
remotePort |
int |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
removeForward
public void removeForward (int localPort,
String remoteSocketName,
IDevice.DeviceUnixSocketNamespace namespace)| Parameters | |
|---|---|
localPort |
int |
remoteSocketName |
String |
namespace |
IDevice.DeviceUnixSocketNamespace |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
removeRemotePackage
public void removeRemotePackage (String remoteFilePath)
Removes a file from device.
| Parameters | |
|---|---|
remoteFilePath |
String: path on device of file to remove |
| Throws | |
|---|---|
InstallException |
|
removeReverse
public void removeReverse (int remotePort)
Removes a port reversing between a remote and a local port.
| Parameters | |
|---|---|
remotePort |
int: the remote port. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
TimeoutException |
|
root
public boolean root ()
Ask the adb daemon to become root on the device. This may silently fail, and can only succeed on developer builds. See "adb root" for more information.
| Returns | |
|---|---|
boolean |
true if the adb daemon is running as root, otherwise false. |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
setSerial
public void setSerial (String serial)
| Parameters | |
|---|---|
serial |
String |
startScreenRecorder
public void startScreenRecorder (String remoteFilePath,
ScreenRecorderOptions options,
IShellOutputReceiver receiver)Initiates screen recording on the device if the device supports IDevice.Feature.SCREEN_RECORD.
| Parameters | |
|---|---|
remoteFilePath |
String |
options |
ScreenRecorderOptions |
receiver |
IShellOutputReceiver |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
ShellCommandUnresponsiveException |
|
TimeoutException |
|
supportsFeature
public boolean supportsFeature (IDevice.HardwareFeature arg0)
Returns whether this device supports the given hardware feature.
| Parameters | |
|---|---|
arg0 |
IDevice.HardwareFeature |
| Returns | |
|---|---|
boolean |
|
supportsFeature
public boolean supportsFeature (IDevice.Feature feature)
Returns whether this device supports the given software feature.
| Parameters | |
|---|---|
feature |
IDevice.Feature |
| Returns | |
|---|---|
boolean |
|
syncPackageToDevice
public String syncPackageToDevice (String localFilePath)
Pushes a file to device
| Parameters | |
|---|---|
localFilePath |
String: the absolute path to file on local host |
| Returns | |
|---|---|
String |
String destination path on device for file |
| Throws | |
|---|---|
AdbCommandRejectedException |
|
SyncException |
|
TimeoutException |
|
uninstallApp
public String uninstallApp (String applicationID,
String... extraArgs)Uninstalls an app from the device.
| Parameters | |
|---|---|
applicationID |
String: the Android application ID to uninstall |
extraArgs |
String: optional extra arguments to pass. See 'adb shell pm install --help' for
available options. |
| Returns | |
|---|---|
String |
a String with an error code, or null if success. |
| Throws | |
|---|---|
InstallException |
|
uninstallPackage
public String uninstallPackage (String packageName)
Uninstalls a package from the device.
| Parameters | |
|---|---|
packageName |
String: the Android application ID to uninstall |
| Returns | |
|---|---|
String |
a String with an error code, or null if success. |
| Throws | |
|---|---|
InstallException |
|