NativeDevice

public class NativeDevice
extends Object implements IManagedTestDevice, IConfigurationReceiver

java.lang.Object
   ↳ com.android.tradefed.device.NativeDevice


Default implementation of a ITestDevice Non-full stack android devices.

Summary

Nested classes

class NativeDevice.AdbAction

A DeviceAction for running a OS 'adb ....' command. 

class NativeDevice.AdbShellAction

 

class NativeDevice.RebootDeviceAction

DeviceAction for rebooting a device. 

enum NativeDevice.RebootMode

A mode of a reboot. 

Constants

int INVALID_USER_ID

Value returned for any invalid/not found user id: UserHandle defined the -10000 value

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

the default number of command retry attempts to perform

Fields

protected static final String SD_CARD

protected static final String STORAGE_EMULATED

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

Public constructors

NativeDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Creates a TestDevice.

Public methods

boolean checkApiLevelAgainstNextRelease(int strictMinLevel)

boolean checkConnectivity()

boolean clearErrorDialogs()

void clearLastConnectedWifiNetwork()

void clearLogcat()

boolean connectToWifiNetwork(String wifiSsid, String wifiPsk)

boolean connectToWifiNetwork(String wifiSsid, String wifiPsk, boolean scanSsid)

boolean connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk, boolean scanSsid)

boolean connectToWifiNetworkIfNeeded(String wifiSsid, String wifiPsk)

int createUser(String name, boolean guest, boolean ephemeral)

int createUser(String name)

int createUserNoThrow(String name)

void deleteFile(String deviceFilePath)

boolean deviceSoftRestarted(ProcessInfo prevSystemServerProcess)

boolean deviceSoftRestartedSince(long utcEpochTime, TimeUnit timeUnit)

boolean disableAdbRoot()

void disableKeyguard()

boolean disableNetworkMonitor()

boolean disconnectFromWifi()

boolean doesFileExist(String deviceFilePath)

File dumpHeap(String process, String devicePath)

boolean enableAdbRoot()

boolean enableNetworkMonitor()

boolean encryptDevice(boolean inplace)

String executeAdbCommand(long timeout, String... cmdArgs)

String executeAdbCommand(String... cmdArgs)

CommandResult executeFastbootCommand(String... cmdArgs)

CommandResult executeFastbootCommand(long timeout, String... cmdArgs)

CommandResult executeLongFastbootCommand(String... cmdArgs)

String executeShellCommand(String command)

void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

void executeShellCommand(String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)

void executeShellCommand(String command, IShellOutputReceiver receiver)

CommandResult executeShellV2Command(String cmd)

CommandResult executeShellV2Command(String cmd, OutputStream pipeToOutput)

CommandResult executeShellV2Command(String cmd, File pipeAsInput)

