テストデバイス

public class TestDevice
extends NativeDevice

java.lang.オブジェクト
com.android.tradefed.device.NativeDevice
com.android.tradefed.device.TestDevice


フルスタック Android デバイス用のITestDeviceの実装

まとめ

田畑

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

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)

保護されたメソッド

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)

パブリックメソッド

クリアエラーダイアログ

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

キーガードを無効にする

public void disableKeyguard ()

投げる
DeviceNotAvailableException

ファイルが存在しますか

public boolean doesFileExist (String deviceFilePath)

パラメーター
deviceFilePath String

戻り値
boolean

投げる
DeviceNotAvailableException

ダンプヒープ

public File dumpHeap (String process, 
                String devicePath)

パラメーター
process String

devicePath String

戻り値
File

投げる
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

戻り値

投げる
DeviceNotAvailableException

すべての設定を取得

public  getAllSettings (String namespace)

パラメーター
namespace String

戻り値

投げる
DeviceNotAvailableException

AndroidIdを取得する

public String getAndroidId (int userId)

パラメーター
userId int

戻り値
String

投げる
DeviceNotAvailableException

AndroidID を取得する

public  getAndroidIds ()

戻り値

投げる
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

パラメーター
packageName String

戻り値
PackageInfo

投げる
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

戻り値

投げる
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

戻り値
DeviceFoldableState

投げる
DeviceNotAvailableException

現在のユーザーを取得

public int getCurrentUser ()

戻り値
int

投げる
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

戻り値

投げる
DeviceNotAvailableException

getInstalledPackageNames

public  getInstalledPackageNames ()

戻り値

投げる
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

戻り値
KeyguardControllerState

投げる
DeviceNotAvailableException

getMainlineModuleInfo

public  getMainlineModuleInfo ()

戻り値

投げる
DeviceNotAvailableException

getMaxNumberOfRunningUsersSupported

public int getMaxNumberOfRunningUsersSupported ()

戻り値
int

投げる
DeviceNotAvailableException

getMaxNumberOfUsersSupported

public int getMaxNumberOfUsersSupported ()

戻り値
int

投げる
DeviceNotAvailableException

getPrimaryUserId

public Integer getPrimaryUserId ()

戻り値
Integer

投げる
DeviceNotAvailableException

スクリーンショットの取得

public InputStreamSource getScreenshot ()

戻り値
InputStreamSource

投げる
DeviceNotAvailableException

スクリーンショットの取得

public InputStreamSource getScreenshot (String format, 
                boolean rescale)

パラメーター
format String

rescale boolean

戻り値
InputStreamSource

投げる
DeviceNotAvailableException

スクリーンショットの取得

public InputStreamSource getScreenshot (String format)

パラメーター
format String

戻り値
InputStreamSource

投げる
DeviceNotAvailableException

スクリーンショットの取得

public InputStreamSource getScreenshot (long displayId)

パラメーター
displayId long

戻り値
InputStreamSource

投げる
DeviceNotAvailableException

設定の取得

public String getSetting (String namespace, 
                String key)

パラメーター
namespace String

key String

戻り値
String

投げる
DeviceNotAvailableException

設定の取得

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

ユーザー情報の取得

public  getUserInfos ()

戻り値

投げる
DeviceNotAvailableException

getUserSerialNumber

public int getUserSerialNumber (int userId)

パラメーター
userId int

戻り値
int

投げる
DeviceNotAvailableException

機能あり

public boolean hasFeature (String feature)

パラメーター
feature String

戻り値
boolean

投げる
DeviceNotAvailableException

インストールパッケージ

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

パラメーター
packageFile File

reinstall boolean

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

インストールパッケージ

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

パラメーター
packageFile File

certFile File

reinstall boolean

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

インストールパッケージ

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

パラメーター
packageFile File

reinstall boolean

grantPermissions boolean

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

ユーザー向けのインストールパッケージ

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

ユーザー向けのインストールパッケージ

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

パラメーター
packageFile File

reinstall boolean

