本地設備

public class NativeDevice
extends Object implements IManagedTestDevice, IConfigurationReceiver

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


ITestDevice非全端 Android 裝置的預設實作。

概括

嵌套類

class NativeDevice.AdbAction

用於執行作業系統「adb ....」指令的DeviceAction

class NativeDevice.AdbShellAction

class NativeDevice.RebootDeviceAction

用於重新啟動裝置的DeviceAction

enum NativeDevice.RebootMode

一種重啟模式。

常數

int INVALID_USER_ID

為任何無效/未找到的使用者 ID 傳回的值:UserHandle 定義了 -10000 值

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

執行指令重試的預設次數

領域

protected static final String SD_CARD

protected static final String STORAGE_EMULATED

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

公共構造函數

NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

建立一個TestDevice

公共方法

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 ()

包含所有executeShellCommand(String)日誌的日誌。

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)

從非根路徑取得FileEntry非官方幫助程式。

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)

處理 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, 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) 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)

void resetContentProviderSetup ()

重置內容提供者設定的標誌以便再次觸發它。

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 setConfiguration ( IConfiguration configuration)

注入正在使用的IConfiguration

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)

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)

受保護的方法

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

建立要在執行重新啟動操作時使用的RebootDeviceAction

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

執行 adb 重啟。

void ensureRuntimePermissionSupported ()

如果不支援運行時權限,則拋出異常的輔助方法

InputStreamSource getBugreportInternal ()
File getBugreportzInternal ()

將 bugreportz zip 檔案作為ERROR(/File)取得的內部幫助程式方法。

IRunUtil getRunUtil ()

取得要使用的RunUtil實例。

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

預設會從 ddmlib 快取中取得裝置屬性,然後根據裝置是否處於 Fastboot 狀態,返回「adb shell getprop」或「fastboot getvar」。

boolean isNewer (File localFile, IFileEntry entry)

如果本機檔案比遠端檔案新,則傳回true

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

在此設備上執行操作。

void postAdbReboot ()

重新啟動後可能採取的額外操作。

void prePostBootSetup ()

允許每種裝置類型(AndroidNativeDevice、TestDevice)覆寫此方法以進行特定的啟動後設定。

void setClock (Clock clock)

設定要使用的 Clock 實例。

void setLogStartDelay (int delay)

設定線上設備開始 logcat 捕獲之前等待的時間(以毫秒為單位)。

void waitForDeviceNotAvailable (String operationDesc, long time)

常數

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)

最多重試次數

protected static final int MAX_RETRY_ATTEMPTS

執行指令重試的預設次數

常量值:2 (0x00000002)

領域

SD卡

protected static final String SD_CARD

儲存_模擬

protected static final String STORAGE_EMULATED

m選項

protected TestDeviceOptions mOptions

狀態監視器

protected final IDeviceStateMonitor mStateMonitor

公共構造函數

本地設備

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

建立一個TestDevice

參數
device IDevice :關聯的IDevice

stateMonitor IDeviceStateMonitor :要使用的IDeviceStateMonitor機制

allocationMonitor IDeviceMonitor :通知指派狀態變更的IDeviceMonitor 。可以為空

公共方法

檢查 ApiLevelAgainstNextRelease

public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

參數
strictMinLevel int

退貨
boolean

投擲
DeviceNotAvailableException

檢查連接性

public boolean checkConnectivity ()

退貨
boolean

投擲
DeviceNotAvailableException

清除錯誤對話框

public boolean clearErrorDialogs ()

退貨
boolean

投擲
DeviceNotAvailableException

清除上次連線的 Wifi 網路

public void clearLastConnectedWifiNetwork ()

清除Logcat

public void clearLogcat ()

連接到Wifi網絡

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

參數
wifiSsid String

wifiPsk String

退貨
boolean

投擲
DeviceNotAvailableException

連接到Wifi網絡

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

參數
wifiSsid String

wifiPsk String

scanSsid boolean

退貨
boolean

投擲
DeviceNotAvailableException

如果需要連接到 Wifi 網路

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

參數
wifiSsid String

wifiPsk String

scanSsid boolean

退貨
boolean

投擲
DeviceNotAvailableException

如果需要連接到 Wifi 網路

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

參數
wifiSsid String

wifiPsk String

退貨
boolean

投擲
DeviceNotAvailableException

創建用戶

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

參數
name String

