TestDevice

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 toàn bộ ngăn xếp

Tóm tắt

Trường

public static final String DISMISS_KEYGUARD_CMD

Các lệnh có thể dùng để đóng màn hình khoá.

Hàm khởi tạo công khai

TestDevice(IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Phương thức công khai

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)

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

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

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

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

String 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 thức được bảo vệ

void doAdbReboot(NativeDevice.RebootMode rebootMode, String reason)

Khởi động lại adb.

long getCheckNewUserSleep()

Được hiển thị để kiểm thử.

long getHostCurrentTime()

Được hiển thị để kiểm thử

void prePostBootSetup()

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

Trường

DISMISS_KEYGUARD_CMD

public static final String DISMISS_KEYGUARD_CMD

Các lệnh có thể dùng để đóng màn hình khoá.

Hàm khởi tạo công khai

TestDevice

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

Phương thức công khai

clearErrorDialogs

public boolean clearErrorDialogs ()

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

createUser

public int createUser (String name)

Tham số
name String

Giá trị trả về
int

Gửi
DeviceNotAvailableException

createUser

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

Tham số
name String

guest boolean

ephemeral boolean

Giá trị trả về
int

Gửi
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Tham số
name String

Giá trị trả về
int

Gửi
DeviceNotAvailableException

disableKeyguard

public void disableKeyguard ()

Gửi
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath)

Tham số
deviceFilePath String

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Tham số
process String

devicePath String

Giá trị trả về
File

Gửi
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Tham số
namespace String

Giá trị trả về

Gửi
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

Tham số
userId int

Giá trị trả về
String

Gửi
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Tham số
packageName String

Giá trị trả về
PackageInfo

Gửi
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Giá trị trả về
DeviceFoldableState

Gửi
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Giá trị trả về
int

Gửi
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Giá trị trả về
KeyguardControllerState

Gửi
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

Giá trị trả về
int

Gửi
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

Giá trị trả về
int

Gửi
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

Giá trị trả về
Integer

Gửi
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

Giá trị trả về
InputStreamSource

Gửi
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

Tham số
format String

rescale boolean

Giá trị trả về
InputStreamSource

Gửi
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

Tham số
format String

Giá trị trả về
InputStreamSource

Gửi
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

Tham số
displayId long

Giá trị trả về
InputStreamSource

Gửi
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

Tham số
namespace String

key String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

getSetting

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

Tham số
userId int

namespace String

key String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getUserFlags

public int getUserFlags (int userId)

Tham số
userId int

Giá trị trả về
int

Gửi
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

Giá trị trả về

Gửi
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

Tham số
userId int

Giá trị trả về
int

Gửi
DeviceNotAvailableException

hasFeature

public boolean hasFeature (String feature)

Tham số
feature String

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

installPackage

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

Tham số
packageFile File

reinstall boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackage

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

Tham số
packageFile File

certFile File

reinstall boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackage

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

Tham số
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackageForUser

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

Tham số
packageFile File

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackageForUser

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

Tham số
packageFile File

reinstall boolean

userId int

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackages

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

Tham số
packageFiles

reinstall boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackages

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

Tham số
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackagesForUser

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

Tham số
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installPackagesForUser

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

Tham số
packageFiles

reinstall boolean

userId int

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installRemotePackages

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

Tham số
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

installRemotePackages

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

Tham số
remoteApkPaths

reinstall boolean

extraArgs String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName)

Tham số
packageName String

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

isPackageInstalled

public boolean isPackageInstalled (String packageName, 
                String userId)

Tham số
packageName String

userId String

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

isUserRunning

public boolean isUserRunning (int userId)

Tham số
userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

Tham số
userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

Giá trị trả về

Gửi
DeviceNotAvailableException

listUsers

public  listUsers ()

Giá trị trả về

Gửi
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

Tham số
exception Throwable

removeAdmin

public boolean removeAdmin (String componentName, 
                int userId)

Tham số
componentName String

userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

removeOwners

public void removeOwners ()

Gửi
DeviceNotAvailableException

removeUser

public boolean removeUser (int userId)

Tham số
userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

Tham số
componentName String

userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

setSetting

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

Tham số
namespace String

key String

value String

Gửi
DeviceNotAvailableException

setSetting

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

Tham số
userId int

namespace String

key String

value String

Gửi
DeviceNotAvailableException

startUser

public boolean startUser (int userId)

Tham số
userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

Tham số
userId int

waitFlag boolean

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

stopUser

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

Tham số
userId int

waitFlag boolean

forceFlag boolean

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

stopUser

public boolean stopUser (int userId)

Tham số
userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId)

Tham số
userId int

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

switchUser

public boolean switchUser (int userId, 
                long timeout)

Tham số
userId int

timeout long

Giá trị trả về
boolean

Gửi
DeviceNotAvailableException

uninstallPackage

public String uninstallPackage (String packageName)

Tham số
packageName String

Giá trị trả về
String

Gửi
DeviceNotAvailableException

uninstallPackageForUser

public String uninstallPackageForUser (String packageName, 
                int userId)

Tham số
packageName String

userId int

Giá trị trả về
String

Gửi
DeviceNotAvailableException

Phương thức được bảo vệ

doAdbReboot

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

Khởi động lại adb.

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

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

Gửi
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

Được hiển thị để kiểm thử.

Giá trị trả về
long

getHostCurrentTime

protected long getHostCurrentTime ()

Được hiển thị để kiểm thử

Giá trị trả về
long

prePostBootSetup

protected void prePostBootSetup ()

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

Gửi
DeviceNotAvailableException