NativeDevice

public class NativeDevice
extends Object implements IManagedTestDevice, IConfigurationReceiver

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


ITestDevice 非完整堆疊 Android 裝置的預設實作方式。

摘要

巢狀類別

class NativeDevice.AdbAction

用於執行 OS '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 根目錄後,且在裝置重新上線前執行特定動作,請覆寫。

void postAdbUnrootAction()

如果裝置需要在 adb 取消取得 root 權限後,並在裝置重新上線前執行特定動作,請覆寫此值。

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

嘗試恢復裝置通訊。

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)

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

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

設定要使用的時鐘例項。

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)

MAX_RETRY_ATTEMPTS

protected static final int MAX_RETRY_ATTEMPTS

要執行的預設指令重試次數

常數值: 2 (0x00000002)

欄位

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

公用建構函式

NativeDevice

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

建立 TestDevice

參數
device IDevice:相關聯的 IDevice

stateMonitor IDeviceStateMonitor:要使用的 IDeviceStateMonitor 機制

allocationMonitor IDeviceMonitor:用於通知分配狀態變更的 IDeviceMonitor。可為空值

公用方法

checkApiLevelAgainstNextRelease

public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)

參數
strictMinLevel int

傳回
boolean

擲回
DeviceNotAvailableException

checkConnectivity

public boolean checkConnectivity ()

傳回
boolean

擲回
DeviceNotAvailableException

clearErrorDialogs

public boolean clearErrorDialogs ()

傳回
boolean

擲回
DeviceNotAvailableException

clearLastConnectedWifiNetwork

public void clearLastConnectedWifiNetwork ()

clearLogcat

public void clearLogcat ()

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

參數
wifiSsid String

wifiPsk String

傳回
boolean

擲回
DeviceNotAvailableException

connectToWifiNetwork

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

參數
wifiSsid String

wifiPsk String

scanSsid boolean

傳回
boolean

擲回
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

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

參數
wifiSsid String

wifiPsk String

scanSsid boolean

傳回
boolean

擲回
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

參數
wifiSsid String

wifiPsk String

傳回
boolean

擲回
DeviceNotAvailableException

createUser

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

參數
name String

guest boolean

ephemeral boolean

傳回
int

擲回
DeviceNotAvailableException

createUser

public int createUser (String name)

參數
name String

傳回
int

擲回
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

參數
name String

傳回
int

擲回
DeviceNotAvailableException

deleteFile

public void deleteFile (String deviceFilePath)

參數
deviceFilePath String

擲回
DeviceNotAvailableException

deviceSoftRestarted

public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)

參數
prevSystemServerProcess ProcessInfo

傳回
boolean

擲回
DeviceNotAvailableException

deviceSoftRestartedSince

public boolean deviceSoftRestartedSince (long utcEpochTime, 
                TimeUnit timeUnit)

參數
utcEpochTime long

timeUnit TimeUnit

傳回
boolean

擲回
DeviceNotAvailableException

disableAdbRoot

public boolean disableAdbRoot ()

傳回
boolean

擲回
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

擲回
DeviceNotAvailableException

disableNetworkMonitor

public boolean disableNetworkMonitor ()

傳回
boolean

擲回
DeviceNotAvailableException

disconnectFromWifi

public boolean disconnectFromWifi ()

傳回
boolean

擲回
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

參數
deviceFilePath String

傳回
boolean

擲回
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

參數
process String

devicePath String

傳回
File

擲回
DeviceNotAvailableException

enableAdbRoot

public boolean enableAdbRoot ()

傳回
boolean

擲回
DeviceNotAvailableException

enableNetworkMonitor

public boolean enableNetworkMonitor ()

傳回
boolean

擲回
DeviceNotAvailableException

encryptDevice

public boolean encryptDevice (boolean inplace)

參數
inplace boolean

傳回
boolean

擲回
DeviceNotAvailableException

executeAdbCommand

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

參數
timeout long

cmdArgs String

傳回
String

擲回
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (String... cmdArgs)

參數
cmdArgs String

傳回
String

擲回
DeviceNotAvailableException

executeFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

參數
cmdArgs String

傳回
CommandResult

擲回
DeviceNotAvailableException

executeFastbootCommand

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

參數
timeout long

cmdArgs String

傳回
CommandResult

擲回
DeviceNotAvailableException

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

參數
cmdArgs String

傳回
CommandResult

擲回
DeviceNotAvailableException

executeShellCommand