CommandResult executeShellV2Command(String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

CommandResult executeShellV2Command(String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)

CommandResult executeShellV2Command(String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

CommandResult executeShellV2Command(String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)

CommandResult fastbootWipePartition(String partition)

getActiveApexes()

getAllSettings(String namespace)

DeviceAllocationState getAllocationState()
String getAndroidId(int userId)

getAndroidIds()

int getApiLevel()

PackageInfo getAppPackageInfo(String packageName)

getAppPackageInfos()

String getBasebandVersion()
Integer getBattery()

boolean getBooleanProperty(String name, boolean defaultValue)

getBootHistory()

getBootHistorySince(long utcEpochTime, TimeUnit timeUnit)

String getBootloaderVersion()

InputStreamSource getBugreport()

InputStreamSource getBugreportz()

String getBuildAlias()

String getBuildFlavor()

String getBuildId()

String getBuildSigningKeys()

DeviceDescriptor getCachedDeviceDescriptor()

String[] getChildren(String path)

DeviceFoldableState getCurrentFoldableState()
int getCurrentUser()

String getDeviceClass()

long getDeviceDate()

DeviceDescriptor getDeviceDescriptor()

TestDeviceState getDeviceState()

long getDeviceTimeOffset(Date date)

InputStreamSource getEmulatorOutput()

Process getEmulatorProcess()

final File getExecuteShellCommandLog()

The log that contains all the executeShellCommand(String) logs.

long getExternalStoreFreeSpace()

String getFastbootPath()

String getFastbootProductType()

String getFastbootProductVariant()

String getFastbootSerialNumber()

String getFastbootVariable(String variableName)

String getFastbootVersion()

IFileEntry getFileEntry(String path)

IFileEntry getFileEntry(FileListingService.FileEntry entry)

Unofficial helper to get a FileEntry from a non-root path.

getFoldableStates()
IDevice getIDevice()

getInstalledPackageNames()

long getIntProperty(String name, long defaultValue)

String getIpAddress()

KeyguardControllerState getKeyguardState()

long getLastExpectedRebootTimeMillis()

int getLaunchApiLevel()

InputStreamSource getLogcat()

InputStreamSource getLogcat(int maxBytes)

InputStreamSource getLogcatDump()

InputStreamSource getLogcatSince(long date)

String getMacAddress()

getMainlineModuleInfo()

int getMaxNumberOfRunningUsersSupported()
int getMaxNumberOfUsersSupported()

IDeviceStateMonitor getMonitor()
String getMountPoint(String mountName)

ITestDevice.MountPointInfo getMountPointInfo(String mountpoint)

getMountPointInfo()

TestDeviceOptions getOptions()

long getPartitionFreeSpace(String partition)

Integer getPrimaryUserId()

ProcessInfo getProcessByName(String processName)

String getProcessPid(String process)

String getProductType()

String getProductVariant()

String getProperty(String name)

ITestDevice.RecoveryMode getRecoveryMode()

InputStreamSource getScreenshot(String format)

InputStreamSource getScreenshot(long displayId)

InputStreamSource getScreenshot(String format, boolean rescale)

InputStreamSource getScreenshot()

String getSerialNumber()

String getSetting(int userId, String namespace, String key)

String getSetting(String namespace, String key)

String getSimOperator()

String getSimState()

getTombstones()

long getTotalMemory()

getUninstallablePackageNames()

boolean getUseFastbootErase()

int getUserFlags(int userId)

getUserInfos()

int getUserSerialNumber(int userId)

IManagedTestDevice.DeviceEventResponse handleAllocationEvent(DeviceEvent event)

Process the DeviceEvent, which may or may not transition this device to a new allocation state.

boolean hasFeature(String feature)

String installPackage(File packageFile, boolean reinstall, String... extraArgs)

String installPackage(File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)

String installPackageForUser(File packageFile, boolean reinstall, int userId, String... extraArgs)

String installPackageForUser(File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)

boolean isAdbRoot()

boolean isAdbTcp()
boolean isAppEnumerationSupported()

boolean isDeviceEncrypted()

boolean isDirectory(String path)

boolean isEnableAdbRoot()
boolean isEncryptionSupported()

boolean isExecutable(String fullPath)

boolean isFastbootEnabled()

boolean isHeadless()

boolean isMultiUserSupported()

boolean isPackageInstalled(String packageName, String userId)

boolean isPackageInstalled(String packageName)

boolean isRuntimePermissionSupported()

boolean isStateBootloaderOrFastbootd()

boolean isUserRunning(int userId)

boolean isUserSecondary(int userId)

boolean isWifiEnabled()

listDisplayIds()

listUsers()

boolean logBugreport(String dataName, ITestLogger listener)

void logOnDevice(String tag, Log.LogLevel level, String format, Object... args)

void nonBlockingReboot()

void postAdbRootAction()

Override if the device needs some specific actions to be taken after adb root and before the device is back online.

void postAdbUnrootAction()

Override if the device needs some specific actions to be taken after adb unroot and before the device is back online.

void postBootSetup()

void postInvocationTearDown(Throwable exception)

void preInvocationSetup(IBuildInfo info, MultiMap<String, String> attributes)

boolean pullDir(String deviceFilePath, File localDir)

boolean pullFile(String remoteFilePath, File localFile)

File pullFile(String remoteFilePath)

String pullFileContents(String remoteFilePath)

File pullFileFromExternal(String remoteFilePath)

boolean pushDir(File localFileDir, String deviceFilePath, excludedDirectories)

boolean pushDir(File localFileDir, String deviceFilePath)

boolean pushFile(File localFile, String remoteFilePath)

boolean pushString(String contents, String remoteFilePath)

void reboot(String reason)

void reboot()

void rebootIntoBootloader()

void rebootIntoFastbootd()

void rebootIntoRecovery()

void rebootIntoSideload()

void rebootIntoSideload(boolean autoReboot)

void rebootUntilOnline()
void rebootUntilOnline(String reason)

void rebootUserspace()
void rebootUserspaceUntilOnline()
void recoverDevice()

Attempts to recover device communication.

void remountSystemWritable()

void remountVendorWritable()

boolean removeAdmin(String componentName, int userId)

void removeOwners()

boolean removeUser(int userId)

void resetContentProviderSetup()

Reset the flag for content provider setup in order to trigger it again.

boolean runInstrumentationTests(IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

boolean runInstrumentationTests(IRemoteAndroidTestRunner runner, listeners)

boolean runInstrumentationTestsAsUser(IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

boolean runInstrumentationTestsAsUser(IRemoteAndroidTestRunner runner, int userId, listeners)

void setConfiguration(IConfiguration configuration)

Injects the IConfiguration in use.

void setDate(Date date)

boolean setDeviceOwner(String componentName, int userId)

void setDeviceState(TestDeviceState deviceState)

void setEmulatorOutputStream(SizeLimitedOutputStream output)

For emulator set SizeLimitedOutputStream to log output

void setEmulatorProcess(Process p)

void setFastbootEnabled(boolean fastbootEnabled)

void setFastbootPath(String fastbootPath)

void setIDevice(IDevice newDevice)

void setOptions(TestDeviceOptions options)

boolean setProperty(String propKey, String propValue)

void setRecovery(IDeviceRecovery recovery)

void setRecoveryMode(ITestDevice.RecoveryMode mode)

void setSetting(String namespace, String key, String value)

void setSetting(int userId, String namespace, String key, String value)

void setUseFastbootErase(boolean useFastbootErase)

void startLogcat()

boolean startUser(int userId)

boolean startUser(int userId, boolean waitFlag)

void stopEmulatorOutput()

void stopLogcat()

boolean stopUser(int userId)

boolean stopUser(int userId, boolean waitFlag, boolean forceFlag)

String switchToAdbTcp()

boolean switchToAdbUsb()

boolean switchUser(int userId)

boolean switchUser(int userId, long timeout)

boolean syncFiles(File localFileDir, String deviceFilePath)

Bugreport takeBugreport()

boolean unencryptDevice()

String uninstallPackage(String packageName)

String uninstallPackageForUser(String packageName, int userId)

boolean unlockDevice()

boolean waitForBootComplete(long timeOut)

void waitForDeviceAvailable()

void waitForDeviceAvailable(long waitTime)

boolean waitForDeviceInRecovery(long waitTime)

boolean waitForDeviceInSideload(long waitTime)

boolean waitForDeviceNotAvailable(long waitTime)

void waitForDeviceOnline()

void waitForDeviceOnline(long waitTime)

boolean waitForDeviceShell(long waitTime)

Protected methods

void checkApiLevelAgainst(String feature, int strictMinLevel)
NativeDevice.RebootDeviceAction createRebootDeviceAction(NativeDevice.RebootMode rebootMode, String reason)

Create a RebootDeviceAction to be used when performing a reboot action.

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Perform a adb reboot.

void ensureRuntimePermissionSupported()

helper method to throw exception if runtime permission isn't supported

InputStreamSource getBugreportInternal()
File getBugreportzInternal()

Internal Helper method to get the bugreportz zip file as a ERROR(/File).

IRunUtil getRunUtil()

Get the RunUtil instance to use.

String internalGetProperty(String propName, String fastbootVar, String description)

Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.

boolean isNewer(File localFile, IFileEntry entry)

Return true if local file is newer than remote file.

boolean performDeviceAction(String actionDescription, com.android.tradefed.device.NativeDevice.DeviceAction action, int retryAttempts)

Performs an action on this device.

void postAdbReboot()

Possible extra actions that can be taken after a reboot.

void prePostBootSetup()

Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.

void setClock(Clock clock)

Set the Clock instance to use.

void setLogStartDelay(int delay)

Sets the time in ms to wait before starting logcat capture for a online device.

void waitForDeviceNotAvailable(String operationDesc, long time)

Constants

INVALID_USER_ID

public static final int INVALID_USER_ID

Value returned for any invalid/not found user id: UserHandle defined the -10000 value

Constant Value: -10000 (0xffffd8f0)

MAX_HOST_DEVICE_TIME_OFFSET

protected static final long MAX_HOST_DEVICE_TIME_OFFSET

Constant Value: 5000 (0x0000000000001388)

MAX_RETRY_ATTEMPTS

protected static final int MAX_RETRY_ATTEMPTS

the default number of command retry attempts to perform

Constant Value: 2 (0x00000002)

Fields

SD_CARD

protected static final String SD_CARD

STORAGE_EMULATED

protected static final String STORAGE_EMULATED

mOptions

protected TestDeviceOptions mOptions

mStateMonitor

protected final IDeviceStateMonitor mStateMonitor

Public constructors

NativeDevice

public NativeDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

Creates a TestDevice.

Parameters
device IDevice: the associated IDevice

stateMonitor IDeviceStateMonitor: the IDeviceStateMonitor mechanism to use

allocationMonitor IDeviceMonitor: the IDeviceMonitor to inform of allocation state changes. Can be null

Public methods

checkApiLevelAgainstNextRelease

public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

Parameters
strictMinLevel int

Returns
boolean

Throws
DeviceNotAvailableException

checkConnectivity

public boolean checkConnectivity ()

Returns
boolean

Throws
DeviceNotAvailableException

clearErrorDialogs

public boolean clearErrorDialogs ()

Returns
boolean

Throws
DeviceNotAvailableException

clearLastConnectedWifiNetwork

public void clearLastConnectedWifiNetwork ()

clearLogcat

public void clearLogcat ()

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

Parameters
wifiSsid String

wifiPsk String

Returns
boolean

Throws
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Parameters
wifiSsid String

wifiPsk String

scanSsid boolean

Returns
boolean

Throws
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Parameters
wifiSsid String

wifiPsk String

scanSsid boolean

Returns
boolean

Throws
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

Parameters
wifiSsid String

wifiPsk String

Returns
boolean

Throws
DeviceNotAvailableException

createUser

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral)

Parameters
name String

guest boolean

ephemeral boolean

Returns
int

Throws
DeviceNotAvailableException

createUser

public int createUser (String name)

Parameters
name String

Returns
int

Throws
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Parameters
name String

Returns
int

Throws
DeviceNotAvailableException

deleteFile

public void deleteFile (String deviceFilePath)

Parameters
deviceFilePath String

Throws
DeviceNotAvailableException

deviceSoftRestarted

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

Parameters
prevSystemServerProcess ProcessInfo

Returns
boolean

Throws
DeviceNotAvailableException

deviceSoftRestartedSince

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

Parameters
utcEpochTime long

timeUnit TimeUnit

Returns
boolean

Throws
DeviceNotAvailableException

disableAdbRoot

public boolean disableAdbRoot ()

Returns
boolean

Throws
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Throws
DeviceNotAvailableException

disableNetworkMonitor

public boolean disableNetworkMonitor ()

Returns
boolean

Throws
DeviceNotAvailableException

disconnectFromWifi

public boolean disconnectFromWifi ()

Returns
boolean

Throws
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Parameters
deviceFilePath String

Returns
boolean

Throws
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Parameters
process String

devicePath String

Returns
File

Throws
DeviceNotAvailableException

enableAdbRoot

public boolean enableAdbRoot ()

Returns
boolean

Throws
DeviceNotAvailableException

enableNetworkMonitor

public boolean enableNetworkMonitor ()

Returns
boolean

Throws
DeviceNotAvailableException

encryptDevice

public boolean encryptDevice (boolean inplace)

Parameters
inplace boolean

Returns
boolean

Throws
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (long timeout, 
                String... cmdArgs)

Parameters
timeout long

cmdArgs String

Returns
String

Throws
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (String... cmdArgs)

Parameters
cmdArgs String

Returns
String

Throws
DeviceNotAvailableException

executeFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

Parameters
cmdArgs String

Returns
CommandResult

Throws
DeviceNotAvailableException

executeFastbootCommand

public CommandResult executeFastbootCommand (long timeout, 
                String... cmdArgs)

Parameters
timeout long

cmdArgs String

Returns
CommandResult

Throws
DeviceNotAvailableException

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

Parameters
cmdArgs String

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellCommand

public String executeShellCommand (String command)

Parameters
command String

Returns
String

Throws
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Parameters
command String

receiver IShellOutputReceiver

maxTimeToOutputShellResponse long

timeUnit TimeUnit

retryAttempts int

Throws
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver, 
                long maxTimeoutForCommand, 
                long maxTimeToOutputShellResponse, 
                TimeUnit timeUnit, 
                int retryAttempts)

Parameters
command String

receiver IShellOutputReceiver

maxTimeoutForCommand long

maxTimeToOutputShellResponse long

timeUnit TimeUnit

retryAttempts int

Throws
DeviceNotAvailableException

executeShellCommand

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

Parameters
command String

receiver IShellOutputReceiver

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd)

Parameters
cmd String

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

Parameters
cmd String

pipeToOutput OutputStream

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

Parameters
cmd String

pipeAsInput File

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Parameters
cmd String

maxTimeoutForCommand long

timeUnit TimeUnit

retryAttempts int

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit)

