透過集合功能整理內容 你可以依據偏好儲存及分類內容。

測試設備

public class TestDevice
extends NativeDevice

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


為全棧 android 設備實現ITestDevice

概括

字段

public static final String DISMISS_KEYGUARD_CMD

可用於解除鍵盤保護的命令。

公共構造函數

TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

公共方法

boolean clearErrorDialogs ()

int createUser (String name)

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

int createUserNoThrow (String name)

void disableKeyguard ()

boolean doesFileExist (String deviceFilePath)

File dumpHeap (String process, String devicePath)

getActiveApexes ()

getAllSettings (String namespace)

String getAndroidId (int userId)

getAndroidIds ()

PackageInfo getAppPackageInfo (String packageName)

getAppPackageInfos ()

DeviceFoldableState getCurrentFoldableState ()
int getCurrentUser ()

getFoldableStates ()
getInstalledPackageNames ()

KeyguardControllerState getKeyguardState ()

getMainlineModuleInfo ()

int getMaxNumberOfRunningUsersSupported ()

int getMaxNumberOfUsersSupported ()

Integer getPrimaryUserId ()

InputStreamSource getScreenshot ()

InputStreamSource getScreenshot (String format, boolean rescale)

InputStreamSource getScreenshot (String format)

InputStreamSource getScreenshot (long displayId)

String getSetting (String namespace, String key)

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

getUninstallablePackageNames ()

int getUserFlags (int userId)

getUserInfos ()

int getUserSerialNumber (int userId)

boolean hasFeature (String feature)

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

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

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

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

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

String installPackages ( packageFiles, boolean reinstall, String... extraArgs) installPackages ( packageFiles, boolean reinstall, String... extraArgs)

String installPackages ( packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs) installPackages ( packageFiles, boolean reinstall, boolean grantPermissions, String... extraArgs)

String installPackagesForUser ( packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) installPackagesForUser ( packageFiles, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)

String installPackagesForUser ( packageFiles, boolean reinstall, int userId, String... extraArgs) installPackagesForUser ( packageFiles, boolean reinstall, int userId, String... extraArgs)

String installRemotePackages ( remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs) installRemotePackages ( remoteApkPaths, boolean reinstall, boolean grantPermissions, String... extraArgs)

String installRemotePackages ( remoteApkPaths, boolean reinstall, String... extraArgs) installRemotePackages ( remoteApkPaths, boolean reinstall, String... extraArgs)

boolean isAppEnumerationSupported ()

boolean isMultiUserSupported ()

boolean isPackageInstalled (String packageName)

boolean isPackageInstalled (String packageName, String userId)

boolean isUserRunning (int userId)

boolean isUserSecondary (int userId)

listDisplayIds ()

listUsers ()

void postInvocationTearDown (Throwable exception)

boolean removeAdmin (String componentName, int userId)

void removeOwners ()

boolean removeUser (int userId)

boolean setDeviceOwner (String componentName, int userId)

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

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

boolean startUser (int userId)

boolean startUser (int userId, boolean waitFlag)

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

boolean stopUser (int userId)

boolean switchUser (int userId)

boolean switchUser (int userId, long timeout)

String uninstallPackage (String packageName)

String uninstallPackageForUser (String packageName, int userId)

受保護的方法

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

執行 adb 重啟。

long getCheckNewUserSleep ()

暴露用於測試。

long getHostCurrentTime ()

暴露於測試

void prePostBootSetup ()

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

字段

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

可用於解除鍵盤保護的命令。

公共構造函數

測試設備

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

公共方法

清除錯誤對話框

public boolean clearErrorDialogs ()

退貨
boolean

投擲
DeviceNotAvailableException

創建用戶

public int createUser (String name)

參數
name String

退貨
int

投擲
DeviceNotAvailableException

創建用戶

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

參數
name String

guest boolean

ephemeral boolean

退貨
int

投擲
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

參數
name String

退貨
int

投擲
DeviceNotAvailableException

禁用鍵盤保護

public void disableKeyguard ()

投擲
DeviceNotAvailableException

文件存在

public boolean doesFileExist (String deviceFilePath)

參數
deviceFilePath String

退貨
boolean

投擲
DeviceNotAvailableException

轉儲堆

public File dumpHeap (String process, 
                String devicePath)

參數
process String

devicePath String

退貨
File

投擲
DeviceNotAvailableException

獲取ActiveApex

public  getActiveApexes ()

退貨

投擲
DeviceNotAvailableException

獲取所有設置

public  getAllSettings (String namespace)

參數
namespace String

退貨

投擲
DeviceNotAvailableException

獲取AndroidId

public String getAndroidId (int userId)

參數
userId int

退貨
String

投擲
DeviceNotAvailableException

獲取AndroidIds

public  getAndroidIds ()

退貨

投擲
DeviceNotAvailableException

獲取應用程序包信息

public PackageInfo getAppPackageInfo (String packageName)

參數
packageName String

退貨
PackageInfo

投擲
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

退貨

投擲
DeviceNotAvailableException

獲取當前可折疊狀態

public DeviceFoldableState getCurrentFoldableState ()

退貨
DeviceFoldableState