public String executeShellCommand (String command)

參數
command String

傳回
String

擲回
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)

參數
cmd String

傳回
CommandResult

擲回
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

參數
cmd String

pipeToOutput OutputStream

傳回
CommandResult

擲回
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                File pipeAsInput)

參數
cmd String

pipeAsInput File

傳回
CommandResult

擲回
DeviceNotAvailableException

executeShellV2Command

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

參數
cmd String

maxTimeoutForCommand long

timeUnit TimeUnit

retryAttempts int

傳回
CommandResult

擲回
DeviceNotAvailableException

executeShellV2Command

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

參數
cmd String

maxTimeoutForCommand long

timeUnit TimeUnit

傳回
CommandResult

擲回
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

傳回
CommandResult

擲回
DeviceNotAvailableException

executeShellV2Command

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

fastbootWipePartition

public CommandResult fastbootWipePartition (String partition)

參數
partition String

傳回
CommandResult

擲回
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

傳回

擲回
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

參數
namespace String

傳回

擲回
DeviceNotAvailableException

getAllocationState

public DeviceAllocationState getAllocationState ()

傳回
DeviceAllocationState

getAndroidId

public String getAndroidId (int userId)

參數
userId int

傳回
String

擲回
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

傳回

擲回
DeviceNotAvailableException

getApiLevel

public int getApiLevel ()

傳回
int

擲回
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

參數
packageName String

傳回
PackageInfo

擲回
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

傳回

擲回
DeviceNotAvailableException

getBasebandVersion

public String getBasebandVersion ()

傳回
String

擲回
DeviceNotAvailableException

getBattery

public Integer getBattery ()

傳回
Integer

getBooleanProperty

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

參數
name String

defaultValue boolean

傳回
boolean

擲回
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

傳回

擲回
DeviceNotAvailableException

getBootHistorySince

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

參數
utcEpochTime long

timeUnit TimeUnit

傳回

擲回
DeviceNotAvailableException

getBootloaderVersion

public String getBootloaderVersion ()

傳回
String

擲回
DeviceNotAvailableException

getBugreport

public InputStreamSource getBugreport ()

傳回
InputStreamSource

getBugreportz

public InputStreamSource getBugreportz ()

傳回
InputStreamSource

getBuildAlias

public String getBuildAlias ()

傳回
String

擲回
DeviceNotAvailableException

getBuildFlavor

public String getBuildFlavor ()

傳回
String

擲回
DeviceNotAvailableException

getBuildId

public String getBuildId ()

傳回
String

擲回
DeviceNotAvailableException

getBuildSigningKeys

public String getBuildSigningKeys ()

傳回
String

擲回
DeviceNotAvailableException

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor ()

傳回
DeviceDescriptor

getChildren

public String[] getChildren (String path)

參數
path String

傳回
String[]

擲回
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

傳回
DeviceFoldableState

擲回
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

傳回
int

擲回
DeviceNotAvailableException

getDeviceClass

public String getDeviceClass ()

傳回
String

getDeviceDate

public long getDeviceDate ()

傳回
long

擲回
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

傳回
DeviceDescriptor

getDeviceState

public TestDeviceState getDeviceState ()

傳回
TestDeviceState

getDeviceTimeOffset

public long getDeviceTimeOffset (Date date)

參數
date Date

傳回
long

擲回
DeviceNotAvailableException

getEmulatorOutput

public InputStreamSource getEmulatorOutput ()

傳回
InputStreamSource

getEmulatorProcess

public Process getEmulatorProcess ()

傳回
Process

getExecuteShellCommandLog

public final File getExecuteShellCommandLog ()

包含所有 executeShellCommand(String) 記錄的記錄。

傳回
File

getExternalStoreFreeSpace

public long getExternalStoreFreeSpace ()

傳回
long

擲回
DeviceNotAvailableException

getFastbootPath

public String getFastbootPath ()

傳回
String

getFastbootProductType

public String getFastbootProductType ()

傳回
String

擲回
DeviceNotAvailableException

getFastbootProductVariant

public String getFastbootProductVariant ()

傳回
String

擲回
DeviceNotAvailableException

getFastbootSerialNumber

public String getFastbootSerialNumber ()

傳回
String

getFastbootVariable

public String getFastbootVariable (String variableName)

參數
variableName String

傳回
String

擲回
DeviceNotAvailableException

getFastbootVersion

public String getFastbootVersion ()

傳回
String

getFileEntry

public IFileEntry getFileEntry (String path)