Parameters
cmd String

maxTimeoutForCommand long

timeUnit TimeUnit

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Parameters
cmd String

pipeAsInput File

pipeToOutput OutputStream

maxTimeoutForCommand long

timeUnit TimeUnit

retryAttempts int

Returns
CommandResult

Throws
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput, 
                OutputStream pipeToOutput, 
                OutputStream pipeToError, 
                long maxTimeoutForCommand, 
                TimeUnit timeUnit, 
                int retryAttempts)

Parameters
cmd String

pipeAsInput File

pipeToOutput OutputStream

pipeToError OutputStream

maxTimeoutForCommand long

timeUnit TimeUnit

retryAttempts int

Returns
CommandResult

Throws
DeviceNotAvailableException

fastbootWipePartition

public CommandResult fastbootWipePartition (String partition)

Parameters
partition String

Returns
CommandResult

Throws
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Returns

Throws
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Parameters
namespace String

Returns

Throws
DeviceNotAvailableException

getAllocationState

public DeviceAllocationState getAllocationState ()

Returns
DeviceAllocationState

getAndroidId

public String getAndroidId (int userId)

Parameters
userId int

Returns
String

Throws
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Returns

Throws
DeviceNotAvailableException

getApiLevel

public int getApiLevel ()

Returns
int

