Thiết bị kiểm tra

public class TestDevice
extends NativeDevice

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


Triển khai ITestDevice cho thiết bị Android đầy đủ

Bản tóm tắt

Lĩnh vực

public static final String DISMISS_KEYGUARD_CMD

Các lệnh có thể được sử dụng để loại bỏ keyguard.

Nhà thầu xây dựng công cộng

TestDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Phương pháp công cộng

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)

Phương pháp được bảo vệ

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

Thực hiện khởi động lại adb.

long getCheckNewUserSleep ()

Tiếp xúc để thử nghiệm.

long getHostCurrentTime ()

Tiếp xúc để thử nghiệm

void prePostBootSetup ()

Cho phép từng loại thiết bị (AndroidNativeDevice, TestDevice) ghi đè phương thức này để thiết lập sau khi khởi động cụ thể.

Lĩnh vực

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Các lệnh có thể được sử dụng để loại bỏ keyguard.

Nhà thầu xây dựng công cộng

Thiết bị kiểm tra

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

Phương pháp công cộng

ClearErrorDialogs

public boolean clearErrorDialogs ()

Trả lại
boolean

Ném
DeviceNotAvailableException

tạo người dùng

public int createUser (String name)

Thông số
name String

Trả lại
int

Ném
DeviceNotAvailableException

tạo người dùng

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

Thông số
name String

guest boolean

ephemeral boolean

Trả lại
int

Ném
DeviceNotAvailableException

tạoUserNoThrow

public int createUserNoThrow (String name)

Thông số
name String

Trả lại
int

Ném
DeviceNotAvailableException

vô hiệu hóaKeyguard

public void disableKeyguard ()

Ném
DeviceNotAvailableException

khôngFileExist

public boolean doesFileExist (String deviceFilePath)

Thông số
deviceFilePath String

Trả lại
boolean

Ném
DeviceNotAvailableException

đổ đống

public File dumpHeap (String process, 
                String devicePath)

Thông số
process String

devicePath String

Trả lại
File

Ném
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Trả lại

Ném
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Thông số
namespace String

Trả lại

Ném
DeviceNotAvailableException

lấy ID Android

public String getAndroidId (int userId)

Thông số
userId int

Trả lại
String

Ném
DeviceNotAvailableException

lấy ID Android

public  getAndroidIds ()

Trả lại

Ném
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Thông số
packageName String

Trả lại
PackageInfo

Ném
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Trả lại

Ném
DeviceNotAvailableException

get CurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Trả lại
DeviceFoldableState

Ném
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Trả lại
int

Ném
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Trả lại

Ném
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Trả lại

Ném
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Trả lại
KeyguardControllerState

Ném
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Trả lại

Ném
DeviceNotAvailableException

getMaxNumberOfRunningUsersĐược hỗ trợ

public int getMaxNumberOfRunningUsersSupported ()

Trả lại
int

Ném
DeviceNotAvailableException

getMaxNumberOfUsersĐược hỗ trợ

public int getMaxNumberOfUsersSupported ()

Trả lại
int

Ném
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Trả lại
Integer

Ném
DeviceNotAvailableException

lấy Ảnh chụp màn hình

public InputStreamSource getScreenshot ()

Trả lại
InputStreamSource

Ném
DeviceNotAvailableException

lấy Ảnh chụp màn hình

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Thông số
format String

rescale boolean

Trả lại
InputStreamSource

Ném
DeviceNotAvailableException

lấy Ảnh chụp màn hình

public InputStreamSource getScreenshot (String format)

Thông số
format String

Trả lại
InputStreamSource

Ném
DeviceNotAvailableException

lấy Ảnh chụp màn hình

public InputStreamSource getScreenshot (long displayId)

Thông số
displayId long

Trả lại
InputStreamSource

Ném
DeviceNotAvailableException

cài đặt

public String getSetting (String namespace, 
                String key)

Thông số
namespace String

key String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặt

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

Thông số
userId int

namespace String

key String

Trả lại
String

Ném
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Trả lại

Ném
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Thông số
userId int

Trả lại
int

Ném
DeviceNotAvailableException

lấy thông tin người dùng

public  getUserInfos ()

Trả lại

Ném
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Thông số
userId int

Trả lại
int

Ném
DeviceNotAvailableException

có tính năng