參數
path String

傳回
IFileEntry

擲回
DeviceNotAvailableException

getFileEntry

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

非官方輔助程式,可從非根目錄路徑取得 FileEntry。FIXME:重新整理 FileEntry 系統,讓其可從任何路徑存取。(即使未取得 Root 權限也一樣)。

參數
entry FileListingService.FileEntryFileEntry 不一定是 Ddmlib 所需的根目錄。

傳回
IFileEntry 代表 FileEntry 的 FileEntryWrapper

擲回
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

傳回

擲回
DeviceNotAvailableException

getIDevice

public IDevice getIDevice ()

傳回
IDevice

getInstalledPackageNames

public  getInstalledPackageNames ()

傳回

擲回
DeviceNotAvailableException

getIntProperty

public long getIntProperty (String name, 
                long defaultValue)

參數
name String

defaultValue long

傳回
long

擲回
DeviceNotAvailableException

getIpAddress

public String getIpAddress ()

傳回
String

擲回
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

傳回
KeyguardControllerState

擲回
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

傳回
long

getLaunchApiLevel

public int getLaunchApiLevel ()

傳回
int

擲回
DeviceNotAvailableException

getLogcat

public InputStreamSource getLogcat ()

傳回
InputStreamSource

getLogcat

public InputStreamSource getLogcat (int maxBytes)

參數
maxBytes int

傳回
InputStreamSource

getLogcatDump

public InputStreamSource getLogcatDump ()

傳回
InputStreamSource

getLogcatSince

public InputStreamSource getLogcatSince (long date)

參數
date long

傳回
InputStreamSource

getMacAddress

public String getMacAddress ()

傳回
String

getMainlineModuleInfo

public  getMainlineModuleInfo ()

傳回

擲回
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

傳回
int

擲回
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

傳回
int

擲回
DeviceNotAvailableException

getMonitor

public IDeviceStateMonitor getMonitor ()

傳回
IDeviceStateMonitor

getMountPoint

public String getMountPoint (String mountName)

參數
mountName String

傳回
String

getMountPointInfo

public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

參數
mountpoint String

傳回
ITestDevice.MountPointInfo

擲回
DeviceNotAvailableException

getMountPointInfo

public  getMountPointInfo ()

傳回

擲回
DeviceNotAvailableException

getOptions

public TestDeviceOptions getOptions ()

傳回
TestDeviceOptions

getPartitionFreeSpace

public long getPartitionFreeSpace (String partition)

參數
partition String

傳回
long

擲回
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

傳回
Integer

擲回
DeviceNotAvailableException

getProcessByName

public ProcessInfo getProcessByName (String processName)

參數
processName String

傳回
ProcessInfo

擲回
DeviceNotAvailableException

getProcessPid

public String getProcessPid (String process)

參數
process String

傳回
String

擲回
DeviceNotAvailableException

getProductType

public String getProductType ()

傳回
String

擲回
DeviceNotAvailableException

getProductVariant

public String getProductVariant ()

傳回
String

擲回
DeviceNotAvailableException

getProperty

public String getProperty (String name)

參數
name String

傳回
String

擲回
DeviceNotAvailableException

getRecoveryMode

public ITestDevice.RecoveryMode getRecoveryMode ()

傳回
ITestDevice.RecoveryMode

getScreenshot

public InputStreamSource getScreenshot (String format)

參數
format String

傳回
InputStreamSource

擲回
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

參數
displayId long

傳回
InputStreamSource

擲回
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

參數
format String

rescale boolean

傳回
InputStreamSource

擲回
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

傳回
InputStreamSource

擲回
DeviceNotAvailableException

getSerialNumber

public String getSerialNumber ()

傳回
String

getSetting

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

參數
userId int

namespace String

key String

傳回
String

擲回
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

參數
namespace String

key String

傳回
String

擲回
DeviceNotAvailableException

getSimOperator

public String getSimOperator ()

傳回
String

getSimState

public String getSimState ()

傳回
String

getTombstones

public  getTombstones ()

傳回

擲回
DeviceNotAvailableException

getTotalMemory

public long getTotalMemory ()

傳回
long

getUninstallablePackageNames

public  getUninstallablePackageNames ()

傳回

擲回
DeviceNotAvailableException

getUseFastbootErase

public boolean getUseFastbootErase ()

傳回
boolean

getUserFlags

public int getUserFlags (int userId)

參數
userId int

傳回
int

擲回
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

傳回