Throws
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Parameters
packageName String

Returns
PackageInfo

Throws
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Returns

Throws
DeviceNotAvailableException

getBasebandVersion

public String getBasebandVersion ()

Returns
String

Throws
DeviceNotAvailableException

getBattery

public Integer getBattery ()

Returns
Integer

getBooleanProperty

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

Parameters
name String

defaultValue boolean

Returns
boolean

Throws
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

Returns

Throws
DeviceNotAvailableException

getBootHistorySince

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

Parameters
utcEpochTime long

timeUnit TimeUnit

Returns

Throws
DeviceNotAvailableException

getBootloaderVersion

public String getBootloaderVersion ()

Returns
String

Throws
DeviceNotAvailableException

getBugreport

public InputStreamSource getBugreport ()

Returns
InputStreamSource

getBugreportz

public InputStreamSource getBugreportz ()

Returns
InputStreamSource

getBuildAlias

public String getBuildAlias ()

Returns
String

Throws
DeviceNotAvailableException

getBuildFlavor

public String getBuildFlavor ()

Returns
String

Throws
DeviceNotAvailableException

getBuildId

public String getBuildId ()

Returns
String

Throws
DeviceNotAvailableException

getBuildSigningKeys

public String getBuildSigningKeys ()

Returns
String

Throws
DeviceNotAvailableException

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor ()

Returns
DeviceDescriptor

getChildren

public String[] getChildren (String path)

Parameters
path String

Returns
String[]

Throws
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Returns
DeviceFoldableState

Throws
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Returns
int

Throws
DeviceNotAvailableException

getDeviceClass

public String getDeviceClass ()

Returns
String

getDeviceDate

public long getDeviceDate ()

Returns
long

Throws
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

Returns
DeviceDescriptor

getDeviceState

public TestDeviceState getDeviceState ()

Returns
TestDeviceState

getDeviceTimeOffset

public long getDeviceTimeOffset (Date date)

Parameters
date Date

Returns
long

Throws
DeviceNotAvailableException

getEmulatorOutput

public InputStreamSource getEmulatorOutput ()

Returns
InputStreamSource

getEmulatorProcess

public Process getEmulatorProcess ()

Returns
Process

getExecuteShellCommandLog

public final File getExecuteShellCommandLog ()

The log that contains all the executeShellCommand(String) logs.

Returns
File

getExternalStoreFreeSpace

public long getExternalStoreFreeSpace ()

Returns
long

Throws
DeviceNotAvailableException

getFastbootPath

public String getFastbootPath ()

Returns
String

getFastbootProductType

public String getFastbootProductType ()