guest boolean

ephemeral boolean

退貨
int

投擲
DeviceNotAvailableException

創建用戶

public int createUser (String name)

參數
name String

退貨
int

投擲
DeviceNotAvailableException

創建用戶不拋出

public int createUserNoThrow (String name)

參數
name String

退貨
int

投擲
DeviceNotAvailableException

刪除文件

public void deleteFile (String deviceFilePath)

參數
deviceFilePath String

投擲
DeviceNotAvailableException

設備軟重啟

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

參數
prevSystemServerProcess ProcessInfo

退貨
boolean

投擲
DeviceNotAvailableException

設備軟重啟以來

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

參數
utcEpochTime long

timeUnit TimeUnit

退貨
boolean

投擲
DeviceNotAvailableException

禁用AdbRoot

public boolean disableAdbRoot ()

退貨
boolean

投擲
DeviceNotAvailableException

禁用鍵盤鎖

public void disableKeyguard ()

投擲
DeviceNotAvailableException

停用網路監視器

public boolean disableNetworkMonitor ()

退貨
boolean

投擲
DeviceNotAvailableException

斷開與Wifi的連接

public boolean disconnectFromWifi ()

退貨
boolean

投擲
DeviceNotAvailableException

文件是否存在

public boolean doesFileExist (String deviceFilePath)

參數
deviceFilePath String

退貨
boolean

投擲
DeviceNotAvailableException

轉儲堆

public File dumpHeap (String process, 
                String devicePath)

參數
process String

devicePath String

退貨
File

投擲
DeviceNotAvailableException

啟用AdbRoot

public boolean enableAdbRoot ()

退貨
boolean

投擲
DeviceNotAvailableException

啟用網路監視器

public boolean enableNetworkMonitor ()

退貨
boolean

投擲
DeviceNotAvailableException

加密裝置

public boolean encryptDevice (boolean inplace)

參數
inplace boolean

退貨
boolean

投擲
DeviceNotAvailableException

執行Adb指令

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

參數
timeout long

cmdArgs String

退貨
String

投擲
DeviceNotAvailableException

執行Adb指令

public String executeAdbCommand (String... cmdArgs)

參數
cmdArgs String

退貨
String

投擲
DeviceNotAvailableException

執行Fastboot命令

public CommandResult executeFastbootCommand (String... cmdArgs)

參數
cmdArgs String

退貨
CommandResult

投擲
DeviceNotAvailableException

執行Fastboot命令

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

參數
timeout long

cmdArgs String

退貨
CommandResult

投擲
DeviceNotAvailableException

執行LongFastboot命令

public CommandResult executeLongFastbootCommand (String... cmdArgs)

參數
cmdArgs String

退貨
CommandResult

投擲
DeviceNotAvailableException

執行Shell命令

public String executeShellCommand (String command)

參數
command String

退貨
String

投擲
DeviceNotAvailableException

執行Shell命令

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

參數
command String

receiver IShellOutputReceiver

maxTimeToOutputShellResponse long

timeUnit TimeUnit

retryAttempts int

投擲
DeviceNotAvailableException

執行Shell命令

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

執行Shell命令

public void executeShellCommand (String command, 
                IShellOutputReceiver receiver)

參數
command String

receiver IShellOutputReceiver

投擲
DeviceNotAvailableException

執行ShellV2命令

public CommandResult executeShellV2Command (String cmd)

參數
cmd String

退貨
CommandResult

投擲
DeviceNotAvailableException

執行ShellV2命令

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

參數
cmd String

pipeToOutput OutputStream

退貨
CommandResult

投擲
DeviceNotAvailableException

執行ShellV2命令

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

參數
cmd String

pipeAsInput File

退貨
CommandResult

投擲
DeviceNotAvailableException

執行ShellV2命令

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

參數
cmd String

maxTimeoutForCommand long

timeUnit TimeUnit

retryAttempts int

退貨
CommandResult

投擲
DeviceNotAvailableException

執行ShellV2命令

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

參數
cmd String

maxTimeoutForCommand long

timeUnit TimeUnit

退貨
CommandResult

投擲
DeviceNotAvailableException

執行ShellV2命令

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

退貨
CommandResult

投擲
DeviceNotAvailableException

執行ShellV2命令

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

參數
cmd String

pipeAsInput File

pipeToOutput OutputStream

pipeToError OutputStream