userId int

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

パッケージのインストール

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

パラメーター
packageFiles

reinstall boolean

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

パッケージのインストール

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

パラメーター
packageFiles

reinstall boolean

grantPermissions boolean

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

ユーザー向けのインストールパッケージ

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

パラメーター
packageFiles

reinstall boolean

grantPermissions boolean

userId int

extraArgs String

戻り値
String

投げる
DeviceNotAvailableException

ユーザー向けのインストールパッケージ

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

マルチユーザーサポートです

public boolean isMultiUserSupported ()

戻り値
boolean

投げる
DeviceNotAvailableException

パッケージがインストールされています

public boolean isPackageInstalled (String packageName)

パラメーター
packageName String

戻り値
boolean

投げる
DeviceNotAvailableException

パッケージがインストールされています

public boolean isPackageInstalled (String packageName, 
                String userId)

パラメーター
packageName String

userId String

戻り値
boolean

投げる
DeviceNotAvailableException

ユーザーが実行中です

public boolean isUserRunning (int userId)

パラメーター
userId int

戻り値
boolean

投げる
DeviceNotAvailableException

isUserSecondary

public boolean isUserSecondary (int userId)

パラメーター
userId int

戻り値
boolean

投げる
DeviceNotAvailableException

listDisplayIds

public  listDisplayIds ()

戻り値

投げる
DeviceNotAvailableException

ユーザーのリスト

public  listUsers ()

戻り値

投げる
DeviceNotAvailableException

post呼び出しTearDown

public void postInvocationTearDown (Throwable exception)

パラメーター
exception Throwable

管理者の削除

public boolean removeAdmin (String componentName, 
                int userId)

パラメーター
componentName String

userId int

戻り値
boolean

投げる
DeviceNotAvailableException

所有者を削除する

public void removeOwners ()

投げる
DeviceNotAvailableException

ユーザーの削除

public boolean removeUser (int userId)

パラメーター
userId int

戻り値
boolean

投げる
DeviceNotAvailableException

setDeviceOwner

public boolean setDeviceOwner (String componentName, 
                int userId)

パラメーター
componentName String

userId int

戻り値
boolean

投げる
DeviceNotAvailableException

セット設定

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

パラメーター
namespace String

key String

value String

投げる
DeviceNotAvailableException

セット設定

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

パラメーター
userId int

namespace String

key String

value String

投げる
DeviceNotAvailableException

スタートユーザー

public boolean startUser (int userId)

パラメーター
userId int

戻り値
boolean

投げる
DeviceNotAvailableException

スタートユーザー

public boolean startUser (int userId, 
                boolean waitFlag)

パラメーター
userId int

waitFlag boolean

戻り値
boolean

投げる
DeviceNotAvailableException

停止ユーザー

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

パラメーター
userId int

waitFlag boolean

forceFlag boolean

戻り値
boolean

投げる
DeviceNotAvailableException

停止ユーザー

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

アンインストールパッケージ

public String uninstallPackage (String packageName)

パラメーター
packageName String

戻り値
String

投げる
DeviceNotAvailableException

アンインストールパッケージユーザー用

public String uninstallPackageForUser (String packageName, 
                int userId)

パラメーター
packageName String

userId int

戻り値
String

投げる
DeviceNotAvailableException

保護されたメソッド

doAdbReboot

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

adb の再起動を実行します。

パラメーター
rebootMode NativeDevice.RebootMode : この再起動のモード。

reason String : 今回の再起動用。

投げる
DeviceNotAvailableException

getCheckNewUserSleep

protected long getCheckNewUserSleep ()

テストのために露出しました。

戻り値
long

getホスト現在時刻

protected long getHostCurrentTime ()

テストのために暴露された

戻り値
long

ブート後のセットアップ

protected void prePostBootSetup ()

各デバイス タイプ (AndroidNativeDevice、TestDevice) が特定の起動後のセットアップ用にこのメソッドをオーバーライドできるようにします。

投げる
DeviceNotAvailableException