Returns
String

Throws
DeviceNotAvailableException

getFastbootProductVariant

public String getFastbootProductVariant ()

Returns
String

Throws
DeviceNotAvailableException

getFastbootSerialNumber

public String getFastbootSerialNumber ()

Returns
String

getFastbootVariable

public String getFastbootVariable (String variableName)

Parameters
variableName String

Returns
String

Throws
DeviceNotAvailableException

getFastbootVersion

public String getFastbootVersion ()

Returns
String

getFileEntry

public IFileEntry getFileEntry (String path)

Parameters
path String

Returns
IFileEntry

Throws
DeviceNotAvailableException

getFileEntry

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

Unofficial helper to get a FileEntry from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).

Parameters
entry FileListingService.FileEntry: a FileEntry not necessarily root as Ddmlib requires.

Returns
IFileEntry a FileEntryWrapper representing the FileEntry.

Throws
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Returns

Throws
DeviceNotAvailableException

getIDevice

public IDevice getIDevice ()

Returns
IDevice

getInstalledPackageNames

public  getInstalledPackageNames ()

Returns

Throws
DeviceNotAvailableException

getIntProperty

public long getIntProperty (String name, 
                long defaultValue)

Parameters
name String

defaultValue long

Returns
long

Throws
DeviceNotAvailableException

getIpAddress

public String getIpAddress ()

Returns
String

Throws
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Returns
KeyguardControllerState

Throws
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

Returns
long

getLaunchApiLevel

public int getLaunchApiLevel ()

Returns
int

Throws
DeviceNotAvailableException

getLogcat

public InputStreamSource getLogcat ()

Returns
InputStreamSource

getLogcat

public InputStreamSource getLogcat (int maxBytes)

Parameters
maxBytes int

Returns
InputStreamSource

getLogcatDump

public InputStreamSource getLogcatDump ()

Returns
InputStreamSource

getLogcatSince

public InputStreamSource getLogcatSince (long date)

Parameters
date long

Returns
InputStreamSource

getMacAddress

public String getMacAddress ()

Returns
String

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Returns

Throws
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Returns
int

Throws
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Returns
int

Throws
DeviceNotAvailableException

getMonitor

public IDeviceStateMonitor getMonitor ()

Returns
IDeviceStateMonitor

getMountPoint

public String getMountPoint (String mountName)

Parameters
mountName String

Returns
String

getMountPointInfo

public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

Parameters
mountpoint String

Returns
ITestDevice.MountPointInfo

Throws
DeviceNotAvailableException

getMountPointInfo

public  getMountPointInfo ()

Returns

Throws
DeviceNotAvailableException

getOptions

public TestDeviceOptions getOptions ()

Returns
TestDeviceOptions

getPartitionFreeSpace

public long getPartitionFreeSpace (String partition)

Parameters
partition String

Returns
long

Throws
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Returns
Integer

Throws
DeviceNotAvailableException

getProcessByName

public ProcessInfo getProcessByName (String processName)

Parameters
processName String

Returns
ProcessInfo

Throws
DeviceNotAvailableException

getProcessPid

public String getProcessPid (String process)

Parameters
process String

Returns
String

Throws
DeviceNotAvailableException

getProductType

public String getProductType ()

Returns
String

Throws
DeviceNotAvailableException

getProductVariant

public String getProductVariant ()

Returns
String

Throws
DeviceNotAvailableException

getProperty

public String getProperty (String name)

Parameters
name String

Returns
String

Throws
DeviceNotAvailableException

getRecoveryMode

public ITestDevice.RecoveryMode getRecoveryMode ()

Returns
ITestDevice.RecoveryMode

getScreenshot

public InputStreamSource getScreenshot (String format)

Parameters
format String

Returns
InputStreamSource

Throws
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Parameters
displayId long

Returns
InputStreamSource

Throws
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Parameters
format String

rescale boolean

Returns
InputStreamSource

Throws
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Returns
InputStreamSource

Throws
DeviceNotAvailableException

getSerialNumber

public String getSerialNumber ()

Returns
String

getSetting

public String getSetting (int userId, 
                String namespace, 
                String key)

Parameters
userId int

namespace String

key String

Returns
String

Throws
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Parameters
namespace String

key String

Returns
String

Throws
DeviceNotAvailableException

getSimOperator

public String getSimOperator ()

Returns
String

getSimState

public String getSimState ()

Returns
String

getTombstones

public  getTombstones ()

Returns

Throws
DeviceNotAvailableException

getTotalMemory

public long getTotalMemory ()

Returns
long

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Returns

Throws
DeviceNotAvailableException

getUseFastbootErase

public boolean getUseFastbootErase ()

Returns
boolean

getUserFlags

public int getUserFlags (int userId)

Parameters
userId int

Returns
int

Throws
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Returns

Throws
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Parameters
userId int

Returns
int

Throws
DeviceNotAvailableException

handleAllocationEvent

public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

Process the DeviceEvent, which may or may not transition this device to a new allocation state.

Parameters
event DeviceEvent

Returns
IManagedTestDevice.DeviceEventResponse

hasFeature

public boolean hasFeature (String feature)

Parameters
feature String

Returns
boolean

Throws
DeviceNotAvailableException

installPackage

public String installPackage (File packageFile, 
                boolean reinstall, 
                String... extraArgs)

Parameters
packageFile File

reinstall boolean

extraArgs String

Returns
String

Throws
DeviceNotAvailableException

installPackage