擲回
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

參數
userId int

傳回
int

擲回
DeviceNotAvailableException

handleAllocationEvent

public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

處理 DeviceEvent,這可能會或可能不會將裝置轉換為新的分配狀態。

參數
event DeviceEvent

傳回
IManagedTestDevice.DeviceEventResponse

hasFeature

public boolean hasFeature (String feature)

參數
feature String

傳回
boolean

擲回
DeviceNotAvailableException

installPackage

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

參數
packageFile File

reinstall boolean

extraArgs String

傳回
String

擲回
DeviceNotAvailableException

installPackage

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

參數
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

傳回
String

擲回
DeviceNotAvailableException

installPackageForUser

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

參數
packageFile File

reinstall boolean

userId int

extraArgs String

傳回
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

傳回
String

擲回
DeviceNotAvailableException

isAdbRoot

public boolean isAdbRoot ()

傳回
boolean

擲回
DeviceNotAvailableException

isAdbTcp

public boolean isAdbTcp ()

傳回
boolean

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

傳回
boolean

擲回
DeviceNotAvailableException

isDeviceEncrypted

public boolean isDeviceEncrypted ()

傳回
boolean

擲回
DeviceNotAvailableException

isDirectory

public boolean isDirectory (String path)

參數
path String

傳回
boolean

擲回
DeviceNotAvailableException

isEnableAdbRoot

public boolean isEnableAdbRoot ()

傳回
boolean true 是否應在裝置上啟用 ADB 根目錄

isEncryptionSupported

public boolean isEncryptionSupported ()

傳回
boolean

擲回
DeviceNotAvailableException

isExecutable

public boolean isExecutable (String fullPath)

參數
fullPath String

傳回
boolean

擲回
DeviceNotAvailableException

isFastbootEnabled

public boolean isFastbootEnabled ()

傳回
boolean

isHeadless

public boolean isHeadless ()

傳回
boolean

擲回
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

傳回
boolean

擲回
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

參數
packageName String

userId String

傳回
boolean

擲回
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

參數
packageName String

傳回
boolean

擲回
DeviceNotAvailableException

isRuntimePermissionSupported

public boolean isRuntimePermissionSupported ()

傳回
boolean

擲回
DeviceNotAvailableException

isStateBootloaderOrFastbootd

public boolean isStateBootloaderOrFastbootd ()

傳回
boolean

isUserRunning

public boolean isUserRunning (int userId)

參數
userId int

傳回
boolean

擲回
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

參數
userId int

傳回
boolean

擲回
DeviceNotAvailableException

isWifiEnabled

public boolean isWifiEnabled ()

傳回
boolean

擲回
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

傳回

擲回
DeviceNotAvailableException

listUsers

public  listUsers ()

傳回

擲回
DeviceNotAvailableException

logBugreport

public boolean logBugreport (String dataName, 
                ITestLogger listener)

參數
dataName String

listener ITestLogger

傳回
boolean

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 根目錄後,且在裝置重新上線前執行特定動作,請覆寫。預設實作方式不包含任何額外動作。系統不保證可在這個階段啟用 ADB 根目錄。

擲回
DeviceNotAvailableException

postAdbUnrootAction

public void postAdbUnrootAction ()

如果裝置需要在 adb 解除系統核心權限後,並在裝置重新上線前執行特定動作,請覆寫此值。預設實作方式不包含任何額外動作。系統不保證會在這個階段停用 ADB 根目錄。

擲回
DeviceNotAvailableException

postBootSetup

public void postBootSetup ()

擲回
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

參數
exception Throwable

preInvocationSetup

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

參數
info IBuildInfo

attributes MultiMap

擲回
DeviceNotAvailableException
TargetSetupError

pullDir

public boolean pullDir (String deviceFilePath, 
                File localDir)

參數
deviceFilePath String

localDir File

傳回
boolean

擲回
DeviceNotAvailableException

pullFile

public boolean pullFile (String remoteFilePath, 
                File localFile)

參數
remoteFilePath String

localFile File

傳回
boolean

擲回
DeviceNotAvailableException

pullFile

public File pullFile (String remoteFilePath)

參數
remoteFilePath String

傳回
File

擲回
DeviceNotAvailableException

pullFileContents

public String pullFileContents (String remoteFilePath)

參數
remoteFilePath String

傳回
String

擲回
DeviceNotAvailableException

pullFileFromExternal

public File pullFileFromExternal (String remoteFilePath)

