Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release
, bukan aosp-main
, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
TestDevice
public
class
TestDevice
extends NativeDevice
Subclass langsung yang dikenal
ManagedRemoteDevice |
Perangkat yang berjalan di dalam virtual machine yang kita kelola dari jarak jauh melalui instance Tradefed di dalam VM.
|
NestedRemoteDevice |
Representasi perangkat yang berjalan di dalam VM Cuttlefish jarak jauh.
|
RemoteAndroidDevice |
Implementasi ITestDevice untuk perangkat Android stack penuh yang terhubung melalui
adb connect.
|
|
Subclass tidak langsung yang umum
|
Implementasi ITestDevice
untuk perangkat Android stack penuh
Ringkasan
Kolom |
public
static
final
String |
DISMISS_KEYGUARD_CMD
Perintah yang dapat digunakan untuk menutup pelindung kunci.
|
Metode publik |
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)
|
Kolom
DISMISS_KEYGUARD_CMD
public static final String DISMISS_KEYGUARD_CMD
Perintah yang dapat digunakan untuk menutup pelindung kunci.
Konstruktor publik
TestDevice
public TestDevice (IDevice device,
IDeviceStateMonitor stateMonitor,
IDeviceMonitor allocationMonitor)
Metode publik
clearErrorDialogs
public boolean clearErrorDialogs ()
Menampilkan |
DeviceNotAvailableException |
|
createUser
public int createUser (String name)
Menampilkan |
DeviceNotAvailableException |
|
createUser
public int createUser (String name,
boolean guest,
boolean ephemeral)
Parameter |
name |
String |
guest |
boolean |
ephemeral |
boolean |
Menampilkan |
DeviceNotAvailableException |
|
createUserNoThrow
public int createUserNoThrow (String name)
Menampilkan |
DeviceNotAvailableException |
|
disableKeyguard
public void disableKeyguard ()
Menampilkan |
DeviceNotAvailableException |
|
doesFileExist
public boolean doesFileExist (String deviceFilePath)
Parameter |
deviceFilePath |
String |
Menampilkan |
DeviceNotAvailableException |
|
dumpHeap
public File dumpHeap (String process,
String devicePath)
Parameter |
process |
String |
devicePath |
String |
Menampilkan |
DeviceNotAvailableException |
|
getActiveApexes
public getActiveApexes ()
Menampilkan |
DeviceNotAvailableException |
|
getAllSettings
public getAllSettings (String namespace)
Parameter |
namespace |
String |
Menampilkan |
DeviceNotAvailableException |
|
getAndroidId
public String getAndroidId (int userId)
Menampilkan |
DeviceNotAvailableException |
|
getAndroidIds
public getAndroidIds ()
Menampilkan |
DeviceNotAvailableException |
|
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Parameter |
packageName |
String |
Menampilkan |
DeviceNotAvailableException |
|
getAppPackageInfos
public getAppPackageInfos ()
Menampilkan |
DeviceNotAvailableException |
|
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Hasil |
DeviceFoldableState |
|
Menampilkan |
DeviceNotAvailableException |
|
getCurrentUser
public int getCurrentUser ()
Menampilkan |
DeviceNotAvailableException |
|
getFoldableStates
public getFoldableStates ()
Menampilkan |
DeviceNotAvailableException |
|
getInstalledPackageNames
public getInstalledPackageNames ()
Menampilkan |
DeviceNotAvailableException |
|
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Hasil |
KeyguardControllerState |
|
Menampilkan |
DeviceNotAvailableException |
|
getMainlineModuleInfo
public getMainlineModuleInfo ()
Menampilkan |
DeviceNotAvailableException |
|
public int getMaxNumberOfRunningUsersSupported ()
Menampilkan |
DeviceNotAvailableException |
|
public int getMaxNumberOfUsersSupported ()
Menampilkan |
DeviceNotAvailableException |
|
getPrimaryUserId
public Integer getPrimaryUserId ()
Menampilkan |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot ()
Menampilkan |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (String format,
boolean rescale)
Parameter |
format |
String |
rescale |
boolean |
Menampilkan |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (String format)
Menampilkan |
DeviceNotAvailableException |
|
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Menampilkan |
DeviceNotAvailableException |
|
getSetting
public String getSetting (String namespace,
String key)
Parameter |
namespace |
String |
key |
String |
Menampilkan |
DeviceNotAvailableException |
|
getSetting
public String getSetting (int userId,
String namespace,
String key)
Parameter |
userId |
int |
namespace |
String |
key |
String |
Menampilkan |
DeviceNotAvailableException |
|
getUninstallablePackageNames
public getUninstallablePackageNames ()
Menampilkan |
DeviceNotAvailableException |
|
getUserFlags
public int getUserFlags (int userId)
Menampilkan |
DeviceNotAvailableException |
|
getUserInfos
public getUserInfos ()
Menampilkan |
DeviceNotAvailableException |
|
getUserSerialNumber
public int getUserSerialNumber (int userId)
Menampilkan |
DeviceNotAvailableException |
|
hasFeature
public boolean hasFeature (String feature)
Menampilkan |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
boolean reinstall,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
File certFile,
boolean reinstall,
String... extraArgs)
Parameter |
packageFile |
File |
certFile |
File |
reinstall |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackage
public String installPackage (File packageFile,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
grantPermissions |
boolean |
userId |
int |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackageForUser
public String installPackageForUser (File packageFile,
boolean reinstall,
int userId,
String... extraArgs)
Parameter |
packageFile |
File |
reinstall |
boolean |
userId |
int |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackages
public String installPackages ( packageFiles,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
boolean grantPermissions,
int userId,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
grantPermissions |
boolean |
userId |
int |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installPackagesForUser
public String installPackagesForUser ( packageFiles,
boolean reinstall,
int userId,
String... extraArgs)
Parameter |
packageFiles |
|
reinstall |
boolean |
userId |
int |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
boolean grantPermissions,
String... extraArgs)
Parameter |
remoteApkPaths |
|
reinstall |
boolean |
grantPermissions |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
installRemotePackages
public String installRemotePackages ( remoteApkPaths,
boolean reinstall,
String... extraArgs)
Parameter |
remoteApkPaths |
|
reinstall |
boolean |
extraArgs |
String |
Menampilkan |
DeviceNotAvailableException |
|
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Menampilkan |
DeviceNotAvailableException |
|
isMultiUserSupported
public boolean isMultiUserSupported ()
Menampilkan |
DeviceNotAvailableException |
|
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Parameter |
packageName |
String |
Menampilkan |
DeviceNotAvailableException |
|
isPackageInstalled
public boolean isPackageInstalled (String packageName,
String userId)
Parameter |
packageName |
String |
userId |
String |
Menampilkan |
DeviceNotAvailableException |
|
isUserRunning
public boolean isUserRunning (int userId)
Menampilkan |
DeviceNotAvailableException |
|
isUserSecondary
public boolean isUserSecondary (int userId)
Menampilkan |
DeviceNotAvailableException |
|
listDisplayIds
public listDisplayIds ()
Menampilkan |
DeviceNotAvailableException |
|
listUsers
public listUsers ()
Menampilkan |
DeviceNotAvailableException |
|
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Parameter |
exception |
Throwable |
removeAdmin
public boolean removeAdmin (String componentName,
int userId)
Parameter |
componentName |
String |
userId |
int |
Menampilkan |
DeviceNotAvailableException |
|
removeOwners
public void removeOwners ()
Menampilkan |
DeviceNotAvailableException |
|
removeUser
public boolean removeUser (int userId)
Menampilkan |
DeviceNotAvailableException |
|
setDeviceOwner
public boolean setDeviceOwner (String componentName,
int userId)
Parameter |
componentName |
String |
userId |
int |
Menampilkan |
DeviceNotAvailableException |
|
setSetting
public void setSetting (String namespace,
String key,
String value)
Parameter |
namespace |
String |
key |
String |
value |
String |
Menampilkan |
DeviceNotAvailableException |
|
setSetting
public void setSetting (int userId,
String namespace,
String key,
String value)
Parameter |
userId |
int |
namespace |
String |
key |
String |
value |
String |
Menampilkan |
DeviceNotAvailableException |
|
startUser
public boolean startUser (int userId)
Menampilkan |
DeviceNotAvailableException |
|
startUser
public boolean startUser (int userId,
boolean waitFlag)
Parameter |
userId |
int |
waitFlag |
boolean |
Menampilkan |
DeviceNotAvailableException |
|
stopUser
public boolean stopUser (int userId,
boolean waitFlag,
boolean forceFlag)
Parameter |
userId |
int |
waitFlag |
boolean |
forceFlag |
boolean |
Menampilkan |
DeviceNotAvailableException |
|
stopUser
public boolean stopUser (int userId)
Menampilkan |
DeviceNotAvailableException |
|
switchUser
public boolean switchUser (int userId)
Menampilkan |
DeviceNotAvailableException |
|
switchUser
public boolean switchUser (int userId,
long timeout)
Parameter |
userId |
int |
timeout |
long |
Menampilkan |
DeviceNotAvailableException |
|
uninstallPackage
public String uninstallPackage (String packageName)
Parameter |
packageName |
String |
Menampilkan |
DeviceNotAvailableException |
|
uninstallPackageForUser
public String uninstallPackageForUser (String packageName,
int userId)
Parameter |
packageName |
String |
userId |
int |
Menampilkan |
DeviceNotAvailableException |
|
Metode yang dilindungi
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode,
String reason)
Lakukan mulai ulang adb.
Parameter |
rebootMode |
NativeDevice.RebootMode : mode mulai ulang ini. |
reason |
String : untuk mulai ulang ini. |
Menampilkan |
DeviceNotAvailableException |
|
getCheckNewUserSleep
protected long getCheckNewUserSleep ()
Ditampilkan untuk pengujian.
getHostCurrentTime
protected long getHostCurrentTime ()
Diekspos untuk pengujian
prePostBootSetup
protected void prePostBootSetup ()
Memungkinkan setiap jenis perangkat (AndroidNativeDevice, TestDevice) mengganti metode ini untuk
penyiapan pasca-booting tertentu.
Menampilkan |
DeviceNotAvailableException |
|
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-03-26 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-03-26 UTC."],[],[]]