public String installPackage (File packageFile, 
                boolean reinstall, 
                boolean grantPermissions, 
                String... extraArgs)

Parameters
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Returns
String

Throws
DeviceNotAvailableException

installPackageForUser

public String installPackageForUser (File packageFile, 
                boolean reinstall, 
                int userId, 
                String... extraArgs)

Parameters
packageFile File

reinstall boolean

userId int

extraArgs String

Returns
String

Throws
DeviceNotAvailableException

installPackageForUser

public String installPackageForUser (File packageFile, 
                boolean reinstall, 
                boolean grantPermissions, 
                int userId, 
                String... extraArgs)

Parameters
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Returns
String

Throws
DeviceNotAvailableException

isAdbRoot

public boolean isAdbRoot ()

Returns
boolean

Throws
DeviceNotAvailableException

isAdbTcp

public boolean isAdbTcp ()

Returns
boolean

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Returns
boolean

Throws
DeviceNotAvailableException

isDeviceEncrypted

public boolean isDeviceEncrypted ()

Returns
boolean

Throws
DeviceNotAvailableException

isDirectory

public boolean isDirectory (String path)

Parameters
path String

Returns
boolean

Throws
DeviceNotAvailableException

isEnableAdbRoot

public boolean isEnableAdbRoot ()

Returns
boolean true if adb root should be enabled on device

isEncryptionSupported

public boolean isEncryptionSupported ()

Returns
boolean

Throws
DeviceNotAvailableException

isExecutable

public boolean isExecutable (String fullPath)

Parameters
fullPath String

Returns
boolean

Throws
DeviceNotAvailableException

isFastbootEnabled

public boolean isFastbootEnabled ()

Returns
boolean

isHeadless

public boolean isHeadless ()

Returns
boolean

Throws
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Returns
boolean

Throws
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Parameters
packageName String

userId String

Returns
boolean

Throws
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Parameters
packageName String

Returns
boolean

Throws
DeviceNotAvailableException

isRuntimePermissionSupported

public boolean isRuntimePermissionSupported ()

Returns
boolean

Throws
DeviceNotAvailableException

isStateBootloaderOrFastbootd

public boolean isStateBootloaderOrFastbootd ()

Returns
boolean

isUserRunning

public boolean isUserRunning (int userId)

Parameters
userId int

Returns
boolean

Throws
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Parameters
userId int

Returns
boolean

Throws
DeviceNotAvailableException

isWifiEnabled

public boolean isWifiEnabled ()

Returns
boolean

Throws
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Returns

Throws
DeviceNotAvailableException

listUsers

public  listUsers ()

Returns

Throws
DeviceNotAvailableException

logBugreport

public boolean logBugreport (String dataName, 
                ITestLogger listener)

Parameters
dataName String

listener ITestLogger

Returns
boolean

logOnDevice

public void logOnDevice (String tag, 
                Log.LogLevel level, 
                String format, 
                Object... args)

Parameters
tag String

level Log.LogLevel

format String

args Object

nonBlockingReboot

public void nonBlockingReboot ()

Throws
DeviceNotAvailableException

postAdbRootAction

public void postAdbRootAction ()

Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.

Throws
DeviceNotAvailableException

postAdbUnrootAction

public void postAdbUnrootAction ()

Override if the device needs some specific actions to be taken after adb unroot and before the device is back online. Default implementation doesn't include any additional actions. adb root is not guaranteed to be disabled at this stage.

Throws
DeviceNotAvailableException

postBootSetup

public void postBootSetup ()

Throws
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Parameters
exception Throwable

preInvocationSetup

public void preInvocationSetup (IBuildInfo info, 
                MultiMap<String, String> attributes)

Parameters
info IBuildInfo

attributes MultiMap

Throws
DeviceNotAvailableException
TargetSetupError

pullDir

public boolean pullDir (String deviceFilePath, 
                File localDir)

Parameters
deviceFilePath String

localDir File

Returns
boolean

Throws
DeviceNotAvailableException

pullFile

public boolean pullFile (String remoteFilePath, 
                File localFile)

Parameters
remoteFilePath String

localFile File

Returns
boolean

Throws
DeviceNotAvailableException

pullFile

public File pullFile (String remoteFilePath)

Parameters
remoteFilePath String

Returns
File

Throws
DeviceNotAvailableException

pullFileContents

public String pullFileContents (String remoteFilePath)

Parameters
remoteFilePath String

Returns
String

Throws
DeviceNotAvailableException

pullFileFromExternal

public File pullFileFromExternal (String remoteFilePath)

Parameters
remoteFilePath String

Returns
File

Throws
DeviceNotAvailableException

pushDir

public boolean pushDir (File localFileDir, 
                String deviceFilePath, 
                 excludedDirectories)

Parameters
localFileDir File

deviceFilePath String

excludedDirectories

Returns
boolean

Throws
DeviceNotAvailableException

pushDir

public boolean pushDir (File localFileDir, 
                String deviceFilePath)

Parameters
localFileDir File

deviceFilePath String

Returns
boolean

Throws
DeviceNotAvailableException

pushFile

public boolean pushFile (File localFile, 
                String remoteFilePath)

Parameters
localFile File

remoteFilePath String

Returns
boolean

Throws
DeviceNotAvailableException

pushString

public boolean pushString (String contents, 
                String remoteFilePath)

Parameters
contents String

remoteFilePath String

Returns
boolean

Throws
DeviceNotAvailableException

reboot

public void reboot (String reason)

