@Beta
public abstract class DeviceConnector
extends java.lang.Object
implements com.android.ddmlib.IShellEnabledDevice
| Constructor and Description |
|---|
DeviceConnector() |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
connect(int timeOut,
com.android.utils.ILogger logger)
Establishes the connection with the device.
|
abstract void |
disconnect(int timeOut,
com.android.utils.ILogger logger)
Disconnects from the device.
|
abstract java.util.List<java.lang.String> |
getAbis()
The device supported ABIs.
|
abstract java.lang.String |
getApiCodeName()
Returns the API codename for the device, or null if it's a release device.
|
abstract int |
getApiLevel()
Returns the API level of the device, or 0 if it could not be queried.
|
abstract int |
getDensity()
Returns the screen density bucket for the device.
|
abstract DeviceConfig |
getDeviceConfig() |
abstract int |
getHeight() |
abstract java.lang.String |
getLanguage()
Returns the user's language.
|
abstract java.util.Set<java.lang.String> |
getLanguageSplits()
Returns the language strings for 21+ config splits.
|
abstract java.lang.String |
getNullableProperty(java.lang.String propertyName) |
abstract java.lang.String |
getProperty(java.lang.String propertyName) |
abstract java.lang.String |
getRegion()
Returns the user's region.
|
abstract java.lang.String |
getSerialNumber()
Returns the serial number of the device.
|
abstract com.android.ddmlib.IDevice.DeviceState |
getState()
Returns the
IDevice.DeviceState for the device, or null if if
cannot determined. |
abstract int |
getWidth() |
abstract void |
installPackage(java.io.File apkFile,
java.util.Collection<java.lang.String> options,
int timeout,
com.android.utils.ILogger logger)
Installs the given APK on the device.
|
abstract void |
installPackages(java.util.List<java.io.File> apkFiles,
java.util.Collection<java.lang.String> options,
int timeoutInMs,
com.android.utils.ILogger logger)
Installs the given APK files on the device.
|
abstract void |
pullFile(java.lang.String remote,
java.lang.String local)
Pulls a single file.
|
abstract void |
uninstallPackage(java.lang.String packageName,
int timeout,
com.android.utils.ILogger logger)
Uninstall the given package name from the device
|
public abstract void connect(int timeOut,
com.android.utils.ILogger logger)
throws com.android.ddmlib.TimeoutException
timeOut - the time out.com.android.ddmlib.TimeoutExceptionpublic abstract void disconnect(int timeOut,
com.android.utils.ILogger logger)
throws com.android.ddmlib.TimeoutException
timeOut - the time out.com.android.ddmlib.TimeoutExceptionpublic abstract void installPackage(@NonNull
java.io.File apkFile,
@NonNull
java.util.Collection<java.lang.String> options,
int timeout,
com.android.utils.ILogger logger)
throws DeviceException
apkFile - the APK file to install.timeout - the time out.logger - the logger to use to log debug, warnings and errors.DeviceExceptionpublic abstract void installPackages(@NonNull
java.util.List<java.io.File> apkFiles,
@NonNull
java.util.Collection<java.lang.String> options,
int timeoutInMs,
com.android.utils.ILogger logger)
throws DeviceException
DeviceException will be thrown.apkFiles - the APK files to install.options - the install options.timeoutInMs - the time out in milliseconds.logger - the logger to use to log debug, warnings and errors.DeviceExceptionpublic abstract void uninstallPackage(@NonNull
java.lang.String packageName,
int timeout,
com.android.utils.ILogger logger)
throws DeviceException
packageName - the package nametimeout - the time outDeviceExceptionpublic abstract void pullFile(java.lang.String remote,
java.lang.String local)
throws java.io.IOException
remote - the full path to the remote filelocal - The local destination.java.io.IOException - in case of an IO exception.@NonNull public abstract java.lang.String getSerialNumber()
public abstract int getApiLevel()
@Nullable public abstract java.lang.String getApiCodeName()
@Nullable public abstract com.android.ddmlib.IDevice.DeviceState getState()
IDevice.DeviceState for the device, or null if if
cannot determined.@NonNull public abstract java.util.List<java.lang.String> getAbis()
public abstract int getDensity()
public abstract int getHeight()
public abstract int getWidth()
@Nullable public abstract java.lang.String getLanguage()
@Nullable
public abstract java.util.Set<java.lang.String> getLanguageSplits()
throws com.android.ddmlib.TimeoutException,
com.android.ddmlib.AdbCommandRejectedException,
com.android.ddmlib.ShellCommandUnresponsiveException,
java.io.IOException
com.android.ddmlib.TimeoutExceptioncom.android.ddmlib.AdbCommandRejectedExceptioncom.android.ddmlib.ShellCommandUnresponsiveExceptionjava.io.IOException@Nullable public abstract java.lang.String getRegion()
@NonNull
public abstract java.lang.String getProperty(@NonNull
java.lang.String propertyName)
@Nullable
public abstract java.lang.String getNullableProperty(@NonNull
java.lang.String propertyName)
@NonNull public abstract DeviceConfig getDeviceConfig() throws DeviceException
DeviceException