public boolean hasFeature (String feature)

Thông số
feature String

Trả lại
boolean

Ném
DeviceNotAvailableException

cài đặt gói

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

Thông số
packageFile File

reinstall boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặt gói

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

Thông số
packageFile File

certFile File

reinstall boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặt gói

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

Thông số
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtPackageForUser

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

Thông số
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtPackageForUser

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

Thông số
packageFile File

reinstall boolean

userId int

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtGói

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

Thông số
packageFiles

reinstall boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtGói

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

Thông số
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtGóiForUser

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

Thông số
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtGóiForUser

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

Thông số
packageFiles

reinstall boolean

userId int

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtRemotePackages

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

Thông số
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

cài đặtRemotePackages

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

Thông số
remoteApkPaths

reinstall boolean

extraArgs String

Trả lại
String

Ném
DeviceNotAvailableException

isAppEnumerationĐược hỗ trợ

public boolean isAppEnumerationSupported ()

Trả lại
boolean

Ném
DeviceNotAvailableException

isMultiUserĐược hỗ trợ

public boolean isMultiUserSupported ()

Trả lại
boolean

Ném
DeviceNotAvailableException

isPackageĐã cài đặt

public boolean isPackageInstalled (String packageName)

Thông số
packageName String

Trả lại
boolean

Ném
DeviceNotAvailableException

isPackageĐã cài đặt

public boolean isPackageInstalled (String packageName, 
                String userId)

Thông số
packageName String

userId String

Trả lại
boolean

Ném
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Thông số
userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Thông số
userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

danh sáchId hiển thị

public  listDisplayIds ()

Trả lại

Ném
DeviceNotAvailableException

danh sáchNgười dùng

public  listUsers ()

Trả lại

Ném
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Thông số
exception Throwable

xóaQuản trị viên

public boolean removeAdmin (String componentName, 
                int userId)

Thông số
componentName String

userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

xóaChủ sở hữu

public void removeOwners ()

Ném
DeviceNotAvailableException

xóaNgười dùng

public boolean removeUser (int userId)

Thông số
userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

setChủ sở hữu thiết bị

public boolean setDeviceOwner (String componentName, 
                int userId)

Thông số
componentName String

userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

setSetting

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

Thông số
namespace String

key String

value String

Ném
DeviceNotAvailableException

setSetting

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

Thông số
userId int

namespace String

key String

value String

Ném
DeviceNotAvailableException

người dùng bắt đầu

public boolean startUser (int userId)

Thông số
userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

người dùng bắt đầu

public boolean startUser (int userId, 
                boolean waitFlag)

Thông số
userId int

waitFlag boolean

Trả lại
boolean

Ném
DeviceNotAvailableException

dừng lạiNgười dùng

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

Thông số
userId int

waitFlag boolean

forceFlag boolean

Trả lại
boolean

Ném
DeviceNotAvailableException

dừng lạiNgười dùng

public boolean stopUser (int userId)

Thông số
userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

người dùng chuyển đổi

public boolean switchUser (int userId)

Thông số
userId int

Trả lại
boolean

Ném
DeviceNotAvailableException

người dùng chuyển đổi

public boolean switchUser (int userId, 
                long timeout)

Thông số
userId int

timeout long

Trả lại
boolean

Ném
DeviceNotAvailableException

gỡ cài đặtGói

public String uninstallPackage (String packageName)

Thông số
packageName String

Trả lại
String

Ném
DeviceNotAvailableException

gỡ cài đặtPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Thông số
packageName String

userId int

Trả lại
String

Ném
DeviceNotAvailableException

Phương pháp được bảo vệ

doAdbKhởi động lại

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

Thực hiện khởi động lại adb.

Thông số
rebootMode NativeDevice.RebootMode : một chế độ khởi động lại này.

reason String : cho lần khởi động lại này.

Ném
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Tiếp xúc để thử nghiệm.

Trả lại
long

getHostCurrentTime

protected long getHostCurrentTime ()

Tiếp xúc để thử nghiệm

Trả lại
long

prePostBootSetup

protected void prePostBootSetup ()

Cho phép từng loại thiết bị (AndroidNativeDevice, TestDevice) ghi đè phương thức này để thiết lập sau khi khởi động cụ thể.

Ném
DeviceNotAvailableException