投擲
DeviceNotAvailableException

獲取當前用戶

public int getCurrentUser ()

退貨
int

投擲
DeviceNotAvailableException

獲取可折疊狀態

public  getFoldableStates ()

退貨

投擲
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

退貨

投擲
DeviceNotAvailableException

獲取KeyguardState

public KeyguardControllerState getKeyguardState ()

退貨
KeyguardControllerState

投擲
DeviceNotAvailableException

獲取MainlineModuleInfo

public  getMainlineModuleInfo ()

退貨

投擲
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

退貨
int

投擲
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

退貨
int

投擲
DeviceNotAvailableException

獲取PrimaryUserId

public Integer getPrimaryUserId ()

退貨
Integer

投擲
DeviceNotAvailableException

獲取屏幕截圖

public InputStreamSource getScreenshot ()

退貨
InputStreamSource

投擲
DeviceNotAvailableException

獲取屏幕截圖

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

參數
format String

rescale boolean

退貨
InputStreamSource

投擲
DeviceNotAvailableException

獲取屏幕截圖

public InputStreamSource getScreenshot (String format)

參數
format String

退貨
InputStreamSource

投擲
DeviceNotAvailableException

獲取屏幕截圖

public InputStreamSource getScreenshot (long displayId)

參數
displayId long

退貨
InputStreamSource

投擲
DeviceNotAvailableException

獲取設置

public String getSetting (String namespace, 
                String key)

參數
namespace String

key String

退貨
String

投擲
DeviceNotAvailableException

獲取設置

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

參數
userId int

namespace String

key String

退貨
String

投擲
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

退貨

投擲
DeviceNotAvailableException

獲取用戶標誌

public int getUserFlags (int userId)

參數
userId int

退貨
int

投擲
DeviceNotAvailableException

獲取用戶信息

public  getUserInfos ()

退貨

投擲
DeviceNotAvailableException

獲取用戶序列號

public int getUserSerialNumber (int userId)

參數
userId int

退貨
int

投擲
DeviceNotAvailableException

有特點

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, 
                File certFile, 
                boolean reinstall, 
                String... extraArgs)

參數
packageFile File

certFile 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

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

installPackageForUser

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

參數
packageFile File

reinstall boolean

userId int

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

安裝包

public String installPackages ( packageFiles, 
                boolean reinstall, 
                String... extraArgs)

參數
packageFiles

reinstall boolean

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

安裝包

public String installPackages ( packageFiles, 
                boolean reinstall, 
                boolean grantPermissions, 
                String... extraArgs)

參數
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

installPackagesForUser

public String installPackagesForUser ( packageFiles, 
                boolean reinstall, 
                boolean grantPermissions, 
                int userId, 
                String... extraArgs)

參數
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

installPackagesForUser

public String installPackagesForUser ( packageFiles, 
                boolean reinstall, 
                int userId, 
                String... extraArgs)

參數
packageFiles

reinstall boolean

userId int

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

安裝遠程包

public String installRemotePackages ( remoteApkPaths, 
                boolean reinstall, 
                boolean grantPermissions, 
                String... extraArgs)

參數
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

安裝遠程包

public String installRemotePackages ( remoteApkPaths, 
                boolean reinstall, 
                String... extraArgs)

參數
remoteApkPaths

reinstall boolean

extraArgs String

退貨
String

投擲
DeviceNotAvailableException

isAppEnumeration 支持

public boolean isAppEnumerationSupported ()

退貨
boolean

投擲
DeviceNotAvailableException

支持多用戶

public boolean isMultiUserSupported ()

退貨
boolean

投擲
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

參數
packageName String

退貨
boolean

投擲
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

參數
packageName String

userId String

退貨
boolean

投擲
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

退貨

投擲
DeviceNotAvailableException

列表用戶

public  listUsers ()

退貨

投擲
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

參數
exception Throwable

刪除管理員

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

設置設備所有者

public boolean setDeviceOwner (String componentName, 
                int userId)

參數
componentName String

userId int

退貨
boolean

投擲
DeviceNotAvailableException

設置設置

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

啟動用戶

public boolean startUser (int userId)

參數
userId int

退貨
boolean

投擲
DeviceNotAvailableException

啟動用戶

public boolean startUser (int userId, 
                boolean waitFlag)

參數
userId int

waitFlag boolean

退貨
boolean

投擲
DeviceNotAvailableException

停止用戶

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

參數
userId int

waitFlag boolean

forceFlag boolean

退貨
boolean

投擲
DeviceNotAvailableException

停止用戶

public boolean stopUser (int userId)

參數
userId int

退貨
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 String uninstallPackage (String packageName)

參數
packageName String

退貨
String

投擲
DeviceNotAvailableException

卸載PackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

參數
packageName String

userId int

退貨
String

投擲
DeviceNotAvailableException

受保護的方法

doAdbReboot

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

執行 adb 重啟。

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

reason String :用於此重新啟動。

投擲
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

暴露用於測試。

退貨
long

獲取主機當前時間

protected long getHostCurrentTime ()

暴露於測試

退貨
long

prePostBootSetup

protected void prePostBootSetup ()

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

投擲
DeviceNotAvailableException