嵌套類 |
---|
class | NativeDevice.AdbAction DeviceAction 用於運行操作系統“ adb ....”命令。 |
class | NativeDevice.AdbShellAction |
class | NativeDevice.RebootDeviceAction 用於重啟設備的DeviceAction 。 |
enum | NativeDevice.RebootMode 重新啟動的模式。 |
公開方法 |
---|
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 | 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) |
int | getCurrentUser () |
String | getDeviceClass () |
long | getDeviceDate () |
DeviceDescriptor | getDeviceDescriptor () |
TestDeviceState | getDeviceState () |
long | getDeviceTimeOffset (Date date) |
InputStreamSource | getEmulatorOutput () |
Process | getEmulatorProcess () |
final File | getExecuteShellCommandLog () 包含所有executeShellCommand(String) 日誌的日誌。 |
long | getExternalStoreFreeSpace () |
String | getFastbootPath () |
String | getFastbootProductType () |
String | getFastbootProductVariant () |
String | getFastbootVariable (String variableName) |
String | getFastbootVersion () |
IFileEntry | getFileEntry (String path) |
IFileEntry | getFileEntry (FileListingService.FileEntry entry) 從非根路徑獲取FileEntry 非官方幫助者。 |
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 () |
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) 處理DeviceEvent,它可能會或可能不會將此設備轉換為新的分配狀態。 |
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 () 如果設備需要在adb root之後且設備重新聯機之前執行一些特定的操作,則重寫。 |
void | postAdbUnrootAction () 如果設備需要在adb unroot之後且設備重新聯機之前執行某些特定操作,則覆蓋此參數。 |
void | postBootSetup () |
void | postInvocationTearDown (Throwable exception) |
void | preInvocationSetup (IBuildInfo info) |
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) 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 () 嘗試恢復設備通信。 |
void | remountSystemWritable () |
void | remountVendorWritable () |
boolean | removeAdmin (String componentName, int userId) |
void | removeOwners () |
boolean | removeUser (int userId) |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
void | setDate (Date date) |
boolean | setDeviceOwner (String componentName, int userId) |
void | setDeviceState (TestDeviceState deviceState) |
void | setEmulatorOutputStream ( SizeLimitedOutputStream output) 對於仿真器,將SizeLimitedOutputStream 設置為記錄輸出 |
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) |
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) |
常數
INVALID_USER_ID
public static final int INVALID_USER_ID
對於任何無效/未找到的用戶ID返回的值:UserHandle定義了-10000值
常數:-10000(0xffffd8f0)
MAX_HOST_DEVICE_TIME_OFFSET
protected static final long MAX_HOST_DEVICE_TIME_OFFSET
常數值:5000(0x0000000000001388)
MAX_RETRY_ATTEMPTS
第039章
默認的命令重試嘗試次數
常數值:2(0x00000002)
領域
SD卡
protected static final String SD_CARD
選項
protected TestDeviceOptions mOptions
mStateMonitor
protected final IDeviceStateMonitor mStateMonitor
公共建設者
本機設備
public NativeDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
創建一個TestDevice
。
公開方法
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
投擲 |
---|
DeviceNotAvailableException | |
checkConnectivity
public boolean checkConnectivity ()
投擲 |
---|
DeviceNotAvailableException | |
clearErrorDialogs
public boolean clearErrorDialogs ()
投擲 |
---|
DeviceNotAvailableException | |
clearLastConnectedWifiNetwork
public void clearLastConnectedWifiNetwork ()
clearLogcat
public void clearLogcat ()
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid,
String wifiPsk)
參量 |
---|
wifiSsid | String |
wifiPsk | String |
投擲 |
---|
DeviceNotAvailableException | |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid,
String wifiPsk,
boolean scanSsid)
參量 |
---|
wifiSsid | String |
wifiPsk | String |
scanSsid | boolean |
投擲 |
---|
DeviceNotAvailableException | |
需要時連接到Wifi網絡
public boolean connectToWifiNetworkIfNeeded (String wifiSsid,
String wifiPsk,
boolean scanSsid)
參量 |
---|
wifiSsid | String |
wifiPsk | String |
scanSsid | boolean |
投擲 |
---|
DeviceNotAvailableException | |
需要時連接到Wifi網絡
public boolean connectToWifiNetworkIfNeeded (String wifiSsid,
String wifiPsk)
參量 |
---|
wifiSsid | String |
wifiPsk | String |
投擲 |
---|
DeviceNotAvailableException | |
創建用戶
public int createUser (String name,
boolean guest,
boolean ephemeral)
參量 |
---|
name | String |
guest | boolean |
ephemeral | boolean |
投擲 |
---|
DeviceNotAvailableException | |
創建用戶
public int createUser (String name)
投擲 |
---|
DeviceNotAvailableException | |
createUserNoThrow
public int createUserNoThrow (String name)
投擲 |
---|
DeviceNotAvailableException | |
刪除文件
public void deleteFile (String deviceFilePath)
投擲 |
---|
DeviceNotAvailableException | |
deviceSoftRestarted
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
參量 |
---|
prevSystemServerProcess | ProcessInfo |
投擲 |
---|
DeviceNotAvailableException | |
deviceSoftRestartedSince
public boolean deviceSoftRestartedSince (long utcEpochTime,
TimeUnit timeUnit)
參量 |
---|
utcEpochTime | long |
timeUnit | TimeUnit |
投擲 |
---|
DeviceNotAvailableException | |
disableAdbRoot
public boolean disableAdbRoot ()
投擲 |
---|
DeviceNotAvailableException | |
disableKeyguard
public void disableKeyguard ()
投擲 |
---|
DeviceNotAvailableException | |
disableNetworkMonitor
public boolean disableNetworkMonitor ()
投擲 |
---|
DeviceNotAvailableException | |
從Wifi斷開
public boolean disconnectFromWifi ()
投擲 |
---|
DeviceNotAvailableException | |
didFileExist
public boolean doesFileExist (String deviceFilePath)
投擲 |
---|
DeviceNotAvailableException | |
dumpHeap
public File dumpHeap (String process,
String devicePath)
參量 |
---|
process | String |
devicePath | String |
投擲 |
---|
DeviceNotAvailableException | |
enableAdbRoot
public boolean enableAdbRoot ()
投擲 |
---|
DeviceNotAvailableException | |
enableNetworkMonitor
public boolean enableNetworkMonitor ()
投擲 |
---|
DeviceNotAvailableException | |
cryptoDevice
public boolean encryptDevice (boolean inplace)
投擲 |
---|
DeviceNotAvailableException | |
executeAdbCommand
public String executeAdbCommand (long timeout,
String... cmdArgs)
參量 |
---|
timeout | long |
cmdArgs | String |
投擲 |
---|
DeviceNotAvailableException | |
executeAdbCommand
public String executeAdbCommand (String... cmdArgs)
投擲 |
---|
DeviceNotAvailableException | |
executeFastbootCommand
public CommandResult executeFastbootCommand (String... cmdArgs)
投擲 |
---|
DeviceNotAvailableException | |
executeFastbootCommand
public CommandResult executeFastbootCommand (long timeout,
String... cmdArgs)
參量 |
---|
timeout | long |
cmdArgs | String |
投擲 |
---|
DeviceNotAvailableException | |
executeLongFastbootCommand
public CommandResult executeLongFastbootCommand (String... cmdArgs)
投擲 |
---|
DeviceNotAvailableException | |
executeShellCommand
public String executeShellCommand (String command)
投擲 |
---|
DeviceNotAvailableException | |
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeToOutputShellResponse,
TimeUnit timeUnit,
int retryAttempts)
參量 |
---|
command | String |
receiver | IShellOutputReceiver |
maxTimeToOutputShellResponse | long |
timeUnit | TimeUnit |
retryAttempts | int |
投擲 |
---|
DeviceNotAvailableException | |
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver,
long maxTimeoutForCommand,
long maxTimeToOutputShellResponse,
TimeUnit timeUnit,
int retryAttempts)
參量 |
---|
command | String |
receiver | IShellOutputReceiver |
maxTimeoutForCommand | long |
maxTimeToOutputShellResponse | long |
timeUnit | TimeUnit |
retryAttempts | int |
投擲 |
---|
DeviceNotAvailableException | |
executeShellCommand
public void executeShellCommand (String command,
IShellOutputReceiver receiver)
參量 |
---|
command | String |
receiver | IShellOutputReceiver |
投擲 |
---|
DeviceNotAvailableException | |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd)
投擲 |
---|
DeviceNotAvailableException | |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
OutputStream pipeToOutput)
參量 |
---|
cmd | String |
pipeToOutput | OutputStream |
投擲 |
---|
DeviceNotAvailableException | |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
File pipeAsInput)
參量 |
---|
cmd | String |
pipeAsInput | File |
投擲 |
---|
DeviceNotAvailableException | |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
long maxTimeoutForCommand,
TimeUnit timeUnit,
int retryAttempts)
參量 |
---|
cmd | String |
maxTimeoutForCommand | long |
timeUnit | TimeUnit |
retryAttempts | int |
投擲 |
---|
DeviceNotAvailableException | |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
long maxTimeoutForCommand,
TimeUnit timeUnit)
參量 |
---|
cmd | String |
maxTimeoutForCommand | long |
timeUnit | TimeUnit |
投擲 |
---|
DeviceNotAvailableException | |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd,
File pipeAsInput,
OutputStream pipeToOutput,
long maxTimeoutForCommand,
TimeUnit timeUnit,
int retryAttempts)
參量 |
---|
cmd | String |
pipeAsInput | File |
pipeToOutput | OutputStream |
maxTimeoutForCommand | long |
timeUnit | TimeUnit |
retryAttempts | int |
投擲 |
---|
DeviceNotAvailableException | |
fastbootWipePartition
public CommandResult fastbootWipePartition (String partition)
投擲 |
---|
DeviceNotAvailableException | |
getActiveApexes
public getActiveApexes ()
投擲 |
---|
DeviceNotAvailableException | |
getAllSettings
public getAllSettings (String namespace)
投擲 |
---|
DeviceNotAvailableException | |
getAllocationState
public DeviceAllocationState getAllocationState ()
getAndroidId
public String getAndroidId (int userId)
投擲 |
---|
DeviceNotAvailableException | |
getAndroidIds
public getAndroidIds ()
投擲 |
---|
DeviceNotAvailableException | |
getApiLevel
public int getApiLevel ()
投擲 |
---|
DeviceNotAvailableException | |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
投擲 |
---|
DeviceNotAvailableException | |
getAppPackageInfos
public getAppPackageInfos ()
投擲 |
---|
DeviceNotAvailableException | |
getBasebandVersion
public String getBasebandVersion ()
投擲 |
---|
DeviceNotAvailableException | |
getBattery
public Integer getBattery ()
getBooleanProperty
public boolean getBooleanProperty (String name,
boolean defaultValue)
參量 |
---|
name | String |
defaultValue | boolean |
投擲 |
---|
DeviceNotAvailableException | |
getBootHistory
public getBootHistory ()
投擲 |
---|
DeviceNotAvailableException | |
getBootHistorySince
public getBootHistorySince (long utcEpochTime,
TimeUnit timeUnit)
參量 |
---|
utcEpochTime | long |
timeUnit | TimeUnit |
投擲 |
---|
DeviceNotAvailableException | |
getBootloaderVersion
public String getBootloaderVersion ()
投擲 |
---|
DeviceNotAvailableException | |
getBugreport
public InputStreamSource getBugreport ()
getBugreportz
public InputStreamSource getBugreportz ()
getBuildAlias
public String getBuildAlias ()
投擲 |
---|
DeviceNotAvailableException | |
getBuildFlavor
public String getBuildFlavor ()
投擲 |
---|
DeviceNotAvailableException | |
getBuildId
public String getBuildId ()
投擲 |
---|
DeviceNotAvailableException | |
getBuildSigningKeys
public String getBuildSigningKeys ()
投擲 |
---|
DeviceNotAvailableException | |
getCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor ()
getChildren
public String[] getChildren (String path)
投擲 |
---|
DeviceNotAvailableException | |
getCurrentUser
public int getCurrentUser ()
投擲 |
---|
DeviceNotAvailableException | |
getDeviceClass
public String getDeviceClass ()
getDeviceDate
public long getDeviceDate ()
投擲 |
---|
DeviceNotAvailableException | |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
getDeviceState
public TestDeviceState getDeviceState ()
getDeviceTimeOffset
public long getDeviceTimeOffset (Date date)
投擲 |
---|
DeviceNotAvailableException | |
getEmulatorOutput
public InputStreamSource getEmulatorOutput ()
getEmulatorProcess
public Process getEmulatorProcess ()
getExternalStoreFreeSpace
public long getExternalStoreFreeSpace ()
投擲 |
---|
DeviceNotAvailableException | |
getFastbootPath
public String getFastbootPath ()
getFastbootProductType
public String getFastbootProductType ()
投擲 |
---|
DeviceNotAvailableException | |
getFastbootProductVariant
public String getFastbootProductVariant ()
投擲 |
---|
DeviceNotAvailableException | |
getFastbootVariable
public String getFastbootVariable (String variableName)
投擲 |
---|
DeviceNotAvailableException | |
getFastbootVersion
public String getFastbootVersion ()
getFileEntry
public IFileEntry getFileEntry (String path)
投擲 |
---|
DeviceNotAvailableException | |
getFileEntry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
從非根路徑獲取FileEntry
非官方幫助者。修復:重構FileEntry系統,使其可從任何路徑使用。 (甚至是非根用戶)。
參量 |
---|
entry | FileListingService.FileEntry :一個FileEntry 不一定是Ddmlib要求的根目錄。 |
投擲 |
---|
DeviceNotAvailableException | |
getIDevice
public IDevice getIDevice ()
getInstalledPackageNames
public getInstalledPackageNames ()
投擲 |
---|
DeviceNotAvailableException | |
getIntProperty
public long getIntProperty (String name,
long defaultValue)
參量 |
---|
name | String |
defaultValue | long |
投擲 |
---|
DeviceNotAvailableException | |
getIpAddress
public String getIpAddress ()
投擲 |
---|
DeviceNotAvailableException | |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
退貨 |
---|
KeyguardControllerState | |
投擲 |
---|
DeviceNotAvailableException | |
getLastExpectedRebootTimeMillis
public long getLastExpectedRebootTimeMillis ()
getLaunchApiLevel
public int getLaunchApiLevel ()
投擲 |
---|
DeviceNotAvailableException | |
getLogcat
public InputStreamSource getLogcat ()
getLogcat
public InputStreamSource getLogcat (int maxBytes)
getLogcatDump
public InputStreamSource getLogcatDump ()
getLogcatSince
public InputStreamSource getLogcatSince (long date)
getMacAddress
public String getMacAddress ()
public int getMaxNumberOfRunningUsersSupported ()
投擲 |
---|
DeviceNotAvailableException | |
public int getMaxNumberOfUsersSupported ()
投擲 |
---|
DeviceNotAvailableException | |
getMonitor
public IDeviceStateMonitor getMonitor ()
getMountPoint
public String getMountPoint (String mountName)
getMountPointInfo
public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
退貨 |
---|
ITestDevice.MountPointInfo | |
投擲 |
---|
DeviceNotAvailableException | |
getMountPointInfo
public getMountPointInfo ()
投擲 |
---|
DeviceNotAvailableException | |
getOptions
public TestDeviceOptions getOptions ()
getPartitionFreeSpace
public long getPartitionFreeSpace (String partition)
投擲 |
---|
DeviceNotAvailableException | |
getPrimaryUserId
public Integer getPrimaryUserId ()
投擲 |
---|
DeviceNotAvailableException | |
getProcessByName
public ProcessInfo getProcessByName (String processName)
投擲 |
---|
DeviceNotAvailableException | |
getProcessPid
public String getProcessPid (String process)
投擲 |
---|
DeviceNotAvailableException | |
getProductType
public String getProductType ()
投擲 |
---|
DeviceNotAvailableException | |
getProductVariant
public String getProductVariant ()
投擲 |
---|
DeviceNotAvailableException | |
getProperty
public String getProperty (String name)
投擲 |
---|
DeviceNotAvailableException | |
getRecoveryMode
public ITestDevice.RecoveryMode getRecoveryMode ()
退貨 |
---|
ITestDevice.RecoveryMode | |
getScreenshot
public InputStreamSource getScreenshot (String format)
投擲 |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
投擲 |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
參量 |
---|
format | String |
rescale | boolean |
投擲 |
---|
DeviceNotAvailableException | |
getScreenshot
public InputStreamSource getScreenshot ()
投擲 |
---|
DeviceNotAvailableException | |
getSerialNumber
public String getSerialNumber ()
getSetting
public String getSetting (int userId,
String namespace,
String key)
參量 |
---|
userId | int |
namespace | String |
key | String |
投擲 |
---|
DeviceNotAvailableException | |
getSetting
public String getSetting (String namespace,
String key)
參量 |
---|
namespace | String |
key | String |
投擲 |
---|
DeviceNotAvailableException | |
getSimOperator
public String getSimOperator ()
getSimState
public String getSimState ()
getTombstones
public getTombstones ()
投擲 |
---|
DeviceNotAvailableException | |
getTotalMemory
public long getTotalMemory ()
getUninstallablePackageNames
public getUninstallablePackageNames ()
投擲 |
---|
DeviceNotAvailableException | |
getUseFastbootErase
public boolean getUseFastbootErase ()
getUserFlags
public int getUserFlags (int userId)
投擲 |
---|
DeviceNotAvailableException | |
getUserInfos
public getUserInfos ()
投擲 |
---|
DeviceNotAvailableException | |
getUserSerialNumber
public int getUserSerialNumber (int userId)
投擲 |
---|
DeviceNotAvailableException | |
handleAllocationEvent
public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)
處理DeviceEvent,它可能會或可能不會將此設備轉換為新的分配狀態。
退貨 |
---|
IManagedTestDevice.DeviceEventResponse | |
hasFeature
public boolean hasFeature (String feature)
投擲 |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
參量 |
---|
packageFile | File |
reinstall | boolean |
extraArgs | String |
投擲 |
---|
DeviceNotAvailableException | |
installPackage
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
參量 |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
extraArgs | String |
投擲 |
---|
DeviceNotAvailableException | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
參量 |
---|
packageFile | File |
reinstall | boolean |
userId | int |
extraArgs | String |
投擲 |
---|
DeviceNotAvailableException | |
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
參量 |
---|
packageFile | File |
reinstall | boolean |
grantPermissions | boolean |
userId | int |
extraArgs | String |
投擲 |
---|
DeviceNotAvailableException | |
isAdbRoot
public boolean isAdbRoot ()
投擲 |
---|
DeviceNotAvailableException | |
isAdbTcp
public boolean isAdbTcp ()
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
投擲 |
---|
DeviceNotAvailableException | |
isDeviceEncrypted
public boolean isDeviceEncrypted ()
投擲 |
---|
DeviceNotAvailableException | |
isDirectory
public boolean isDirectory (String path)
投擲 |
---|
DeviceNotAvailableException | |
isEnableAdbRoot
public boolean isEnableAdbRoot ()
退貨 |
---|
boolean | 如果應在設備上啟用adb root,則為true |
isEncryptionSupported
public boolean isEncryptionSupported ()
投擲 |
---|
DeviceNotAvailableException | |
isExecutable
public boolean isExecutable (String fullPath)
投擲 |
---|
DeviceNotAvailableException | |
isFastbootEnabled
public boolean isFastbootEnabled ()
無頭
public boolean isHeadless ()
投擲 |
---|
DeviceNotAvailableException | |
isMultiUserSupported
public boolean isMultiUserSupported ()
投擲 |
---|
DeviceNotAvailableException | |
isPackage已安裝
public boolean isPackageInstalled (String packageName,
String userId)
參量 |
---|
packageName | String |
userId | String |
投擲 |
---|
DeviceNotAvailableException | |
isPackage已安裝
public boolean isPackageInstalled (String packageName)
投擲 |
---|
DeviceNotAvailableException | |
isRuntimePermissionSupported
public boolean isRuntimePermissionSupported ()
投擲 |
---|
DeviceNotAvailableException | |
isStateBootloaderOrFastbootd
public boolean isStateBootloaderOrFastbootd ()
isUserRunning
public boolean isUserRunning (int userId)
投擲 |
---|
DeviceNotAvailableException | |
isUserSecondary
public boolean isUserSecondary (int userId)
投擲 |
---|
DeviceNotAvailableException | |
isWifiEnabled
public boolean isWifiEnabled ()
投擲 |
---|
DeviceNotAvailableException | |
listDisplayIds
public listDisplayIds ()
投擲 |
---|
DeviceNotAvailableException | |
listUsers
public listUsers ()
投擲 |
---|
DeviceNotAvailableException | |
logBugreport
public boolean logBugreport (String dataName,
ITestLogger listener)
參量 |
---|
dataName | String |
listener | ITestLogger |
logOnDevice
public void logOnDevice (String tag,
Log.LogLevel level,
String format,
Object... args)
參量 |
---|
tag | String |
level | Log.LogLevel |
format | String |
args | Object |
nonBlockingReboot
public void nonBlockingReboot ()
投擲 |
---|
DeviceNotAvailableException | |
postAdbRootAction
public void postAdbRootAction ()
如果設備需要在adb root之後且設備重新聯機之前執行一些特定的操作,則重寫。默認實現不包含任何其他操作。不保證在此階段啟用adb root。
投擲 |
---|
DeviceNotAvailableException | |
postAdbUnrootAction
public void postAdbUnrootAction ()
如果設備需要在adb unroot之後且設備重新聯機之前執行某些特定操作,則覆蓋此參數。默認實現不包含任何其他操作。不能保證在此階段禁用adb root。
投擲 |
---|
DeviceNotAvailableException | |
postBootSetup
public void postBootSetup ()
投擲 |
---|
DeviceNotAvailableException | |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
preInvocationSetup
public void preInvocationSetup (IBuildInfo info)
投擲 |
---|
DeviceNotAvailableException | |
TargetSetupError | |
pullDir
public boolean pullDir (String deviceFilePath,
File localDir)
參量 |
---|
deviceFilePath | String |
localDir | File |
投擲 |
---|
DeviceNotAvailableException | |
pullFile
public boolean pullFile (String remoteFilePath,
File localFile)
參量 |
---|
remoteFilePath | String |
localFile | File |
投擲 |
---|
DeviceNotAvailableException | |
pullFile
public File pullFile (String remoteFilePath)
投擲 |
---|
DeviceNotAvailableException | |
pullFileContents
public String pullFileContents (String remoteFilePath)
投擲 |
---|
DeviceNotAvailableException | |
pullFileFromExternal
public File pullFileFromExternal (String remoteFilePath)
投擲 |
---|
DeviceNotAvailableException | |
pushDir
public boolean pushDir (File localFileDir,
String deviceFilePath,
excludedDirectories)
參量 |
---|
localFileDir | File |
deviceFilePath | String |
excludedDirectories | |
投擲 |
---|
DeviceNotAvailableException | |
pushDir
public boolean pushDir (File localFileDir,
String deviceFilePath)
參量 |
---|
localFileDir | File |
deviceFilePath | String |
投擲 |
---|
DeviceNotAvailableException | |
pushFile
public boolean pushFile (File localFile,
String remoteFilePath)
參量 |
---|
localFile | File |
remoteFilePath | String |
投擲 |
---|
DeviceNotAvailableException | |
pushString
public boolean pushString (String contents,
String remoteFilePath)
參量 |
---|
contents | String |
remoteFilePath | String |
投擲 |
---|
DeviceNotAvailableException | |
重啟
public void reboot (String reason)
投擲 |
---|
DeviceNotAvailableException | |
重啟
public void reboot ()
投擲 |
---|
DeviceNotAvailableException | |
rebootIntoBootloader
public void rebootIntoBootloader ()
投擲 |
---|
DeviceNotAvailableException | |
rebootIntoFastbootd
public void rebootIntoFastbootd ()
投擲 |
---|
DeviceNotAvailableException | |
rebootIntoRecovery
public void rebootIntoRecovery ()
投擲 |
---|
DeviceNotAvailableException | |
rebootIntoSideload
public void rebootIntoSideload ()
投擲 |
---|
DeviceNotAvailableException | |
rebootIntoSideload
public void rebootIntoSideload (boolean autoReboot)
投擲 |
---|
DeviceNotAvailableException | |
rebootUntilOnline
public void rebootUntilOnline ()
投擲 |
---|
DeviceNotAvailableException | |
rebootUntilOnline
public void rebootUntilOnline (String reason)
投擲 |
---|
DeviceNotAvailableException | |
rebootUserspace
public void rebootUserspace ()
投擲 |
---|
DeviceNotAvailableException | |
rebootUserspaceUntilOnline
public void rebootUserspaceUntilOnline ()
投擲 |
---|
DeviceNotAvailableException | |
restoreDevice
public void recoverDevice ()
嘗試恢復設備通信。
投擲 |
---|
DeviceNotAvailableException | 如果設備不再可用 |
remountSystemWritable
public void remountSystemWritable ()
投擲 |
---|
DeviceNotAvailableException | |
remountVendorWritable
public void remountVendorWritable ()
投擲 |
---|
DeviceNotAvailableException | |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
參量 |
---|
componentName | String |
userId | int |
投擲 |
---|
DeviceNotAvailableException | |
removeOwners
public void removeOwners ()
投擲 |
---|
DeviceNotAvailableException | |
removeUser
public boolean removeUser (int userId)
投擲 |
---|
DeviceNotAvailableException | |
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,
ITestLifeCycleReceiver... listeners)
參量 |
---|
runner | IRemoteAndroidTestRunner |
listeners | ITestLifeCycleReceiver |
投擲 |
---|
DeviceNotAvailableException | |
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,
listeners)
參量 |
---|
runner | IRemoteAndroidTestRunner |
listeners | |
投擲 |
---|
DeviceNotAvailableException | |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner,
int userId,
ITestLifeCycleReceiver... listeners)
參量 |
---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
投擲 |
---|
DeviceNotAvailableException | |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner,
int userId,
listeners)
參量 |
---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | |
投擲 |
---|
DeviceNotAvailableException | |
設置日期
public void setDate (Date date)
投擲 |
---|
DeviceNotAvailableException | |
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
參量 |
---|
componentName | String |
userId | int |
投擲 |
---|
DeviceNotAvailableException | |
setDeviceState
public void setDeviceState (TestDeviceState deviceState)
參量 |
---|
deviceState | TestDeviceState |
setEmulatorProcess
public void setEmulatorProcess (Process p)
setFastbootEnabled
public void setFastbootEnabled (boolean fastbootEnabled)
參量 |
---|
fastbootEnabled | boolean |
setFastbootPath
public void setFastbootPath (String fastbootPath)
setIDevice
public void setIDevice (IDevice newDevice)
setOptions
public void setOptions (TestDeviceOptions options)
參量 |
---|
options | TestDeviceOptions |
setProperty
public boolean setProperty (String propKey,
String propValue)
參量 |
---|
propKey | String |
propValue | String |
投擲 |
---|
DeviceNotAvailableException | |
setRecovery
public void setRecovery (IDeviceRecovery recovery)
參量 |
---|
recovery | IDeviceRecovery |
setRecoveryMode
public void setRecoveryMode (ITestDevice.RecoveryMode mode)
參量 |
---|
mode | ITestDevice.RecoveryMode |
setSetting
public void setSetting (String namespace,
String key,
String value)
參量 |
---|
namespace | String |
key | String |
value | String |
投擲 |
---|
DeviceNotAvailableException | |
setSetting
public void setSetting (int userId,
String namespace,
String key,
String value)
參量 |
---|
userId | int |
namespace | String |
key | String |
value | String |
投擲 |
---|
DeviceNotAvailableException | |
setUseFastbootErase
public void setUseFastbootErase (boolean useFastbootErase)
參量 |
---|
useFastbootErase | boolean |
startLogcat
public void startLogcat ()
startUser
public boolean startUser (int userId)
投擲 |
---|
DeviceNotAvailableException | |
startUser
public boolean startUser (int userId,
boolean waitFlag)
參量 |
---|
userId | int |
waitFlag | boolean |
投擲 |
---|
DeviceNotAvailableException | |
stopEmulatorOutput
public void stopEmulatorOutput ()
stopLogcat
public void stopLogcat ()
stopUser
public boolean stopUser (int userId)
投擲 |
---|
DeviceNotAvailableException | |
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
參量 |
---|
userId | int |
waitFlag | boolean |
forceFlag | boolean |
投擲 |
---|
DeviceNotAvailableException | |
switchToAdbTcp
public String switchToAdbTcp ()
投擲 |
---|
DeviceNotAvailableException | |
switchToAdbUsb
public boolean switchToAdbUsb ()
投擲 |
---|
DeviceNotAvailableException | |
切換用戶
public boolean switchUser (int userId)
投擲 |
---|
DeviceNotAvailableException | |
切換用戶
public boolean switchUser (int userId,
long timeout)
參量 |
---|
userId | int |
timeout | long |
投擲 |
---|
DeviceNotAvailableException | |
同步文件
public boolean syncFiles (File localFileDir,
String deviceFilePath)
參量 |
---|
localFileDir | File |
deviceFilePath | String |
投擲 |
---|
DeviceNotAvailableException | |
採取Bugreport
public Bugreport takeBugreport ()
unencryptDevice
public boolean unencryptDevice ()
投擲 |
---|
DeviceNotAvailableException | |
uninstallPackage
public String uninstallPackage (String packageName)
投擲 |
---|
DeviceNotAvailableException | |
unlockDevice
public boolean unlockDevice ()
投擲 |
---|
DeviceNotAvailableException | |
waitForBootComplete
public boolean waitForBootComplete (long timeOut)
投擲 |
---|
DeviceNotAvailableException | |
waitForDeviceAvailable
public void waitForDeviceAvailable ()
投擲 |
---|
DeviceNotAvailableException | |
waitForDeviceAvailable
public void waitForDeviceAvailable (long waitTime)
投擲 |
---|
DeviceNotAvailableException | |
waitForDeviceInRecovery
public boolean waitForDeviceInRecovery (long waitTime)
waitForDeviceInSideload
0f05205db0
waitForDeviceNotAvailable
public boolean waitForDeviceNotAvailable (long waitTime)
waitForDeviceOnline
public void waitForDeviceOnline ()
投擲 |
---|
DeviceNotAvailableException | |
waitForDeviceOnline
public void waitForDeviceOnline (long waitTime)
投擲 |
---|
DeviceNotAvailableException | |
waitForDeviceShell
public boolean waitForDeviceShell (long waitTime)
受保護的方法
checkApiLevelAgainst
protected void checkApiLevelAgainst (String feature,
int strictMinLevel)
參量 |
---|
feature | String |
strictMinLevel | int |
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
執行adb重新啟動。
參量 |
---|
rebootMode | NativeDevice.RebootMode :此重新引導的模式。 |
reason | String :用於此重啟。 |
投擲 |
---|
DeviceNotAvailableException | |
guaranteeRuntimePermissionSupported
protected void ensureRuntimePermissionSupported ()
如果不支持運行時權限,則拋出異常的輔助方法
投擲 |
---|
DeviceNotAvailableException | |
getBugreportInternal
protected InputStreamSource getBugreportInternal ()
getBugreportzInternal
protected File getBugreportzInternal ()
用於將bugreportz zip文件獲取為ERROR(/File)
內部Helper方法。
getRunUtil
protected IRunUtil getRunUtil ()
獲取要使用的RunUtil
實例。
internalGetProperty
protected String internalGetProperty (String propName,
String fastbootVar,
String description)
默認情況下,從ddmlib緩存中獲取設備屬性,然後根據設備是否在Fastboot中回退到“ adb shell getprop”或“ fastboot getvar”。
參量 |
---|
propName | String :`adb shell getprop'返回的設備屬性的名稱 |
fastbootVar | String :要查詢的等效fastboot變量的名稱。如果為null ,將不嘗試快速啟動查詢 |
description | String :變量的簡單描述。首字母應大寫。 |
退貨 |
---|
String | 一個字符串,可能為null 或為空,包含給定屬性的值 |
投擲 |
---|
DeviceNotAvailableException | |
isNew
protected boolean isNewer (File localFile,
IFileEntry entry)
如果本地文件比遠程文件新,則返回true
。 IFileEntry
精確到分鐘,如果時間相等,則該文件將被視為較新。
參量 |
---|
localFile | File |
entry | IFileEntry |
protected boolean performDeviceAction (String actionDescription,
com.android.tradefed.device.NativeDevice.DeviceAction action,
int retryAttempts)
在此設備上執行操作。如果操作失敗,則嘗試恢復設備並嘗試重試命令。
參量 |
---|
actionDescription | String :要執行的動作的簡短描述。僅用於記錄目的。 |
action | com.android.tradefed.device.NativeDevice.DeviceAction :要執行的動作 |
retryAttempts | int :如果重試失敗但恢復成功,重試將嘗試採取措施 |
投擲 |
---|
DeviceNotAvailableException | 如果恢復嘗試失敗或完成最大嘗試但沒有成功 |
postAdbReboot
protected void postAdbReboot ()
重新啟動後可以採取的可能的額外操作。
投擲 |
---|
DeviceNotAvailableException | |
prePostBootSetup
protected void prePostBootSetup ()
允許每種設備類型(AndroidNativeDevice,TestDevice)針對特定的啟動後設置覆蓋此方法。
投擲 |
---|
DeviceNotAvailableException | |
setClock
protected void setClock (Clock clock)
設置要使用的Clock實例。
setLogStartDelay
protected void setLogStartDelay (int delay)
設置開始聯機設備的Logcat捕獲之前要等待的時間(以毫秒為單位)。
waitForDeviceNotAvailable
protected void waitForDeviceNotAvailable (String operationDesc,
long time)
參量 |
---|
operationDesc | String |
time | long |
Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-09-08 UTC.