maxTimeoutForCommand long

timeUnit TimeUnit

retryAttempts int

退貨
CommandResult

投擲
DeviceNotAvailableException

fastboot擦除分割區

public CommandResult fastbootWipePartition (String partition)

參數
partition String

退貨
CommandResult

投擲
DeviceNotAvailableException

取得活動頂點

public  getActiveApexes ()

退貨

投擲
DeviceNotAvailableException

取得所有設定

public  getAllSettings (String namespace)

參數
namespace String

退貨

投擲
DeviceNotAvailableException

取得分配狀態

public DeviceAllocationState getAllocationState ()

退貨
DeviceAllocationState

取得AndroidId

public String getAndroidId (int userId)

參數
userId int

退貨
String

投擲
DeviceNotAvailableException

取得AndroidId

public  getAndroidIds ()

退貨

投擲
DeviceNotAvailableException

取得API等級

public int getApiLevel ()

退貨
int

投擲
DeviceNotAvailableException

獲取應用程式包信息

public PackageInfo getAppPackageInfo (String packageName)

參數
packageName String

退貨
PackageInfo

投擲
DeviceNotAvailableException

獲取應用程式包信息

public  getAppPackageInfos ()

退貨

投擲
DeviceNotAvailableException

取得基頻版本

public String getBasebandVersion ()

退貨
String

投擲
DeviceNotAvailableException

取得電池

public Integer getBattery ()

退貨
Integer

取得布爾屬性

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

參數
name String

defaultValue boolean

退貨
boolean

投擲
DeviceNotAvailableException

取得啟動歷史記錄

public  getBootHistory ()

退貨

投擲
DeviceNotAvailableException

取得啟動歷史記錄

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

參數
utcEpochTime long

timeUnit TimeUnit

退貨

投擲
DeviceNotAvailableException

取得Bootloader版本

public String getBootloaderVersion ()

退貨
String

投擲
DeviceNotAvailableException

取得錯誤報告

public InputStreamSource getBugreport ()

退貨
InputStreamSource

取得錯誤報告

public InputStreamSource getBugreportz ()

退貨
InputStreamSource

取得建置別名

public String getBuildAlias ()

退貨
String

投擲
DeviceNotAvailableException

獲取BuildFlavor

public String getBuildFlavor ()

退貨
String

投擲
DeviceNotAvailableException

取得建置ID

public String getBuildId ()

退貨
String

投擲
DeviceNotAvailableException

取得建置簽署金鑰

public String getBuildSigningKeys ()

退貨
String

投擲
DeviceNotAvailableException

取得快取設備描述符

public DeviceDescriptor getCachedDeviceDescriptor ()

退貨
DeviceDescriptor

獲取孩子

public String[] getChildren (String path)

參數
path String

退貨
String[]

投擲
DeviceNotAvailableException

取得當前可折疊狀態

public DeviceFoldableState getCurrentFoldableState ()

退貨
DeviceFoldableState

投擲
DeviceNotAvailableException

取得目前用戶

public int getCurrentUser ()

退貨
int

投擲
DeviceNotAvailableException

取得設備類

public String getDeviceClass ()

退貨
String

取得設備日期

public long getDeviceDate ()

退貨
long

投擲
DeviceNotAvailableException

取得設備描述符

public DeviceDescriptor getDeviceDescriptor ()

退貨
DeviceDescriptor

取得設備狀態

public TestDeviceState getDeviceState ()

退貨
TestDeviceState

取得設備時間偏移

public long getDeviceTimeOffset (Date date)

參數
date Date

退貨
long

投擲
DeviceNotAvailableException

取得模擬器輸出

public InputStreamSource getEmulatorOutput ()

退貨
InputStreamSource

取得模擬器進程

public Process getEmulatorProcess ()

退貨
Process

取得執行Shell命令日誌

public final File getExecuteShellCommandLog ()

包含所有executeShellCommand(String)日誌的日誌。

退貨
File

取得外部儲存可用空間

public long getExternalStoreFreeSpace ()

退貨
long

投擲
DeviceNotAvailableException

取得快速啟動路徑

public String getFastbootPath ()

退貨
String

取得FastbootProductType

public String getFastbootProductType ()

退貨
String

投擲
DeviceNotAvailableException

取得FastbootProductVariant

public String getFastbootProductVariant ()

退貨
String

投擲
DeviceNotAvailableException