Parameters
reason String

Throws
DeviceNotAvailableException

reboot

public void reboot ()

Throws
DeviceNotAvailableException

rebootIntoBootloader

public void rebootIntoBootloader ()

Throws
DeviceNotAvailableException

rebootIntoFastbootd

public void rebootIntoFastbootd ()

Throws
DeviceNotAvailableException

rebootIntoRecovery

public void rebootIntoRecovery ()

Throws
DeviceNotAvailableException

rebootIntoSideload

public void rebootIntoSideload ()

Throws
DeviceNotAvailableException

rebootIntoSideload

public void rebootIntoSideload (boolean autoReboot)

Parameters
autoReboot boolean

Throws
DeviceNotAvailableException

rebootUntilOnline

public void rebootUntilOnline ()

Throws
DeviceNotAvailableException

rebootUntilOnline

public void rebootUntilOnline (String reason)

Parameters
reason String

Throws
DeviceNotAvailableException

rebootUserspace

public void rebootUserspace ()

Throws
DeviceNotAvailableException

rebootUserspaceUntilOnline

public void rebootUserspaceUntilOnline ()

Throws
DeviceNotAvailableException

recoverDevice

public void recoverDevice ()

Attempts to recover device communication.

Throws
DeviceNotAvailableException if device is no longer available

remountSystemWritable

public void remountSystemWritable ()

Throws
DeviceNotAvailableException

remountVendorWritable

public void remountVendorWritable ()

Throws
DeviceNotAvailableException

removeAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Parameters
componentName String

userId int

Returns
boolean

Throws
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Throws
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Parameters
userId int

Returns
boolean

Throws
DeviceNotAvailableException

resetContentProviderSetup

public void resetContentProviderSetup ()

Reset the flag for content provider setup in order to trigger it again.

runInstrumentationTests

public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                ITestLifeCycleReceiver... listeners)

Parameters
runner IRemoteAndroidTestRunner

listeners ITestLifeCycleReceiver

Returns
boolean

Throws
DeviceNotAvailableException

runInstrumentationTests

public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                 listeners)

Parameters
runner IRemoteAndroidTestRunner

listeners

Returns
boolean

Throws
DeviceNotAvailableException

runInstrumentationTestsAsUser

public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                int userId, 
                ITestLifeCycleReceiver... listeners)

Parameters
runner IRemoteAndroidTestRunner

userId int

listeners ITestLifeCycleReceiver

Returns
boolean

Throws
DeviceNotAvailableException

runInstrumentationTestsAsUser

public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, 
                int userId, 
                 listeners)

Parameters
runner IRemoteAndroidTestRunner

userId int

listeners

Returns
boolean

Throws
DeviceNotAvailableException

setConfiguration

public void setConfiguration (IConfiguration configuration)

Injects the IConfiguration in use.

Parameters
configuration IConfiguration

setDate

public void setDate (Date date)

Parameters
date Date

Throws
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Parameters
componentName String

userId int

Returns
boolean

Throws
DeviceNotAvailableException

setDeviceState

public void setDeviceState (TestDeviceState deviceState)

Parameters
deviceState TestDeviceState

setEmulatorOutputStream

public void setEmulatorOutputStream (SizeLimitedOutputStream output)

For emulator set SizeLimitedOutputStream to log output

Parameters
output SizeLimitedOutputStream: to log the output

setEmulatorProcess

public void setEmulatorProcess (Process p)

Parameters
p Process

setFastbootEnabled

public void setFastbootEnabled (boolean fastbootEnabled)

Parameters
fastbootEnabled boolean

setFastbootPath

public void setFastbootPath (String fastbootPath)

Parameters
fastbootPath String

setIDevice

public void setIDevice (IDevice newDevice)

Parameters
newDevice IDevice

setOptions

public void setOptions (TestDeviceOptions options)

Parameters
options TestDeviceOptions

setProperty

public boolean setProperty (String propKey, 
                String propValue)

Parameters
propKey String

propValue String

Returns
boolean

Throws
DeviceNotAvailableException

setRecovery

public void setRecovery (IDeviceRecovery recovery)

Parameters
recovery IDeviceRecovery

setRecoveryMode

public void setRecoveryMode (ITestDevice.RecoveryMode mode)

Parameters
mode ITestDevice.RecoveryMode

setSetting

public void setSetting (String namespace, 
                String key, 
                String value)

Parameters
namespace String

key String

value String

Throws
DeviceNotAvailableException

setSetting

public void setSetting (int userId, 
                String namespace, 
                String key, 
                String value)

Parameters
userId int

namespace String

key String

value String

Throws
DeviceNotAvailableException

setUseFastbootErase

public void setUseFastbootErase (boolean useFastbootErase)

Parameters
useFastbootErase boolean

startLogcat

public void startLogcat ()

startUser

public boolean startUser (int userId)

Parameters
userId int

Returns
boolean

Throws
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Parameters
userId int

waitFlag boolean

Returns
boolean

Throws
DeviceNotAvailableException

stopEmulatorOutput

public void stopEmulatorOutput ()

stopLogcat

public void stopLogcat ()

stopUser

public boolean stopUser (int userId)

Parameters
userId int

Returns
boolean

Throws
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId, 
                boolean waitFlag, 
                boolean forceFlag)

Parameters
userId int

waitFlag boolean

forceFlag boolean

Returns
boolean

Throws
DeviceNotAvailableException

switchToAdbTcp

public String switchToAdbTcp ()

Returns
String