參數
remoteFilePath String

傳回
File

擲回
DeviceNotAvailableException

pushDir

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

參數
localFileDir File

deviceFilePath String

excludedDirectories

傳回
boolean

擲回
DeviceNotAvailableException

pushDir

public boolean pushDir (File localFileDir, 
                String deviceFilePath)

參數
localFileDir File

deviceFilePath String

傳回
boolean

擲回
DeviceNotAvailableException

pushFile

public boolean pushFile (File localFile, 
                String remoteFilePath)

參數
localFile File

remoteFilePath String

傳回
boolean

擲回
DeviceNotAvailableException

pushString

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

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)

參數
autoReboot boolean

擲回
DeviceNotAvailableException

rebootUntilOnline

public void rebootUntilOnline ()

擲回
DeviceNotAvailableException

rebootUntilOnline

public void rebootUntilOnline (String reason)

參數
reason String

擲回
DeviceNotAvailableException

rebootUserspace

public void rebootUserspace ()

擲回
DeviceNotAvailableException

rebootUserspaceUntilOnline

public void rebootUserspaceUntilOnline ()

擲回
DeviceNotAvailableException

recoverDevice

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

傳回
boolean

擲回
DeviceNotAvailableException

removeOwners

public void removeOwners ()

擲回
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

參數
userId int

傳回
boolean

擲回
DeviceNotAvailableException

resetContentProviderSetup

public void resetContentProviderSetup ()

請重設內容供應器設定的旗標,以便再次觸發。

runInstrumentationTests

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

參數
runner IRemoteAndroidTestRunner

listeners ITestLifeCycleReceiver

傳回
boolean

擲回
DeviceNotAvailableException

runInstrumentationTests

public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                 listeners)

參數
runner IRemoteAndroidTestRunner

listeners

傳回
boolean

擲回
DeviceNotAvailableException

runInstrumentationTestsAsUser

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

參數
runner IRemoteAndroidTestRunner

userId int

listeners ITestLifeCycleReceiver

傳回
boolean

擲回
DeviceNotAvailableException

runInstrumentationTestsAsUser

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

參數
runner IRemoteAndroidTestRunner

userId int

listeners

傳回
boolean

擲回
DeviceNotAvailableException

setConfiguration

public void setConfiguration (IConfiguration configuration)

插入正在使用的 IConfiguration

參數
configuration IConfiguration

setDate

public void setDate (Date date)

參數
date Date

擲回
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

參數
componentName String

userId int

傳回
boolean

擲回
DeviceNotAvailableException

setDeviceState

public void setDeviceState (TestDeviceState deviceState)

參數
deviceState TestDeviceState

setEmulatorOutputStream

public void setEmulatorOutputStream (SizeLimitedOutputStream output)

針對模擬器,將 SizeLimitedOutputStream 設為記錄輸出

參數
output SizeLimitedOutputStream:記錄輸出內容

setEmulatorProcess

public void setEmulatorProcess (Process p)

參數
p Process

setFastbootEnabled

public void setFastbootEnabled (boolean fastbootEnabled)

參數
fastbootEnabled boolean

setFastbootPath

public void setFastbootPath (String fastbootPath)

參數
fastbootPath String

setIDevice

public void setIDevice (IDevice newDevice)

參數
newDevice IDevice

setOptions

public void setOptions (TestDeviceOptions options)

參數
options TestDeviceOptions

setProperty

public boolean setProperty (String propKey, 
                String propValue)

參數
propKey String

propValue String

傳回
boolean

擲回
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)

參數
userId int

傳回
boolean

擲回
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

參數
userId int

waitFlag boolean

傳回
boolean

擲回
DeviceNotAvailableException

stopEmulatorOutput

public void stopEmulatorOutput ()

stopLogcat

public void stopLogcat ()

stopUser

public boolean stopUser (int userId)

參數
userId int

傳回
boolean

擲回
DeviceNotAvailableException

stopUser

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

參數
userId int

waitFlag boolean

forceFlag boolean

傳回
boolean

擲回
DeviceNotAvailableException

switchToAdbTcp

public String switchToAdbTcp ()

傳回
String

擲回
DeviceNotAvailableException

switchToAdbUsb

public boolean switchToAdbUsb ()

傳回
boolean

擲回
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

參數
userId int

傳回
boolean

擲回
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

參數
userId int

timeout long

傳回
boolean

擲回
DeviceNotAvailableException

syncFiles