取得Fastboot序號

public String getFastbootSerialNumber ()

退貨
String

取得Fastboot變數

public String getFastbootVariable (String variableName)

參數
variableName String

退貨
String

投擲
DeviceNotAvailableException

取得Fastboot版本

public String getFastbootVersion ()

退貨
String

取得文件條目

public IFileEntry getFileEntry (String path)

參數
path String

退貨
IFileEntry

投擲
DeviceNotAvailableException

取得文件條目

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

從非根路徑取得FileEntry非官方幫助程式。 FIXME:重構 FileEntry 系統,使其可以從任何路徑存取。 (即使是非根)。

參數
entry FileListingService.FileEntryFileEntry不一定是 Ddmlib 所要求的 root。

退貨
IFileEntry代表 FileEntry 的FileEntryWrapper

投擲
DeviceNotAvailableException

取得可折疊狀態

public  getFoldableStates ()

退貨

投擲
DeviceNotAvailableException

取得設備

public IDevice getIDevice ()

退貨
IDevice

取得安裝包名稱

public  getInstalledPackageNames ()

退貨

投擲
DeviceNotAvailableException

取得整數屬性

public long getIntProperty (String name, 
                long defaultValue)

參數
name String

defaultValue long

退貨
long

投擲
DeviceNotAvailableException

取得IP位址

public String getIpAddress ()

退貨
String

投擲
DeviceNotAvailableException

取得KeyguardState

public KeyguardControllerState getKeyguardState ()

退貨
KeyguardControllerState

投擲
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

退貨
long

取得LaunchApiLevel

public int getLaunchApiLevel ()

退貨
int

投擲
DeviceNotAvailableException

取得Logcat

public InputStreamSource getLogcat ()

退貨
InputStreamSource

取得Logcat

public InputStreamSource getLogcat (int maxBytes)

參數
maxBytes int

退貨
InputStreamSource

取得LogcatDump

public InputStreamSource getLogcatDump ()

退貨
InputStreamSource

取得LogcatSince

public InputStreamSource getLogcatSince (long date)

參數
date long

退貨
InputStreamSource

取得Mac位址

public String getMacAddress ()

退貨
String

獲取主線模組信息

public  getMainlineModuleInfo ()

退貨

投擲
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

退貨
int

投擲
DeviceNotAvailableException

取得支援的最大用戶數

public int getMaxNumberOfUsersSupported ()

退貨
int

投擲
DeviceNotAvailableException

取得監視器

public IDeviceStateMonitor getMonitor ()

退貨
IDeviceStateMonitor

取得掛載點

public String getMountPoint (String mountName)

參數
mountName String

退貨
String

取得掛載點資訊

public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

參數
mountpoint String

退貨
ITestDevice.MountPointInfo

投擲
DeviceNotAvailableException

取得掛載點資訊

public  getMountPointInfo ()

退貨

投擲
DeviceNotAvailableException

取得選項

public TestDeviceOptions getOptions ()

退貨
TestDeviceOptions

取得分區空閒空間

public long getPartitionFreeSpace (String partition)

參數
partition String

退貨
long

投擲
DeviceNotAvailableException

取得主用戶ID

public Integer getPrimaryUserId ()

退貨
Integer

投擲
DeviceNotAvailableException

按名稱取得進程

public ProcessInfo getProcessByName (String processName)

參數
processName String

退貨
ProcessInfo

投擲
DeviceNotAvailableException

取得進程Pid

public String getProcessPid (String process)

參數
process String

退貨
String

投擲
DeviceNotAvailableException

取得產品類型

public String getProductType ()

退貨
String

投擲
DeviceNotAvailableException

取得產品變體

public String getProductVariant ()

退貨
String

投擲
DeviceNotAvailableException

取得屬性

public String getProperty (String name)

參數
name String

退貨
String

投擲
DeviceNotAvailableException

取得恢復模式

public ITestDevice.RecoveryMode getRecoveryMode ()

退貨
ITestDevice.RecoveryMode

取得螢幕截圖

public InputStreamSource getScreenshot (String format)

參數
format String

退貨
InputStreamSource

投擲
DeviceNotAvailableException

取得螢幕截圖

public InputStreamSource getScreenshot (long displayId)

參數
displayId long

退貨
InputStreamSource

投擲
DeviceNotAvailableException

取得螢幕截圖

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

參數
format String

rescale boolean

