Google is committed to advancing racial equity for Black communities. See how.
本頁面由 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

public int getUserFlags (int userId)

參量
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

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

參量
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

public boolean startUser (int userId)

參量
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