Throws
DeviceNotAvailableException

switchToAdbUsb

public boolean switchToAdbUsb ()

Returns
boolean

Throws
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Parameters
userId int

Returns
boolean

Throws
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Parameters
userId int

timeout long

Returns
boolean

Throws
DeviceNotAvailableException

syncFiles

public boolean syncFiles (File localFileDir, 
                String deviceFilePath)

Parameters
localFileDir File

deviceFilePath String

Returns
boolean

Throws
DeviceNotAvailableException

takeBugreport

public Bugreport takeBugreport ()

Returns
Bugreport

unencryptDevice

public boolean unencryptDevice ()

Returns
boolean

Throws
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Parameters
packageName String

Returns
String

Throws
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Parameters
packageName String

userId int

Returns
String

Throws
DeviceNotAvailableException

unlockDevice

public boolean unlockDevice ()

Returns
boolean

Throws
DeviceNotAvailableException

waitForBootComplete

public boolean waitForBootComplete (long timeOut)

Parameters
timeOut long

Returns
boolean

Throws
DeviceNotAvailableException

waitForDeviceAvailable

public void waitForDeviceAvailable ()

Throws
DeviceNotAvailableException

waitForDeviceAvailable

public void waitForDeviceAvailable (long waitTime)

Parameters
waitTime long

Throws
DeviceNotAvailableException

waitForDeviceInRecovery

public boolean waitForDeviceInRecovery (long waitTime)

Parameters
waitTime long

Returns
boolean

waitForDeviceInSideload

public boolean waitForDeviceInSideload (long waitTime)

Parameters
waitTime long

Returns
boolean

waitForDeviceNotAvailable

public boolean waitForDeviceNotAvailable (long waitTime)

Parameters
waitTime long

Returns
boolean

waitForDeviceOnline

public void waitForDeviceOnline ()

Throws
DeviceNotAvailableException

waitForDeviceOnline

public void waitForDeviceOnline (long waitTime)

Parameters
waitTime long

Throws
DeviceNotAvailableException

waitForDeviceShell

public boolean waitForDeviceShell (long waitTime)

Parameters
waitTime long

Returns
boolean

Protected methods

checkApiLevelAgainst

protected void checkApiLevelAgainst (String feature, 
                int strictMinLevel)

Parameters
feature String

strictMinLevel int

createRebootDeviceAction

protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, 
                String reason)

Create a RebootDeviceAction to be used when performing a reboot action.

Parameters
rebootMode NativeDevice.RebootMode: a mode of this reboot.

reason String: for this reboot.

Returns
NativeDevice.RebootDeviceAction the created RebootDeviceAction.

doAdbReboot

protected void doAdbReboot (NativeDevice.RebootMode rebootMode, 
                String reason)

Perform a adb reboot.

Parameters
rebootMode NativeDevice.RebootMode: a mode of this reboot.

reason String: for this reboot.

Throws
DeviceNotAvailableException

ensureRuntimePermissionSupported

protected void ensureRuntimePermissionSupported ()

helper method to throw exception if runtime permission isn't supported

Throws
DeviceNotAvailableException

getBugreportInternal

protected InputStreamSource getBugreportInternal ()

Returns
InputStreamSource

getBugreportzInternal

protected File getBugreportzInternal ()

Internal Helper method to get the bugreportz zip file as a ERROR(/File).

Returns
File

getRunUtil

protected IRunUtil getRunUtil ()

Get the RunUtil instance to use.

Returns
IRunUtil

internalGetProperty

protected String internalGetProperty (String propName, 
                String fastbootVar, 
                String description)

Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.

Parameters
propName String: The name of the device property as returned by `adb shell getprop`

fastbootVar String: The name of the equivalent fastboot variable to query. if null, fastboot query will not be attempted

description String: A simple description of the variable. First letter should be capitalized.

Returns
String A string, possibly null or empty, containing the value of the given property

Throws
DeviceNotAvailableException

isNewer

protected boolean isNewer (File localFile, 
                IFileEntry entry)

Return true if local file is newer than remote file. IFileEntry being accurate to the minute, in case of equal times, the file will be considered newer.

Parameters
localFile File

entry IFileEntry

Returns
boolean

performDeviceAction

protected boolean performDeviceAction (String actionDescription, 
                com.android.tradefed.device.NativeDevice.DeviceAction action, 
                int retryAttempts)

Performs an action on this device. Attempts to recover device and optionally retry command if action fails.

Parameters
actionDescription String: a short description of action to be performed. Used for logging purposes only.

action com.android.tradefed.device.NativeDevice.DeviceAction: the action to be performed

retryAttempts int: the retry attempts to make for action if it fails but recovery succeeds

Returns
boolean true if action was performed successfully

Throws
DeviceNotAvailableException if recovery attempt fails or max attempts done without success

postAdbReboot

protected void postAdbReboot ()

Possible extra actions that can be taken after a reboot.

Throws
DeviceNotAvailableException

prePostBootSetup

protected void prePostBootSetup ()

Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.

Throws
DeviceNotAvailableException

setClock

protected void setClock (Clock clock)

Set the Clock instance to use.

Parameters
clock Clock

setLogStartDelay

protected void setLogStartDelay (int delay)

Sets the time in ms to wait before starting logcat capture for a online device.

Parameters
delay int: the delay in ms

waitForDeviceNotAvailable

protected void waitForDeviceNotAvailable (String operationDesc, 
                long time)

Parameters
operationDesc String

time long