退貨
InputStreamSource

投擲
DeviceNotAvailableException

取得螢幕截圖

public InputStreamSource getScreenshot ()

退貨
InputStreamSource

投擲
DeviceNotAvailableException

取得序號

public String getSerialNumber ()

退貨
String

取得設定

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

參數
userId int

namespace String

key String

退貨
String

投擲
DeviceNotAvailableException

取得設定

public String getSetting (String namespace, 
                String key)

參數
namespace String

key String

退貨
String

投擲
DeviceNotAvailableException

取得Sim算子

public String getSimOperator ()

退貨
String

取得模擬狀態

public String getSimState ()

退貨
String

取得墓碑

public  getTombstones ()

退貨

投擲
DeviceNotAvailableException

取得總記憶體

public long getTotalMemory ()

退貨
long

取得UninstallablePackageNames

public  getUninstallablePackageNames ()

退貨

投擲
DeviceNotAvailableException

getUseFastbootErase

public boolean getUseFastbootErase ()

退貨
boolean

取得用戶標誌

public int getUserFlags (int userId)

參數
userId int

退貨
int

投擲
DeviceNotAvailableException

獲取用戶資訊

public  getUserInfos ()

退貨

投擲
DeviceNotAvailableException

取得用戶序號

public int getUserSerialNumber (int userId)

參數
userId int

退貨
int

投擲
DeviceNotAvailableException

處理分配事件

public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

處理 DeviceEvent,這可能會也可能不會將該設備轉換到新的分配狀態。

參數
event DeviceEvent

退貨
IManagedTestDevice.DeviceEventResponse

有特徵

public boolean hasFeature (String feature)

參數
feature String

退貨
boolean

投擲
DeviceNotAvailableException

安裝包

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

參數
packageFile File

reinstall boolean

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

安裝包

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

參數
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

為用戶安裝套件

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

參數
packageFile File

reinstall boolean

userId int

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

為用戶安裝套件

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

參數
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

是AdbRoot

public boolean isAdbRoot ()

退貨
boolean

投擲
DeviceNotAvailableException

是AdbTcp

public boolean isAdbTcp ()

退貨
boolean

isAppEnumerationSupported 是否支持

public boolean isAppEnumerationSupported ()

退貨
boolean

投擲
DeviceNotAvailableException

裝置已加密

public boolean isDeviceEncrypted ()

退貨
boolean

投擲
DeviceNotAvailableException

是目錄

public boolean isDirectory (String path)

參數
path String

退貨
boolean

投擲
DeviceNotAvailableException

isEnableAdbRoot

public boolean isEnableAdbRoot ()

退貨
boolean true如果應在裝置上啟用 adb root

是否支援加密

public boolean isEncryptionSupported ()

退貨
boolean

投擲
DeviceNotAvailableException

是執行檔

public boolean isExecutable (String fullPath)

參數
fullPath String

退貨
boolean

投擲
DeviceNotAvailableException

是否啟用快速啟動

public boolean isFastbootEnabled ()

退貨
boolean

是無頭的

public boolean isHeadless ()

退貨
boolean

投擲
DeviceNotAvailableException

是否支援多用戶

public boolean isMultiUserSupported ()

退貨
boolean

投擲
DeviceNotAvailableException

軟體包已安裝

public boolean isPackageInstalled (String packageName, 
                String userId)

參數
packageName String

userId String

退貨
boolean

投擲
DeviceNotAvailableException

軟體包已安裝

public boolean isPackageInstalled (String packageName)

參數
packageName String

退貨
boolean

投擲
DeviceNotAvailableException

isRuntimePermissionSupported

public boolean isRuntimePermissionSupported ()

退貨
boolean

投擲
DeviceNotAvailableException

isStateBootloaderOrFastbootd

public boolean isStateBootloaderOrFastbootd ()

退貨
boolean

正在運行

