public interface AndroidDevicesHelper extends Closeable
All of ExopackageInstaller's interaction with devices and adb goes through this class and AndroidDevice making it easy to provide different implementations in tests.
Modifier and Type | Interface and Description |
---|---|
static interface |
AndroidDevicesHelper.AdbDeviceCallable
This is basically the same as AdbHelper.AdbCallable except that it takes an AndroidDevice
instead of an IDevice.
|
Modifier and Type | Method and Description |
---|---|
void |
adbCall(String description,
AndroidDevicesHelper.AdbDeviceCallable func,
boolean quiet) |
default void |
adbCallOrThrow(String description,
AndroidDevicesHelper.AdbDeviceCallable func,
boolean quiet)
A simple wrapper around adbCall that will throw if adbCall returns false.
|
com.google.common.collect.ImmutableList<AndroidDevice> |
getDevices(boolean quiet) |
void |
installApk(SourcePathResolverAdapter pathResolver,
HasInstallableApk hasInstallableApk,
boolean installViaSd,
boolean quiet,
String packageName)
Install apk on all matching devices.
|
void |
startActivity(SourcePathResolverAdapter pathResolver,
HasInstallableApk hasInstallableApk,
String activity,
boolean waitForDebugger) |
void |
uninstallApp(String packageName,
boolean shouldKeepUserData)
Uninstall apk from all matching devices.
|
default void adbCallOrThrow(String description, AndroidDevicesHelper.AdbDeviceCallable func, boolean quiet) throws InterruptedException
InterruptedException
void adbCall(String description, AndroidDevicesHelper.AdbDeviceCallable func, boolean quiet) throws InterruptedException
InterruptedException
com.google.common.collect.ImmutableList<AndroidDevice> getDevices(boolean quiet)
void installApk(SourcePathResolverAdapter pathResolver, HasInstallableApk hasInstallableApk, boolean installViaSd, boolean quiet, @Nullable String packageName) throws InterruptedException
-e (emulator-only) - only emulators are passing the filter -d (device-only) - only real devices are passing the filter -s (serial) - only device/emulator with specific serial number are passing the filter
If more than one device matches the filter this function will fail unless multi-install mode is enabled (-x). This flag is used as a marker that user understands that multiple devices will be used to install the apk if needed.
InterruptedException
void uninstallApp(String packageName, boolean shouldKeepUserData) throws InterruptedException
void startActivity(SourcePathResolverAdapter pathResolver, HasInstallableApk hasInstallableApk, @Nullable String activity, boolean waitForDebugger) throws IOException
IOException