Google 致力于为黑人社区推动种族平等。查看具体举措
此页面由 Cloud Translation API 翻译。
Switch to English

测试设备

public class TestDevice
extends NativeDevice

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


ITestDevice的完整堆栈android设备的实现

摘要

领域

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

int getCurrentUser ()

getInstalledPackageNames ()

KeyguardControllerState getKeyguardState ()

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)

受保护的方法

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)

公开方法

clearErrorDialogs

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

disableKeyguard

public void disableKeyguard ()

投掷
DeviceNotAvailableException

didFileExist

public boolean doesFileExist (String deviceFilePath)

参量
deviceFilePath String

退货
boolean

投掷
DeviceNotAvailableException

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

参量
process String

devicePath String

退货
File

投掷
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

退货

投掷
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

参量
namespace String

退货

投掷
DeviceNotAvailableException

getAndroidId

public String getAndroidId (int userId)

参量
userId int

退货
String

投掷
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

退货

投掷
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

参量
packageName String

退货
PackageInfo

投掷
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

退货

投掷
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

退货
int

投掷
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

退货

投掷
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

退货
KeyguardControllerState

投掷
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

退货
int

投掷
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

退货
int

投掷
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

退货
Integer

投掷
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot ()

退货
InputStreamSource

投掷
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

参量
format String

rescale boolean

退货
InputStreamSource

投掷
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (String format)

参量
format String

退货
InputStreamSource

投掷
DeviceNotAvailableException

getScreenshot

public InputStreamSource getScreenshot (long displayId)

参量
displayId long

退货
InputStreamSource

投掷
DeviceNotAvailableException

getSetting

public String getSetting (String namespace, 
                String key)

参量
namespace String

key String

退货
String

投掷
DeviceNotAvailableException

getSetting

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

参量
userId int

namespace String

key String

退货
String

投掷
DeviceNotAvailableException

getUninstallablePackageNames

public  getUninstallablePackageNames ()

退货

投掷
DeviceNotAvailableException

getUserFlags

340

参量
userId int

退货
int

投掷
DeviceNotAvailableException

getUserInfos

public  getUserInfos ()

退货

投掷
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

参量
userId int

退货
int

投掷
DeviceNotAvailableException

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

参量
packageFile File

certFile 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, 
                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

installPackages

967

参量
packageFiles

reinstall boolean

extraArgs String

退货
String

投掷
DeviceNotAvailableException

installPackages

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

installRemotePackages

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

参量
remoteApkPaths

reinstall boolean

grantPermissions boolean

extraArgs String

退货
String

投掷
DeviceNotAvailableException

installRemotePackages

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

参量
remoteApkPaths

reinstall boolean

extraArgs String

退货
String

投掷
DeviceNotAvailableException

isAppEnumerationSupported

public boolean isAppEnumerationSupported ()

退货
boolean

投掷
DeviceNotAvailableException

isMultiUserSupported

public boolean isMultiUserSupported ()

退货
boolean

投掷
DeviceNotAvailableException

isPackage已安装

public boolean isPackageInstalled (String packageName)

参量
packageName String

退货
boolean

投掷
DeviceNotAvailableException

isPackage已安装

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

listUsers

public  listUsers ()

退货

投掷
DeviceNotAvailableException

postInvocationTearDown

public void postInvocationTearDown (Throwable exception)

参量
exception Throwable

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

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

参量
componentName String

userId int

退货
boolean

投掷
DeviceNotAvailableException

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

startUser

0

参量
userId int

退货
boolean

投掷
DeviceNotAvailableException

startUser

public boolean startUser (int userId, 
                boolean waitFlag)

参量
userId int

waitFlag boolean

退货
boolean

投掷
DeviceNotAvailableException

stopUser

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

参量
userId int

waitFlag boolean

forceFlag boolean

退货
boolean

投掷
DeviceNotAvailableException

stopUser

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

uninstallPackage

public String uninstallPackage (String packageName)

参量
packageName String

退货
String

投掷
DeviceNotAvailableException

受保护的方法

doAdbReboot

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

执行adb重新启动。

参量
rebootMode NativeDevice.RebootMode :此重新引导的模式。

reason String :此重启。

投掷
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

暴露于测试。

退货
long

getHostCurrentTime

protected long getHostCurrentTime ()

暴露于测试

退货
long

prePostBootSetup

protected void prePostBootSetup ()

允许每种设备类型(AndroidNativeDevice,TestDevice)针对特定的启动后设置覆盖此方法。

投掷
DeviceNotAvailableException