public boolean isUserRunning (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

是用戶次要的

public boolean isUserSecondary (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

是否啟用Wifi

public boolean isWifiEnabled ()

退貨
boolean

投擲
DeviceNotAvailableException

清單顯示 ID

public  listDisplayIds ()

退貨

投擲
DeviceNotAvailableException

列出用戶

public  listUsers ()

退貨

投擲
DeviceNotAvailableException

日誌錯誤報告

public boolean logBugreport (String dataName, 
                ITestLogger listener)

參數
dataName String

listener ITestLogger

退貨
boolean

登入裝置

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

參數
tag String

level Log.LogLevel

format String

args Object

非阻塞重啟

public void nonBlockingReboot ()

投擲
DeviceNotAvailableException

postAdbRoot 操作

public void postAdbRootAction ()

如果裝置需要在 adb root 之後和裝置重新上線之前執行某些特定操作,則會覆蓋。預設實作不包括任何附加操作。在此階段不保證啟用 adb root。

投擲
DeviceNotAvailableException

postAdbUnrootAction

public void postAdbUnrootAction ()

如果裝置需要在 adb unroot 之後和裝置重新上線之前執行某些特定操作,則會覆蓋。預設實作不包含任何其他操作。在此階段不保證 adb root 被停用。

投擲
DeviceNotAvailableException

啟動後設定

public void postBootSetup ()

投擲
DeviceNotAvailableException

調用後拆卸

public void postInvocationTearDown (Throwable exception)

參數
exception Throwable

調用前設定

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

參數
info IBuildInfo

attributes MultiMap

投擲
DeviceNotAvailableException
TargetSetupError

拉目錄

public boolean pullDir (String deviceFilePath, 
                File localDir)

參數
deviceFilePath String

localDir File

退貨
boolean

投擲
DeviceNotAvailableException

拉文件

public boolean pullFile (String remoteFilePath, 
                File localFile)

參數
remoteFilePath String

localFile File

退貨
boolean

投擲
DeviceNotAvailableException

拉文件

public File pullFile (String remoteFilePath)

參數
remoteFilePath String

退貨
File

投擲
DeviceNotAvailableException

拉取文件內容

public String pullFileContents (String remoteFilePath)

參數
remoteFilePath String

退貨
String

投擲
DeviceNotAvailableException

從外部拉文件

public File pullFileFromExternal (String remoteFilePath)

參數
remoteFilePath String

退貨
File

投擲
DeviceNotAvailableException

推目錄

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

參數
localFileDir File

deviceFilePath String

excludedDirectories

退貨
boolean

投擲
DeviceNotAvailableException

推目錄

public boolean pushDir (File localFileDir, 
                String deviceFilePath)

參數
localFileDir File

deviceFilePath String

退貨
boolean

投擲
DeviceNotAvailableException

推播檔案

public boolean pushFile (File localFile, 
                String remoteFilePath)

參數
localFile File

remoteFilePath String

退貨
boolean

投擲
DeviceNotAvailableException

推串

public boolean pushString (String contents, 
                String remoteFilePath)

參數
contents String

remoteFilePath String

退貨
boolean

投擲
DeviceNotAvailableException

重啟

public void reboot (String reason)

參數
reason String

投擲
DeviceNotAvailableException

重啟

public void reboot ()

投擲
DeviceNotAvailableException

重新啟動進入引導程式

public void rebootIntoBootloader ()

投擲
DeviceNotAvailableException

重新啟動進入Fastbootd

public void rebootIntoFastbootd ()

投擲
DeviceNotAvailableException

重新啟動進入恢復

public void rebootIntoRecovery ()

投擲
DeviceNotAvailableException

重新啟動進入旁載

public void rebootIntoSideload ()

投擲
DeviceNotAvailableException

重新啟動進入旁載

public void rebootIntoSideload (boolean autoReboot)

參數
autoReboot boolean

投擲
DeviceNotAvailableException

重新啟動直到上線

public void rebootUntilOnline ()

投擲
DeviceNotAvailableException

重新啟動直到上線

public void rebootUntilOnline (String reason)

參數
reason String

投擲
DeviceNotAvailableException

重新啟動使用者空間

public void rebootUserspace ()

投擲
DeviceNotAvailableException

重新啟動用戶空間直到上線

public void rebootUserspaceUntilOnline ()

投擲
DeviceNotAvailableException

恢復設備

public void recoverDevice ()

嘗試恢復設備通訊。

投擲
DeviceNotAvailableException如果設備不再可用

重新掛載系統可寫

public void remountSystemWritable ()

投擲
DeviceNotAvailableException

重新掛載VendorWritable

public void remountVendorWritable ()

投擲
DeviceNotAvailableException

刪除管理員

public boolean removeAdmin (String componentName, 
                int userId)

參數
componentName String

userId int

退貨
boolean

投擲
DeviceNotAvailableException

刪除所有者

public void removeOwners ()

投擲
DeviceNotAvailableException

刪除用戶

public boolean removeUser (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

重置ContentProvider設定

public void resetContentProviderSetup ()

重置內容提供者設定的標誌以便再次觸發它。

運行儀器測試

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

參數
runner IRemoteAndroidTestRunner

listeners ITestLifeCycleReceiver

退貨
boolean

投擲
DeviceNotAvailableException

運行儀器測試

public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                 listeners)

參數
runner IRemoteAndroidTestRunner

listeners

退貨
boolean

投擲
DeviceNotAvailableException

以使用者身分執行儀器測試

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

參數
runner IRemoteAndroidTestRunner

userId int

listeners ITestLifeCycleReceiver

退貨
boolean

投擲
DeviceNotAvailableException

以使用者身分執行儀器測試

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

參數
runner IRemoteAndroidTestRunner

userId int

listeners

退貨
boolean

投擲
DeviceNotAvailableException

設定配置

public void setConfiguration (IConfiguration configuration)

注入正在使用的IConfiguration

參數
configuration IConfiguration

設定日期

public void setDate (Date date)

參數
date Date

投擲
DeviceNotAvailableException

設定設備所有者

public boolean setDeviceOwner (String componentName, 
                int userId)

參數
componentName String

userId int

退貨
boolean

投擲
DeviceNotAvailableException

設定設備狀態

public void setDeviceState (TestDeviceState deviceState)

參數
deviceState TestDeviceState

設定模擬器輸出流

public void setEmulatorOutputStream (SizeLimitedOutputStream output)

對於模擬器,設定SizeLimitedOutputStream來記錄輸出

參數
output SizeLimitedOutputStream :記錄輸出

設定模擬器進程

public void setEmulatorProcess (Process p)

參數
p Process

設定快速啟動啟用

public void setFastbootEnabled (boolean fastbootEnabled)

參數
fastbootEnabled boolean

設定快速啟動路徑

public void setFastbootPath (String fastbootPath)

參數
fastbootPath String

設定設備

public void setIDevice (IDevice newDevice)

參數
newDevice IDevice

設定選項

public void setOptions (TestDeviceOptions options)

參數
options TestDeviceOptions

設定屬性

public boolean setProperty (String propKey, 
                String propValue)

參數
propKey String

propValue String

退貨
boolean

投擲
DeviceNotAvailableException

設定恢復

public void setRecovery (IDeviceRecovery recovery)

參數
recovery IDeviceRecovery

設定恢復模式

public void setRecoveryMode (ITestDevice.RecoveryMode mode)

參數
mode ITestDevice.RecoveryMode

設定設定

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

參數
namespace String

key String

value String

投擲
DeviceNotAvailableException

設定設定

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

參數
userId int

namespace String

key String

value String

投擲
DeviceNotAvailableException

設定使用FastbootErase

public void setUseFastbootErase (boolean useFastbootErase)

參數
useFastbootErase boolean

啟動Logcat

public void startLogcat ()

啟動使用者

public boolean startUser (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

啟動使用者

public boolean startUser (int userId, 
                boolean waitFlag)

參數
userId int

waitFlag boolean

退貨
boolean

投擲
DeviceNotAvailableException

停止模擬器輸出

public void stopEmulatorOutput ()

停止Logcat

public void stopLogcat ()

停止用戶

public boolean stopUser (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

停止用戶

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

參數
userId int

waitFlag boolean

forceFlag boolean

退貨
boolean

投擲
DeviceNotAvailableException

切換到AdbTcp

public String switchToAdbTcp ()

退貨
String

投擲
DeviceNotAvailableException

切換到AdbUsb

public boolean switchToAdbUsb ()

退貨
boolean

投擲
DeviceNotAvailableException

切換用戶

public boolean switchUser (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

切換用戶

public boolean switchUser (int userId, 
                long timeout)

參數
userId int

timeout long

退貨
boolean

投擲
DeviceNotAvailableException

同步文件

public boolean syncFiles (File localFileDir, 
                String deviceFilePath)

參數
localFileDir File

deviceFilePath String

退貨
boolean

投擲
DeviceNotAvailableException

採取錯誤報告

public Bugreport takeBugreport ()

退貨
Bugreport

解密裝置

public boolean unencryptDevice ()

退貨
boolean

投擲
DeviceNotAvailableException

解除安裝包

public String uninstallPackage (String packageName)

參數
packageName String

退貨
String

投擲
DeviceNotAvailableException

解除安裝用戶包

public String uninstallPackageForUser (String packageName, 
                int userId)

參數
packageName String

userId int

退貨
String

投擲
DeviceNotAvailableException

解鎖裝置

public boolean unlockDevice ()

退貨
boolean

投擲
DeviceNotAvailableException

等待啟動完成

public boolean waitForBootComplete (long timeOut)

參數
timeOut long

退貨
boolean

投擲
DeviceNotAvailableException

等待設備可用

public void waitForDeviceAvailable ()

投擲
DeviceNotAvailableException

等待設備可用

public void waitForDeviceAvailable (long waitTime)

參數
waitTime long

投擲
DeviceNotAvailableException

等待設備恢復

public boolean waitForDeviceInRecovery (long waitTime)

參數
waitTime long

退貨
boolean

waitForDeviceInSideload

public boolean waitForDeviceInSideload (long waitTime)

參數
waitTime long

退貨
boolean

等待設備不可用

public boolean waitForDeviceNotAvailable (long waitTime)

參數
waitTime long

退貨
boolean

等待設備在線

public void waitForDeviceOnline ()

投擲
DeviceNotAvailableException

等待設備在線

public void waitForDeviceOnline (long waitTime)

參數
waitTime long

投擲
DeviceNotAvailableException

等待設備外殼

public boolean waitForDeviceShell (long waitTime)

參數
waitTime long

退貨
boolean

受保護的方法

檢查ApiLevelAgainst

protected void checkApiLevelAgainst (String feature, 
                int strictMinLevel)

參數
feature String

strictMinLevel int

建立重啟設備操作

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

建立要在執行重新啟動操作時使用的RebootDeviceAction

參數
rebootMode NativeDevice.RebootMode :重啟的一種模式。

reason String :用於此次重新啟動。

退貨
NativeDevice.RebootDeviceAction建立的RebootDeviceAction

執行AdbReboot

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

執行 adb 重啟。

參數
rebootMode NativeDevice.RebootMode :重啟的一種模式。

reason String :用於此次重新啟動。

投擲
DeviceNotAvailableException

確保運行時權限支援

protected void ensureRuntimePermissionSupported ()

如果不支援運行時權限,則拋出異常的輔助方法

投擲
DeviceNotAvailableException

取得錯誤報告內部

protected InputStreamSource getBugreportInternal ()

退貨
InputStreamSource

取得 BugreportzInternal

protected File getBugreportzInternal ()

將 bugreportz zip 檔案作為ERROR(/File)取得的內部幫助程式方法。

退貨
File

取得運行工具

protected IRunUtil getRunUtil ()

取得要使用的RunUtil實例。

退貨
IRunUtil

內部取得屬性

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 ,則不會嘗試 fastboot 查詢

description String :變數的簡單描述。第一個字母應大寫。

退貨
String一個字串,可能為null或空,包含給定屬性的值

投擲
DeviceNotAvailableException

較新

protected boolean isNewer (File localFile, 
                IFileEntry entry)

如果本機檔案比遠端檔案新,則傳回trueIFileEntry精確到分鐘,如果次數相等,則認為該檔案較新。

參數
localFile File

entry IFileEntry

退貨
boolean

執行設備操作

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 :如果失敗但恢復成功,重試嘗試執行操作

退貨
boolean true如果操作執行成功

投擲
DeviceNotAvailableException如果恢復嘗試失敗或最大嘗試次數未成功

Adb重啟後

protected void postAdbReboot ()

重新啟動後可能採取的額外操作。

投擲
DeviceNotAvailableException

啟動後設定前

protected void prePostBootSetup ()

允許每種裝置類型(AndroidNativeDevice、TestDevice)覆寫此方法以進行特定的啟動後設定。

投擲
DeviceNotAvailableException

設定時鐘

protected void setClock (Clock clock)

設定要使用的 Clock 實例。

參數
clock Clock

設定日誌開始延遲

protected void setLogStartDelay (int delay)

設定線上設備開始 logcat 捕獲之前等待的時間(以毫秒為單位)。

參數
delay int : 延遲(以毫秒為單位)

等待設備不可用

protected void waitForDeviceNotAvailable (String operationDesc, 
                long time)

參數
operationDesc String

time long