public boolean syncFiles (File localFileDir, 
                String deviceFilePath)

參數
localFileDir File

deviceFilePath String

傳回
boolean

擲回
DeviceNotAvailableException

takeBugreport

public Bugreport takeBugreport ()

傳回
Bugreport

unencryptDevice

public boolean unencryptDevice ()

傳回
boolean

擲回
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

參數
packageName String

傳回
String

擲回
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

參數
packageName String

userId int

傳回
String

擲回
DeviceNotAvailableException

unlockDevice

public boolean unlockDevice ()

傳回
boolean

擲回
DeviceNotAvailableException

waitForBootComplete

public boolean waitForBootComplete (long timeOut)

參數
timeOut long

傳回
boolean

擲回
DeviceNotAvailableException

waitForDeviceAvailable

public void waitForDeviceAvailable ()

擲回
DeviceNotAvailableException

waitForDeviceAvailable

public void waitForDeviceAvailable (long waitTime)

參數
waitTime long

擲回
DeviceNotAvailableException

waitForDeviceInRecovery

public boolean waitForDeviceInRecovery (long waitTime)

參數
waitTime long

傳回
boolean

waitForDeviceInSideload

public boolean waitForDeviceInSideload (long waitTime)

參數
waitTime long

傳回
boolean

waitForDeviceNotAvailable

public boolean waitForDeviceNotAvailable (long waitTime)

參數
waitTime long

傳回
boolean

waitForDeviceOnline

public void waitForDeviceOnline ()

擲回
DeviceNotAvailableException

waitForDeviceOnline

public void waitForDeviceOnline (long waitTime)

參數
waitTime long

擲回
DeviceNotAvailableException

waitForDeviceShell

public boolean waitForDeviceShell (long waitTime)

參數
waitTime long

傳回
boolean

受保護的方法

checkApiLevelAgainst

protected void checkApiLevelAgainst (String feature, 
                int strictMinLevel)

參數
feature String

strictMinLevel int

createRebootDeviceAction

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

建立 RebootDeviceAction,以便在執行重新啟動動作時使用。

參數
rebootMode NativeDevice.RebootMode:此重新啟動模式。

reason String:針對這次重新啟動。

傳回
NativeDevice.RebootDeviceAction 已建立的 RebootDeviceAction

doAdbReboot

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

執行 ADB 重新啟動。

參數
rebootMode NativeDevice.RebootMode:此重新啟動模式。

reason String:針對這次重新啟動。

擲回
DeviceNotAvailableException

ensureRuntimePermissionSupported

protected void ensureRuntimePermissionSupported ()

輔助方法,用於在系統不支援執行階段權限時擲回例外狀況

擲回
DeviceNotAvailableException

getBugreportInternal

protected InputStreamSource getBugreportInternal ()

傳回
InputStreamSource

getBugreportzInternal

protected File getBugreportzInternal ()

內部輔助程式方法,可取得 bugreportz ZIP 檔案做為 ERROR(/File)

傳回
File

getRunUtil

protected IRunUtil getRunUtil ()

取得要使用的 RunUtil 例項。

傳回
IRunUtil

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,系統就不會嘗試執行 fastboot 查詢

description String:變數的簡單說明。開頭字母應大寫。

傳回
String 字串 (可能為 null 或空白),其中包含指定屬性的值

擲回
DeviceNotAvailableException

isNewer

protected boolean isNewer (File localFile, 
                IFileEntry entry)

如果本機檔案比遠端檔案新,則傳回 trueIFileEntry 精確到分鐘,如果時間相同,則會視為較新的檔案。

參數
localFile File

entry IFileEntry

傳回
boolean

performDeviceAction

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 如果復原嘗試失敗,或已嘗試多次但未成功

postAdbReboot

protected void postAdbReboot ()

重新啟動後可採取的其他可能動作。

擲回
DeviceNotAvailableException

prePostBootSetup

protected void prePostBootSetup ()

允許每個裝置類型 (AndroidNativeDevice、TestDevice) 針對特定的開機後設定覆寫此方法。

擲回
DeviceNotAvailableException

setClock

protected void setClock (Clock clock)

設定要使用的 Clock 例項。

參數
clock Clock

setLogStartDelay

protected void setLogStartDelay (int delay)

設定在線上裝置開始擷取 logcat 前,等待的時間 (毫秒)。

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

waitForDeviceNotAvailable

protected void waitForDeviceNotAvailable (String operationDesc, 
                long time)

參數
operationDesc String

time long