네이티브 장치
public class NativeDevice
extends Object
implements IManagedTestDevice , IConfigurationReceiver , ITestLoggerReceiver
java.lang.객체 | |
↳ | com.android.tradefed.device.NativeDevice |
ITestDevice
전체 스택이 아닌 Android 기기의 기본 구현입니다.
요약
중첩 클래스 | |
---|---|
class | NativeDevice.AdbAction OS 'adb ....' 명령 실행에 대한 |
class | NativeDevice.AdbShellAction |
class | NativeDevice.RebootDeviceAction 기기 재부팅에 대한 |
상수 | |
---|---|
int | INVALID_USER_ID 유효하지 않거나 찾을 수 없는 사용자 ID에 대해 반환된 값: UserHandle이 -10000 값을 정의했습니다. |
long | MAX_HOST_DEVICE_TIME_OFFSET |
int | MAX_RETRY_ATTEMPTS 수행을 시도하는 기본 명령 재시도 횟수 |
필드 | |
---|---|
protected static final String | SD_CARD |
protected static final String | STORAGE_EMULATED |
protected TestDeviceOptions | mOptions |
protected final IDeviceStateMonitor | mStateMonitor
|
공개 생성자 | |
---|---|
NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor) |
공개 방법 | |
---|---|
void | batchPrefetchStartupBuildProps () 각각에 대해 'adb getprop'를 호출하는 대신 필요한 모든 소품을 미리 가져오는 미세 최적화(약 400밀리초). |
boolean | canSwitchToHeadlessSystemUser () 헤드리스 SYSTEM 사용자로 전환할 수 있는지 여부를 반환합니다. |
boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) 최소 지원 수준에서 기능이 현재 지원되는지 여부를 확인합니다. |
boolean | checkConnectivity () 장치가 네트워크에 연결되어 있는지 확인하십시오. |
boolean | clearErrorDialogs () 현재 장치 UI에 표시된 오류 대화 상자를 닫으십시오. |
void | clearLastConnectedWifiNetwork () 마지막으로 연결된 Wi-Fi 네트워크를 지웁니다. |
void | clearLogcat () 누적된 모든 logcat 데이터를 삭제합니다. |
boolean | connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) Wi-Fi 네트워크에 연결합니다. |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk) Wi-Fi 네트워크에 연결합니다. |
boolean | connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk) Wi-Fi 네트워크에 연결합니다.f |
boolean | connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid) Wi-Fi 네트워크에 연결합니다. |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid) 장치에 현재 네트워크 연결이 없는 경우에만 연결하는 |
boolean | connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk) 장치에 현재 네트워크 연결이 없는 경우에만 연결하는 |
int | createUser (String name, boolean guest, boolean ephemeral) 주어진 이름과 제공된 플래그로 사용자를 만듭니다. |
int | createUser (String name, boolean guest, boolean ephemeral, boolean forTesting) 주어진 이름과 제공된 플래그로 사용자를 만듭니다. |
int | createUser (String name) 주어진 이름과 기본 플래그 0으로 사용자를 만듭니다. |
int | createUserNoThrow (String name) 주어진 이름과 기본 플래그 0으로 사용자를 만듭니다. |
void | deleteFile (String deviceFilePath) 장치에서 파일 또는 디렉터리를 삭제하는 도우미 메서드입니다. |
void | deregisterDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) 등록된 |
boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) 현재 system_server를 이전 system_server |
boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) device 및 해당 |
boolean | disableAdbRoot () adb 루트를 끕니다. |
void | disableKeyguard () 키가드를 비활성화하려고 시도합니다. |
boolean | disableNetworkMonitor () 장치에서 네트워크 모니터링을 비활성화합니다. |
boolean | disconnectFromWifi () Wi-Fi 네트워크에서 연결을 끊습니다. |
boolean | doesFileExist (String deviceFilePath, int userId) 지정된 사용자에 대해 장치에 파일이 있는지 확인하는 도우미 메서드입니다. |
boolean | doesFileExist (String deviceFilePath) 장치에 파일이 있는지 확인하는 도우미 메서드입니다. |
File | dumpHeap (String process, String devicePath) system_server에서 힙 덤프를 시도합니다. |
boolean | enableAdbRoot () adb 루트를 켭니다. |
boolean | enableNetworkMonitor () 장치에서 네트워크 모니터링을 활성화합니다. |
String | executeAdbCommand (long timeout, String... cmdArgs) 지정된 시간 초과로 adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
String | executeAdbCommand (long timeout, envMap, String... cmdArgs) executeAdbCommand (long timeout, envMap, String... cmdArgs) 지정된 시간 초과로 adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
String | executeAdbCommand (String... cmdArgs) adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
CommandResult | executeFastbootCommand (String... cmdArgs) 기본 제한 시간이 2분인 시스템 명령으로 fastboot 명령을 실행하는 도우미 메서드입니다. |
CommandResult | executeFastbootCommand (long timeout, String... cmdArgs) fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
CommandResult | executeLongFastbootCommand (String... cmdArgs) 오래 실행되는 fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
CommandResult | executeLongFastbootCommand ( envVarMap, String... cmdArgs) executeLongFastbootCommand ( envVarMap, String... cmdArgs) 장기 실행 fastboot 명령을 시스템 환경 변수와 함께 시스템 명령으로 실행하는 도우미 메서드입니다. |
String | executeShellCommand (String command) adb shell 명령을 실행하고 출력을 |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 매개변수가 더 많은 adb 셸 명령을 실행합니다. |
void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 매개변수가 더 많은 adb 셸 명령을 실행합니다. |
void | executeShellCommand (String command, IShellOutputReceiver receiver) 지정된 adb 셸 명령을 실행하고 명령이 실패하면 여러 번 재시도합니다. |
CommandResult | executeShellV2Command (String cmd) adb 셸 명령을 실행하고 명령 상태 출력, stdout 및 stderr로 적절하게 채워진 |
CommandResult | executeShellV2Command (String cmd, OutputStream pipeToOutput) adb 셸 명령을 실행하고 명령 상태 출력 및 stderr로 적절하게 채워진 |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput) adb 셸 명령을 실행하고 명령 상태 출력, stdout 및 stderr로 적절하게 채워진 |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 매개변수가 더 많은 adb 셸 명령을 실행합니다. |
CommandResult | executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit) 명령 동작을 제어하는 매개변수가 더 많은 adb 셸 명령을 실행합니다. |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 매개변수가 더 많은 adb 셸 명령을 실행합니다. |
CommandResult | executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 매개변수가 더 많은 adb 셸 명령을 실행합니다. |
CommandResult | fastbootWipePartition (String partition) 장치의 파티션을 지우는 도우미 메서드입니다. |
getActiveApexes () 기기에서 활성화된 APEX에 대한 정보를 가져옵니다. | |
getAllSettings (String namespace) 요청된 네임스페이스의 키 값 쌍을 반환합니다. | |
DeviceAllocationState | getAllocationState () 장치의 현재 할당 상태를 반환 |
String | getAndroidId (int userId) userId와 연결된 android-id를 찾아서 반환합니다. 찾지 못하면 null입니다. |
getAndroidIds () 일치하는 사용자 ID를 찾은 Android ID의 맵을 만듭니다. | |
int | getApiLevel () 장치 API 수준을 가져옵니다. |
PackageInfo | getAppPackageInfo (String packageName) 장치에 설치된 패키지에 대한 정보를 가져옵니다. |
getAppPackageInfos () 장치에 설치된 패키지 정보를 가져옵니다. | |
String | getBasebandVersion () 이 장치의 베이스밴드(라디오) 버전을 가져오는 편리한 방법입니다. |
Integer | getBattery () 장치의 현재 배터리 수준을 반환하거나 배터리 수준을 사용할 수 없는 경우 Null을 반환합니다. |
boolean | getBooleanProperty (String name, boolean defaultValue) 주어진 속성의 부울 값을 반환합니다. |
getBootHistory () 도우미 메서드는 부팅 시간 및 부팅 이유와 함께 부팅 기록 맵을 수집합니다. | |
getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Helper 메서드는 장치의 에포크 이후 지정된 시간 및 지정된 시간 단위 이후 부팅 시간 및 부팅 이유와 함께 부팅 기록 맵을 수집합니다. | |
String | getBootloaderVersion () 이 장치의 부트로더 버전을 가져오는 편리한 방법입니다. |
InputStreamSource | getBugreport () 장치에서 버그 보고서를 검색합니다. |
InputStreamSource | getBugreportz () 장치에서 bugreportz를 검색합니다. |
String | getBuildAlias () 기기가 현재 실행 중인 빌드의 별칭을 검색합니다. |
String | getBuildFlavor () 기기의 빌드 플레이버를 검색합니다. |
String | getBuildId () 장치가 현재 실행 중인 빌드를 검색합니다. |
String | getBuildSigningKeys () 장치 이미지 서명에 사용된 키 유형을 반환합니다. 일반적으로 Android 기기는 테스트 키(AOSP와 같은) 또는 릴리스 키(개별 기기 제조업체에서 제어)로 서명될 수 있습니다. |
DeviceDescriptor | getCachedDeviceDescriptor () 장치가 할당된 경우 캐시된 |
DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) 장치가 할당된 경우 캐시된 |
String[] | getChildren (String path) 권한으로 인해 때때로 작동하지 않는 |
AbstractConnection | getConnection () 장치와 관련된 현재 연결입니다. |
DeviceFoldableState | getCurrentFoldableState () 기기의 현재 폴더블 상태를 반환하거나 일부 문제가 발생한 경우 null을 반환합니다. |
int | getCurrentUser () 현재 실행 중인 사용자의 ID를 반환합니다. |
String | getDeviceClass () 장치 클래스를 가져옵니다. |
long | getDeviceDate () 에포크 이후의 장치 날짜를 밀리초 단위로 반환합니다. |
DeviceDescriptor | getDeviceDescriptor () 장치 정보에서 |
DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) 장치 정보에서 |
TestDeviceState | getDeviceState () 장치의 상태를 가져옵니다. |
long | getDeviceTimeOffset (Date date) 장치와 지정된 |
InputStreamSource | getEmulatorOutput () 에뮬레이터 stdout 및 stderr 스트림 가져오기 |
Process | getEmulatorProcess () 이 에뮬레이터에 해당하는 |
final File | getExecuteShellCommandLog () 모든 |
long | getExternalStoreFreeSpace () 장치 외부 저장소의 여유 공간을 결정하는 도우미 메서드입니다. |
String | getFastbootPath () 사용 중인 fastboot 바이너리의 경로를 반환합니다. |
String | getFastbootProductType () 빠른 부팅 모드에 있을 때 이 장치의 제품 유형을 가져오는 편리한 방법입니다. |
String | getFastbootProductVariant () 빠른 부팅 모드에 있을 때 이 장치의 제품 유형을 가져오는 편리한 방법입니다. |
String | getFastbootSerialNumber () 빠른 부팅 모드 일련 번호를 반환합니다. |
String | getFastbootVariable (String variableName) 장치에서 지정된 fastboot 변수 값을 검색합니다. |
String | getFastbootVersion () 사용 중인 fastboot 바이너리의 버전 문자열을 반환합니다. |
IFileEntry | getFileEntry (String path) 장치에서 원격 파일에 대한 참조를 검색합니다. |
IFileEntry | getFileEntry (FileListingService.FileEntry entry) 루트가 아닌 경로에서 |
getFoldableStates () 기기의 폴더블 상태 목록을 반환합니다. | |
IDevice | getIDevice () 연결된 ddmlib |
getInstalledPackageNames () 기기에 있는 애플리케이션 패키지 이름을 가져옵니다. | |
long | getIntProperty (String name, long defaultValue) 장치에서 주어진 속성의 정수 값을 반환합니다. |
String | getIpAddress () 장치의 IP 주소를 가져옵니다. |
KeyguardControllerState | getKeyguardState () keyguard의 현재 상태를 가져오려면 객체를 반환하거나 지원되지 않는 경우 null을 반환합니다. |
long | getLastExpectedRebootTimeMillis () |
int | getLaunchApiLevel () 기기에서 처음 실행된 API 레벨을 가져옵니다. |
InputStreamSource | getLogcat () logcat 데이터의 스냅샷 스트림을 가져옵니다. |
InputStreamSource | getLogcat (int maxBytes) 캡처된 logcat 데이터의 마지막 |
InputStreamSource | getLogcatDump () 장치에 대한 현재 logcat의 덤프를 가져옵니다. |
InputStreamSource | getLogcatSince (long date) 제공된 날짜부터 캡처된 logcat 데이터의 스냅샷 스트림을 가져옵니다. |
String | getMacAddress () 장치의 MAC 주소를 반환하며, 장치에서 쿼리에 실패하면 null을 반환합니다. |
Integer | getMainUserId () 기본 사용자 ID를 반환합니다. |
getMainlineModuleInfo () 장치에 설치된 기본 모듈에 대한 정보를 가져옵니다. | |
int | getMaxNumberOfRunningUsersSupported () 지원되는 동시 실행 사용자의 최대 수를 가져옵니다. |
int | getMaxNumberOfUsersSupported () 지원되는 최대 사용자 수를 가져옵니다. |
Process | getMicrodroidProcess () |
IDeviceStateMonitor | getMonitor () 장치와 연결된 |
String | getMountPoint (String mountName) 마운트 지점을 반환합니다. |
ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) 지정된 마운트 지점 경로에 해당하는 |
getMountPointInfo () 장치의 /proc/mounts에 있는 정보의 구문 분석된 버전을 반환합니다. | |
TestDeviceOptions | getOptions () 장치의 테스트 옵션을 가져옵니다. |
long | getPartitionFreeSpace (String partition) 장치 파티션의 여유 공간을 결정하는 도우미 메서드입니다. |
Integer | getPrimaryUserId () 기본 사용자 ID를 반환합니다. |
ProcessInfo | getProcessByName (String processName) 도우미 메서드는 "pidof" 및 "stat" 명령을 실행하고 지정된 프로세스의 PID 및 프로세스 시작 시간과 함께 |
String | getProcessPid (String process) 서비스의 pid를 반환하거나 문제가 발생한 경우 null을 반환합니다. |
String | getProductType () 이 장치의 제품 유형을 가져오는 편리한 방법입니다. |
String | getProductVariant () 이 장치의 제품 변형을 가져오는 편리한 방법입니다. |
String | getProperty (String name) 장치에서 지정된 속성 값을 검색합니다. |
ITestDevice.RecoveryMode | getRecoveryMode () 장치에 사용되는 현재 복구 모드를 가져옵니다. |
InputStreamSource | getScreenshot (String format) 장치에서 스크린샷을 가져옵니다. |
InputStreamSource | getScreenshot (long displayId) 디스플레이 ID가 지정된 장치에서 스크린샷을 가져옵니다. |
InputStreamSource | getScreenshot (String format, boolean rescale) 장치에서 스크린샷을 가져옵니다. |
InputStreamSource | getScreenshot () 장치에서 스크린샷을 가져옵니다. |
String | getSerialNumber () 이 장치의 일련 번호를 얻는 편리한 방법입니다. |
String | getSetting (int userId, String namespace, String key) 요청한 설정 값을 반환합니다. |
String | getSetting (String namespace, String key) |
String | getSimOperator () SIM 카드 운영자를 반환하거나 사용할 수 없거나 장치를 사용할 수 없는 경우 null을 반환합니다. |
String | getSimState () SIM 카드 상태를 반환하거나 사용할 수 없거나 장치를 사용할 수 없는 경우 null을 반환합니다. |
getTombstones () 장치에서 삭제 표시 목록을 가져와서 반환합니다. | |
long | getTotalMemory () 총 물리적 메모리 크기를 바이트 단위로 반환하거나 내부 오류의 경우 -1을 반환합니다. |
getUninstallablePackageNames () 제거할 수 있는 애플리케이션 패키지 이름을 가져옵니다. | |
boolean | getUseFastbootErase () 빠른 부팅 삭제 또는 빠른 부팅 형식을 사용하여 장치의 파티션을 지울지 여부를 확인합니다. |
int | getUserFlags (int userId) 지정된 사용자의 플래그를 찾아 반환합니다. |
getUserInfos () 장치의 | |
int | getUserSerialNumber (int userId) 발견되면 userId와 연관된 일련 번호를 반환하고, 다른 경우에는 -10000을 반환합니다. |
IManagedTestDevice.DeviceEventResponse | handleAllocationEvent (DeviceEvent event) 지정된 DeviceEvent를 처리합니다. 이 장치를 새 할당 상태로 전환하거나 전환하지 않을 수 있는 DeviceEvent를 처리합니다. |
boolean | hasFeature (String feature) 장치에서 기능을 사용할 수 있는지 확인하십시오. |
String | installPackage (File packageFile, boolean reinstall, String... extraArgs) 기기에 Android 패키지를 설치합니다. |
String | installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs) 기기에 Android 패키지를 설치합니다. |
String | installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs) 지정된 사용자의 기기에 Android 패키지를 설치합니다. |
String | installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs) 지정된 사용자의 기기에 Android 패키지를 설치합니다. |
void | invalidatePropertyCache () |
boolean | isAdbRoot () |
boolean | isAdbTcp () |
boolean | isAppEnumerationSupported () 기기의 플랫폼이 앱 열거를 지원하는지 확인 |
boolean | isBypassLowTargetSdkBlockSupported () 기기의 플랫폼이 앱 설치 시 낮은 대상 SDK 차단 우회를 지원하는지 확인 |
boolean | isDeviceEncrypted () 장치가 암호화된 경우 반환합니다. |
boolean | isDirectory (String path) 장치의 경로가 디렉토리이면 True를 반환하고 그렇지 않으면 false를 반환합니다. |
boolean | isEnableAdbRoot () |
boolean | isEncryptionSupported () 장치에서 암호화가 지원되는지 여부를 반환합니다. |
boolean | isExecutable (String fullPath) 장치의 파일 경로가 실행 파일이면 True를 반환하고 그렇지 않으면 false를 반환합니다. |
boolean | isFastbootEnabled () 기기에서 빠른 부팅을 사용할 수 있으면 반환합니다. |
boolean | isHeadless () 장치가 헤드리스(화면 없음)이면 true를 반환하고 그렇지 않으면 false를 반환합니다. |
boolean | isHeadlessSystemUserMode () 장치가 헤드리스 시스템 사용자 모드를 사용하는지 여부를 반환합니다. |
boolean | isMainUserPermanentAdmin () 기본 사용자가 영구 관리자이고 삭제하거나 비관리자 상태로 다운그레이드할 수 없는지 여부를 반환합니다. |
boolean | isMultiUserSupported () 다중 사용자가 지원되는지 여부를 결정합니다. |
boolean | isPackageInstalled (String packageName, String userId) 주어진 패키지 이름과 주어진 사용자 ID에 대해 장치를 쿼리하여 해당 사용자에 대해 현재 설치되어 있는지 확인합니다. |
boolean | isPackageInstalled (String packageName) 주어진 패키지 이름에 대한 장치를 쿼리하여 현재 설치되어 있는지 확인하십시오. |
boolean | isRuntimePermissionSupported () 기기의 플랫폼이 런타임 권한 부여를 지원하는지 확인 |
boolean | isStateBootloaderOrFastbootd () 장치가 |
boolean | isUserRunning (int userId) 주어진 사용자가 실행 중인지 확인하십시오. |
boolean | isUserSecondary (int userId) 플래그에 따라 지정된 사용자가 보조 사용자인지 여부를 반환합니다. |
boolean | isUserVisible (int userId) 주어진 사용자가 보이는지 확인합니다. |
boolean | isUserVisibleOnDisplay (int userId, int displayId) 지정된 디스플레이에 지정된 사용자가 표시되는지 확인합니다. |
boolean | isVisibleBackgroundUsersOnDefaultDisplaySupported () 기기가 |
boolean | isVisibleBackgroundUsersSupported () 기기가 사용자가 백그라운드에서 볼 수 있도록 허용할지 여부를 반환합니다. |
boolean | isWifiEnabled () Wi-Fi가 활성화되어 있는지 테스트합니다. |
listDisplayIds () "dumpsys SurfaceFlinger"에서 보고한 대로 장치에서 사용 가능한 디스플레이 ID 목록을 수집합니다. | |
listDisplayIdsForStartingVisibleBackgroundUsers () | |
listUsers () 기기의 사용자 목록을 가져옵니다. | |
boolean | logAnrs ( ITestLogger logger) 기기에서 ANR을 수집하고 기록합니다. |
boolean | logBugreport (String dataName, ITestLogger listener) 버그 보고서를 가져와 보고자에게 기록하는 도우미 메서드입니다. |
void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) 장치의 logcat에 메시지를 기록합니다. |
void | nonBlockingReboot () 장치를 재부팅하라는 명령을 실행하고 명령이 완료되고 장치가 더 이상 adb에 표시되지 않을 때 반환합니다. |
void | postAdbRootAction () 기기가 adb root 이후 기기가 다시 온라인 상태가 되기 전에 특정 조치를 취해야 하는 경우 재정의합니다. |
void | postAdbUnrootAction () adb unroot 후 기기가 다시 온라인 상태가 되기 전에 기기에서 특정 작업을 수행해야 하는 경우 재정의합니다. |
void | postBootSetup () 모든 부팅 후 테스트를 위해 장치를 구성하는 지침을 수행하십시오. |
void | postInvocationTearDown (Throwable exception) 호출이 완료된 후 실행될 장치별 필수 정리를 위한 추가 단계입니다. |
void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) 호출 흐름 이전에 장치에서 실행될 장치별 필수 설정을 위한 추가 단계입니다. |
boolean | pullDir (String deviceFilePath, File localDir) 재귀적으로 장치에서 디렉터리 내용을 가져옵니다. |
boolean | pullFile (String remoteFilePath, File localFile) 장치에서 파일을 검색합니다. |
File | pullFile (String remoteFilePath, int userId) 장치에서 파일을 검색하여 로컬 임시 |
File | pullFile (String remoteFilePath) 장치에서 파일을 검색하여 로컬 임시 |
boolean | pullFile (String remoteFilePath, File localFile, int userId) 장치에서 파일을 검색합니다. |
String | pullFileContents (String remoteFilePath) 장치에서 파일을 검색하고 내용을 반환합니다. |
File | pullFileFromExternal (String remoteFilePath) 장치의 외부 저장소에서 파일을 검색하고 로컬 임시 |
boolean | pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, String deviceFilePath, excludedDirectories) 필터링된 일부 디렉터리를 제외하면서 디렉터리 콘텐츠를 장치에 재귀적으로 푸시합니다. |
boolean | pushDir (File localFileDir, String deviceFilePath) 재귀적으로 디렉터리 내용을 장치로 푸시합니다. |
boolean | pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded) 콘텐츠 공급자에 대한 필요성 평가를 선택적으로 고려할 수 있는 |
boolean | pushFile (File localFile, String remoteFilePath) 파일을 장치로 푸시합니다. |
boolean | pushString (String contents, String remoteFilePath) 문자열에서 생성된 파일을 장치로 푸시 |
void | reboot (String reason) 재부팅 후에도 지속되도록 지정된 |
void | reboot () 기기를 adb 모드로 재부팅합니다. |
void | rebootIntoBootloader () 기기를 부트로더 모드로 재부팅합니다. |
void | rebootIntoFastbootd () 기기를 fastbootd 모드로 재부팅합니다. |
void | rebootIntoRecovery () 기기를 adb 복구 모드로 재부팅합니다. |
void | rebootIntoSideload () 기기를 adb 사이드로드 모드로 재부팅합니다(복구 중인 특수 모드임). 기기가 사이드로드 모드로 전환될 때까지 차단 |
void | rebootIntoSideload (boolean autoReboot) 기기를 adb 사이드로드 모드로 재부팅합니다(복구 중인 특수 모드임). 기기가 사이드로드 모드로 전환될 때까지 차단 |
void | rebootUntilOnline () 장치가 온라인 상태가 될 때까지만 차단하는 |
void | rebootUntilOnline (String reason) 장치가 온라인 상태가 될 때까지만 차단하는 |
void | rebootUserspace () 기기의 사용자 공간 부분만 재부팅합니다. |
void | rebootUserspaceUntilOnline () 장치가 온라인 상태가 될 때까지, 즉 adb에 표시될 때까지만 차단하는 |
boolean | recoverDevice () 장치 통신 복구를 시도합니다. |
void | registerDeviceActionReceiver ( IDeviceActionReceiver deviceActionReceiver) 이 장치에 대한 |
void | remountSystemReadOnly () 장치의 시스템 파티션을 읽기 전용으로 만듭니다. |
void | remountSystemWritable () 장치의 시스템 파티션을 쓰기 가능하게 만드십시오. |
void | remountVendorReadOnly () 장치의 공급업체 파티션을 읽기 전용으로 만드십시오. |
void | remountVendorWritable () 장치의 공급업체 파티션을 쓰기 가능하게 만드십시오. |
boolean | removeAdmin (String componentName, int userId) 주어진 사용자에서 주어진 장치 관리자를 제거하고 성공하면 |
void | removeOwners () 최선의 노력으로 모든 기존 장치 프로필 소유자를 제거합니다. |
boolean | removeUser (int userId) 장치에서 지정된 사용자를 제거합니다. |
void | resetContentProviderSetup () 다시 트리거하려면 콘텐츠 제공자 설정에 대한 플래그를 재설정하세요. |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) 매개변수로 전달된 하나 이상의 리스너로 |
boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) 계측 테스트를 실행하고 장치 복구를 제공합니다. |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) |
void | setConfiguration ( IConfiguration configuration) 사용 중인 |
final void | setConnectionAvdInfo ( GceAvdInfo avdInfo) |
void | setDate (Date date) 기기의 날짜 설정 참고: 기기에서 날짜를 설정하려면 루트가 필요합니다. |
boolean | setDeviceOwner (String componentName, int userId) 지정된 사용자의 기기 관리자 구성요소를 기기 소유자로 설정합니다. |
void | setDeviceState ( TestDeviceState deviceState) 장치의 상태를 업데이트합니다. |
void | setEmulatorOutputStream ( SizeLimitedOutputStream output) 에뮬레이터의 경우 출력을 기록하도록 |
void | setEmulatorProcess (Process p) 이 장치가 에뮬레이터인 경우 |
void | setFastbootEnabled (boolean fastbootEnabled) 장치의 빠른 부팅 옵션을 설정합니다. |
void | setFastbootPath (String fastbootPath) 사용해야 하는 fastboot 바이너리의 경로를 설정합니다. |
void | setIDevice (IDevice newDevice) 이 ITestDevice와 연결된 IDevice를 업데이트합니다. |
void | setLogStartDelay (int delay) 온라인 장치에 대한 logcat 캡처를 시작하기 전에 대기할 시간(ms)을 설정합니다. |
void | setOptions ( TestDeviceOptions options) 장치에 대한 |
boolean | setProperty (String propKey, String propValue) 장치에서 지정된 속성 값을 설정합니다. |
void | setRecovery ( IDeviceRecovery recovery) 이 장치에 사용할 |
void | setRecoveryMode ( ITestDevice.RecoveryMode mode) 장치에 사용할 현재 복구 모드를 설정합니다. |
void | setSetting (String namespace, String key, String value) |
void | setSetting (int userId, String namespace, String key, String value) 주어진 사용자의 네임스페이스에 설정 값을 추가합니다. |
void | setTestLogger ( ITestLogger testLogger) |
void | setUseFastbootErase (boolean useFastbootErase) 빠른 부팅 삭제 또는 빠른 부팅 형식을 사용하여 장치의 파티션을 지울지 여부를 설정합니다. |
void | startLogcat () 백그라운드에서 기기의 logcat 출력 캡처를 시작합니다. |
boolean | startUser (int userId) 현재 중지된 경우 지정된 사용자를 백그라운드에서 시작합니다. |
boolean | startUser (int userId, boolean waitFlag) 현재 중지된 경우 지정된 사용자를 백그라운드에서 시작합니다. |
boolean | startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag) 지정된 디스플레이에 표시되는 백그라운드에서 지정된 사용자를 시작합니다(즉, 사용자가 해당 디스플레이에서 활동을 시작하도록 허용). |
void | stopEmulatorOutput () 에뮬레이터 출력을 닫고 삭제합니다. |
void | stopLogcat () 장치에서 logcat 출력 캡처를 중지하고 현재 저장된 logcat 데이터를 삭제합니다. |
boolean | stopUser (int userId) 지정된 사용자를 중지합니다. |
boolean | stopUser (int userId, boolean waitFlag, boolean forceFlag) 지정된 사용자를 중지합니다. |
String | switchToAdbTcp () 장치를 adb-over-tcp 모드로 전환합니다. |
boolean | switchToAdbUsb () 장치를 USB 모드를 통해 adb로 전환합니다. |
boolean | switchUser (int userId) 기본 시간 제한이 있는 다른 사용자 ID로 전환합니다. |
boolean | switchUser (int userId, long timeout) 기한으로 제공된 제한 시간이 있는 다른 사용자 ID로 전환하십시오. |
boolean | syncFiles (File localFileDir, String deviceFilePath) 로컬 파일 디렉터리의 콘텐츠를 장치에 점진적으로 동기화합니다. |
Bugreport | takeBugreport () 버그 보고서를 가져오고 이를 처리하기 위해 |
String | uninstallPackage (String packageName) 기기에서 Android 패키지를 제거합니다. |
String | uninstallPackageForUser (String packageName, int userId) 지정된 사용자의 기기에서 Android 패키지를 제거합니다. |
boolean | unlockDevice () 장치가 암호화된 상태인 경우 장치를 잠금 해제합니다. |
boolean | waitForBootComplete (long timeOut) 장치의 부팅 완료 플래그가 설정될 때까지 차단합니다. |
boolean | waitForDeviceAvailable () 장치가 응답하고 테스트에 사용할 수 있을 때까지 기다립니다. |
boolean | waitForDeviceAvailable (long waitTime) 장치가 응답하고 테스트에 사용할 수 있을 때까지 기다립니다. |
boolean | waitForDeviceAvailableInRecoverPath (long waitTime) 복구 경로를 고려하지 않고 장치가 응답하고 사용 가능할 때까지 기다립니다. |
void | waitForDeviceBootloader () 빠른 부팅을 통해 장치가 표시될 때까지 차단합니다. |
boolean | waitForDeviceInRecovery (long waitTime) 장치가 'adb 복구' 상태가 되도록 차단합니다( |
boolean | waitForDeviceInSideload (long waitTime) 기기가 'adb 사이드로드' 상태가 되도록 차단 |
boolean | waitForDeviceNotAvailable (long waitTime) 장치를 사용할 수 없는 블록, 즉 adb에서 누락된 블록 |
void | waitForDeviceOnline () 장치가 adb를 통해 표시될 때까지 차단합니다. |
void | waitForDeviceOnline (long waitTime) 장치가 adb를 통해 표시될 때까지 차단합니다. |
boolean | waitForDeviceShell (long waitTime) 장치가 기본 adb 셸 명령에 응답할 때까지 기다립니다. |
보호된 메서드 | |
---|---|
void | addExtraConnectionBuilderArgs ( DefaultConnection.ConnectionBuilder builder) |
String[] | buildAdbShellCommand (String command, boolean forceExitStatusDetection) 지정된 adb 셸 명령 세션 및 args에 대한 OS 명령을 빌드합니다. |
void | checkApiLevelAgainst (String feature, int strictMinLevel) |
NativeDevice.RebootDeviceAction | createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason) 재부팅 작업을 수행할 때 사용할 |
IRunUtil | createRunUtil () |
void | doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason) adb 재부팅을 수행합니다. |
void | ensureRuntimePermissionSupported () 런타임 권한이 지원되지 않는 경우 예외를 발생시키는 도우미 메서드 |
int | getApiLevelSafe () |
ITestLogger | getLogger () |
IRunUtil | getRunUtil () 사용할 |
void | initializeConnection ( IBuildInfo info, MultiMap <String, String> attributes) |
String | internalGetProperty (String propName, String fastbootVar, String description) 기본적으로 ddmlib 캐시에서 장치 속성을 가져오고 장치가 Fastboot에 있는지 여부에 따라 `adb shell getprop` 또는 `fastboot getvar`로 돌아갑니다. |
boolean | isInRebootCallback () 재부팅 콜백이 현재 실행 중인지 여부를 반환합니다. |
boolean | isNewer (File localFile, IFileEntry entry) 로컬 파일이 원격 파일보다 최신이면 |
void | notifyRebootEnded () 재부팅 종료 이벤트를 모든 |
void | notifyRebootStarted () 재부팅 시작 이벤트를 모든 |
boolean | performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts) 이 장치에서 작업을 수행합니다. |
void | postAdbReboot () 재부팅 후 수행할 수 있는 가능한 추가 작업입니다. |
void | prePostBootSetup () 각 기기 유형(AndroidNativeDevice, TestDevice)이 특정 부팅 후 설정에 대해 이 메서드를 재정의하도록 허용합니다. |
boolean | pullFileInternal (String remoteFilePath, File localFile) |
void | setClock (Clock clock) 사용할 Clock 인스턴스를 설정합니다. |
void | setMicrodroidProcess (Process process) TestDevice를 microdroid로 표시하고 CID를 설정합니다. |
void | setTestDeviceOptions ( deviceOptions) setTestDeviceOptions ( deviceOptions) |
CommandResult | simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) 환경 변수를 사용하여 간단한 fastboot 명령을 실행하고 명령 상태를 보고합니다. |
CommandResult | simpleFastbootCommand (long timeout, String[] fullCmd) 간단한 fastboot 명령을 실행하고 명령의 상태를 보고합니다. |
boolean | waitForDeviceNotAvailable (String operationDesc, long time) 기기를 사용할 수 없게 될 때까지 기다립니다(adb에 보고 중지). |
상수
INVALID_USER_ID
public static final int INVALID_USER_ID
유효하지 않거나 찾을 수 없는 사용자 ID에 대해 반환된 값: UserHandle이 -10000 값을 정의했습니다.
상수 값: -10000(0xffffd8f0)
MAX_HOST_DEVICE_TIME_OFFSET
protected static final long MAX_HOST_DEVICE_TIME_OFFSET
상수 값: 5000(0x0000000000001388)
MAX_RETRY_ATTEMPTS
protected static final int MAX_RETRY_ATTEMPTS
수행을 시도하는 기본 명령 재시도 횟수
상수 값: 2(0x00000002)
필드
SD_CARD
protected static final String SD_CARD
STORAGE_EMULATED
protected static final String STORAGE_EMULATED
옵션
protected TestDeviceOptions mOptions
공개 생성자
네이티브 장치
public NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)
TestDevice
생성합니다.
매개변수 | |
---|---|
device | IDevice : 연관된 IDevice |
stateMonitor | IDeviceStateMonitor : 사용할 IDeviceStateMonitor 메커니즘 |
allocationMonitor | IDeviceMonitor : 할당 상태 변경을 알리는 IDeviceMonitor . null일 수 있음 |
공개 방법
batchPrefetchStartupBuildProps
public void batchPrefetchStartupBuildProps ()
각각에 대해 'adb getprop'를 호출하는 대신 필요한 모든 소품을 미리 가져오는 미세 최적화(약 400밀리초). 즉, 하나를 가져오는 것만큼 모든 속성을 가져오는 것이 빠릅니다. device.getApiLevel(), checkApiLevelAgainstNextRelease 및 getBuildAlias와 같은 것들은 모두 내부적으로 `adb getprop`를 호출합니다. 호출 한 번으로 가져오고 NativeDevice.setProperty를 호출합니다. 이렇게 하지 않더라도 NativeDevice는 자체적으로 setProperty를 호출하고 향후 호출을 위해 결과를 캐시합니다. 우리는 단지 그것을 조금 더 일찍 하고 있을 뿐입니다. 장치가 복구 중이거나 소품을 가져오는 다른 오류가 있는 경우 무시합니다.
canSwitchToHeadlessSystemUser
public boolean canSwitchToHeadlessSystemUser ()
헤드리스 SYSTEM 사용자로 전환할 수 있는지 여부를 반환합니다.
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
checkApiLevelAgainstNextRelease
public boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
최소 지원 수준에서 기능이 현재 지원되는지 여부를 확인합니다. 이 방법은 API 레벨이 올라가기 전에 아직 출시되지 않은 기능을 고려합니다.
매개변수 | |
---|---|
strictMinLevel | int : 기능을 지원하는 엄격한 최소 가능 수준입니다. |
보고 | |
---|---|
boolean | 수준이 지원되는 경우 True입니다. 그렇지 않으면 거짓입니다. |
던지기 | |
---|---|
DeviceNotAvailableException |
연결 확인
public boolean checkConnectivity ()
장치가 네트워크에 연결되어 있는지 확인하십시오.
보고 | |
---|---|
boolean | 장치에 작동 중인 네트워크 연결이 있는 경우 true , 전체적으로 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
clearErrorDialogs
public boolean clearErrorDialogs ()
현재 장치 UI에 표시된 오류 대화 상자를 닫으십시오.
보고 | |
---|---|
boolean | 대화 상자가 없거나 대화 상자가 성공적으로 지워진 경우 true . 그렇지 않으면 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
clearLastConnectedWifi네트워크
public void clearLastConnectedWifiNetwork ()
마지막으로 연결된 Wi-Fi 네트워크를 지웁니다. 기기 재부팅 후 이전 테스트에서 사용된 Wi-Fi 네트워크에 연결하지 않도록 새 호출을 시작할 때 호출해야 합니다.
clearLogcat
public void clearLogcat ()
누적된 모든 logcat 데이터를 삭제합니다.
이는ITestDevice#getLogcat()
특정 시점 이후에 생성된 로그 데이터만 반환하도록 하려는 경우에 유용합니다(예: 새 장치 빌드를 플래싱한 후 등). connectToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk, boolean scanSsid)
Wi-Fi 네트워크에 연결합니다.
wifiSsidToPsk 맵에 지정된 Wi-Fi 네트워크 중 하나와 성공적으로 연결될 때까지 Wi-Fi를 켜고 차단합니다. 일단 연결되면 인스턴스는 ITestDevice#disconnectFromWifi()
또는 ITestDevice#clearLastConnectedWifiNetwork()
호출될 때까지 재부팅할 때마다 연결 복원을 시도합니다.
매개변수 | |
---|---|
wifiSsidToPsk | |
scanSsid | boolean : 이 네트워크의 숨겨진 SSID를 스캔할지 여부. |
보고 | |
---|---|
boolean | Wi-Fi 네트워크에 성공적으로 연결된 경우 true . 그렇지 않으면 false |
던지기 | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)
Wi-Fi 네트워크에 연결합니다.
Wi-Fi를 켜고 지정된 Wi-Fi 네트워크에 성공적으로 연결될 때까지 차단합니다. 일단 연결되면 인스턴스는ITestDevice#disconnectFromWifi()
또는 ITestDevice#clearLastConnectedWifiNetwork()
호출될 때까지 재부팅할 때마다 연결 복원을 시도합니다.매개변수 | |
---|---|
wifiSsid | String : 연결할 Wi-Fi ssid |
wifiPsk | String : PSK 암호 또는 암호화되지 않은 경우 null |
보고 | |
---|---|
boolean | Wi-Fi 네트워크에 성공적으로 연결된 경우 true . 그렇지 않으면 false |
던지기 | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (wifiSsidToPsk)
Wi-Fi 네트워크에 연결합니다.
wifiSsidToPsk 맵에 지정된 Wi-Fi 네트워크 중 하나와 성공적으로 연결될 때까지 Wi-Fi를 켜고 차단합니다. 일단 연결되면 인스턴스는 ITestDevice#disconnectFromWifi()
또는 ITestDevice#clearLastConnectedWifiNetwork()
호출될 때까지 재부팅할 때마다 연결 복원을 시도합니다.f
매개변수 | |
---|---|
wifiSsidToPsk |
보고 | |
---|---|
boolean | Wi-Fi 네트워크에 성공적으로 연결된 경우 true . 그렇지 않으면 false |
던지기 | |
---|---|
DeviceNotAvailableException |
connectToWifiNetwork
public boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)
Wi-Fi 네트워크에 연결합니다.
Wi-Fi를 켜고 지정된 Wi-Fi 네트워크에 성공적으로 연결될 때까지 차단합니다. 일단 연결되면 인스턴스는ITestDevice#disconnectFromWifi()
또는 ITestDevice#clearLastConnectedWifiNetwork()
호출될 때까지 재부팅할 때마다 연결 복원을 시도합니다.매개변수 | |
---|---|
wifiSsid | String : 연결할 Wi-Fi ssid |
wifiPsk | String : PSK 암호 또는 암호화되지 않은 경우 null |
scanSsid | boolean : 이 네트워크의 숨겨진 SSID를 스캔할지 여부. |
보고 | |
---|---|
boolean | Wi-Fi 네트워크에 성공적으로 연결된 경우 true . 그렇지 않으면 false |
던지기 | |
---|---|
DeviceNotAvailableException |
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)
장치에 현재 네트워크 연결이 없는 경우에만 연결하는 connectToWifiNetwork(String, String)
의 변형입니다.
매개변수 | |
---|---|
scanSsid | boolean : 이 네트워크의 숨겨진 SSID를 스캔할지 여부 |
보고 | |
---|---|
boolean | Wi-Fi 네트워크에 성공적으로 연결된 경우 true . 그렇지 않으면 false |
던지기 | |
---|---|
DeviceNotAvailableException |
connectToWifiNetworkIfNeeded
public boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)
장치에 현재 네트워크 연결이 없는 경우에만 연결하는 connectToWifiNetwork(String, String)
의 변형입니다.
보고 | |
---|---|
boolean | Wi-Fi 네트워크에 성공적으로 연결된 경우 true . 그렇지 않으면 false |
던지기 | |
---|---|
DeviceNotAvailableException |
사용자 생성
public int createUser (String name, boolean guest, boolean ephemeral)
주어진 이름과 제공된 플래그로 사용자를 만듭니다.
매개변수 | |
---|---|
name | String : 디바이스에서 생성할 사용자의 |
guest | boolean : 생성 중 사용자 플래그 --guest 활성화 |
ephemeral | boolean : 생성 중 사용자 플래그 --ephemeral 활성화 |
보고 | |
---|---|
int | 생성된 사용자의 아이디 |
던지기 | |
---|---|
DeviceNotAvailableException |
사용자 생성
public int createUser (String name, boolean guest, boolean ephemeral, boolean forTesting)
주어진 이름과 제공된 플래그로 사용자를 만듭니다.
매개변수 | |
---|---|
name | String : 디바이스에서 생성할 사용자의 |
guest | boolean : 생성 중 사용자 플래그 --guest 활성화 |
ephemeral | boolean : 생성 중 사용자 플래그 --ephemeral 활성화 |
forTesting | boolean : 작성 중 테스트 플래그 --for-testing 활성화 |
보고 | |
---|---|
int | 생성된 사용자의 아이디 |
던지기 | |
---|---|
DeviceNotAvailableException |
사용자 생성
public int createUser (String name)
주어진 이름과 기본 플래그 0으로 사용자를 만듭니다.
매개변수 | |
---|---|
name | String : 디바이스에서 생성할 사용자의 |
보고 | |
---|---|
int | 생성된 사용자 ID의 정수 |
던지기 | |
---|---|
DeviceNotAvailableException |
createUserNoThrow
public int createUserNoThrow (String name)
주어진 이름과 기본 플래그 0으로 사용자를 만듭니다.
매개변수 | |
---|---|
name | String : 디바이스에서 생성할 사용자의 |
보고 | |
---|---|
int | 생성된 사용자 ID의 정수 또는 오류의 경우 -1. |
던지기 | |
---|---|
DeviceNotAvailableException |
삭제파일
public void deleteFile (String deviceFilePath)
장치에서 파일 또는 디렉터리를 삭제하는 도우미 메서드입니다.
매개변수 | |
---|---|
deviceFilePath | String : 장치에 있는 파일의 절대 경로입니다. |
던지기 | |
---|---|
DeviceNotAvailableException |
deregisterDeviceActionReceiver
public void deregisterDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
등록된 IDeviceActionReceiver
제거합니다.
매개변수 | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : 제거할 IDeviceActionReceiver 입니다. |
deviceSoftRestarted
public boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
현재 system_server를 이전 system_server ProcessInfo
와 비교하여 장치가 소프트 재시작되었는지 확인하는 도우미 메서드입니다. getProcessByName(String)
사용하여 ProcessInfo
가져옵니다.
매개변수 | |
---|---|
prevSystemServerProcess | ProcessInfo : 이전 system_server 프로세스 ProcessInfo . |
보고 | |
---|---|
boolean | 장치가 소프트 재시작된 경우 true |
던지기 | |
---|---|
DeviceNotAvailableException |
deviceSoftRestartedSince
public boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
device 및 해당 ERROR(/TimeUnit)
의 에포크 이후 UTC 시간 이후 장치가 소프트 재시작되었는지 여부를 확인하는 도우미 메서드입니다. Soft-Restart는 장치 하드 재부팅(예: 요청된 재부팅) 외부에서 다시 시작된 system_server를 나타냅니다. 밀리초 단위의 현재 장치 utcEpochTime은 getDeviceDate()
메서드로 얻을 수 있습니다.
매개변수 | |
---|---|
utcEpochTime | long : 에포크 이후의 장치 시간(초). |
timeUnit | TimeUnit : 주어진 utcEpochTime의 시간 단위 TimeUnit . |
보고 | |
---|---|
boolean | 장치가 소프트 재시작된 경우 true |
던지기 | |
---|---|
DeviceNotAvailableException |
disableAdbRoot
public boolean disableAdbRoot ()
adb 루트를 끕니다.
adb 루트를 비활성화하면 장치가 adb에서 연결 해제될 수 있습니다. 이 메서드는 장치를 사용할 수 있을 때까지 차단됩니다.보고 | |
---|---|
boolean | 성공하면 true . |
던지기 | |
---|---|
DeviceNotAvailableException |
키가드 비활성화
public void disableKeyguard ()
키가드를 비활성화하려고 시도합니다.
먼저 입력 디스패치가 준비될 때까지 기다립니다. 이것은 현재 프레임워크 구현에 가끔 경합 조건이 있기 때문에 장치가 BOOT_COMPLETE를 보고하는 것과 거의 동시에 비동기적으로 발생합니다. 그런 다음 키가드를 해제하라는 명령이 전송됩니다(비보안 항목에서만 작동).
던지기 | |
---|---|
DeviceNotAvailableException |
disableNetworkMonitor
public boolean disableNetworkMonitor ()
장치에서 네트워크 모니터링을 비활성화합니다.
보고 | |
---|---|
boolean | 모니터링이 성공적으로 비활성화된 경우 true . 실패하면 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
Wifi에서 연결 해제
public boolean disconnectFromWifi ()
Wi-Fi 네트워크에서 연결을 끊습니다.
알려진 네트워크 목록에서 모든 네트워크를 제거하고 Wi-Fi를 비활성화합니다.보고 | |
---|---|
boolean | Wi-Fi 네트워크에서 성공적으로 연결이 끊긴 경우 true . 연결 해제에 실패하면 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
파일 존재
public boolean doesFileExist (String deviceFilePath, int userId)
지정된 사용자에 대해 장치에 파일이 있는지 확인하는 도우미 메서드입니다.
매개변수 | |
---|---|
deviceFilePath | String : 확인할 장치의 파일 절대 경로 |
userId | int : 파일 존재를 확인할 사용자 ID |
보고 | |
---|---|
boolean | 파일이 있으면 true , 그렇지 않으면 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
파일 존재
public boolean doesFileExist (String deviceFilePath)
장치에 파일이 있는지 확인하는 도우미 메서드입니다.
매개변수 | |
---|---|
deviceFilePath | String : 확인할 장치의 파일 절대 경로 |
보고 | |
---|---|
boolean | 파일이 있으면 true , 그렇지 않으면 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
덤프힙
public File dumpHeap (String process, String devicePath)
system_server에서 힙 덤프를 시도합니다. 덤프된 파일을 정리하는 것은 호출자의 책임입니다.
매개변수 | |
---|---|
process | String : 덤프할 장치 프로세스의 이름. |
devicePath | String : 덤프를 넣을 장치의 경로입니다. 권한이 허용하는 위치여야 합니다. |
보고 | |
---|---|
File | 보고서가 포함된 ERROR(/File) . 실패한 경우 Null입니다. |
던지기 | |
---|---|
DeviceNotAvailableException |
enableAdbRoot
public boolean enableAdbRoot ()
adb 루트를 켭니다. "enable-root" 설정이 "false"이면 루트를 활성화하지 않고 메시지를 기록하고 반환합니다.
adb 루트를 활성화하면 장치가 adb에서 연결 해제될 수 있습니다. 이 메서드는 장치를 사용할 수 있을 때까지 차단됩니다.보고 | |
---|---|
boolean | 성공하면 true . |
던지기 | |
---|---|
DeviceNotAvailableException |
enableNetworkMonitor
public boolean enableNetworkMonitor ()
장치에서 네트워크 모니터링을 활성화합니다.
보고 | |
---|---|
boolean | 모니터링이 성공적으로 활성화된 경우 true . 실패하면 false . |
던지기 | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (long timeout, String... cmdArgs)
지정된 시간 초과로 adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
executeShellCommand(String)
더 나은 오류 감지 및 성능을 제공하므로 가능하면 대신 사용해야 합니다.
매개변수 | |
---|---|
timeout | long : 장치가 응답하지 않는 것으로 간주되기 전의 시간(밀리초), 시간 초과가 없는 경우 0L |
cmdArgs | String : 실행할 adb 명령 및 인수 |
보고 | |
---|---|
String | 명령의 stdout. 명령 실행에 실패한 경우 null . |
던지기 | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (long timeout,envMap, String... cmdArgs)
지정된 시간 초과로 adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
executeShellCommand(String)
더 나은 오류 감지 및 성능을 제공하므로 가능하면 대신 사용해야 합니다.
매개변수 | |
---|---|
timeout | long : 장치가 응답하지 않는 것으로 간주되기 전의 시간(밀리초), 시간 초과가 없는 경우 0L |
envMap | |
cmdArgs | String : 실행할 adb 명령 및 인수 |
보고 | |
---|---|
String | 명령의 stdout. 명령 실행에 실패한 경우 null . |
던지기 | |
---|---|
DeviceNotAvailableException |
executeAdbCommand
public String executeAdbCommand (String... cmdArgs)
adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
executeShellCommand(String)
더 나은 오류 감지 및 성능을 제공하므로 가능하면 대신 사용해야 합니다.매개변수 | |
---|---|
cmdArgs | String : 실행할 adb 명령 및 인수 |
보고 | |
---|---|
String | 명령의 stdout. 명령 실행에 실패한 경우 null . |
던지기 | |
---|---|
DeviceNotAvailableException |
실행Fastboot명령
public CommandResult executeFastbootCommand (String... cmdArgs)
기본 제한 시간이 2분인 시스템 명령으로 fastboot 명령을 실행하는 도우미 메서드입니다.
기기가 이미 빠른 부팅 모드일 때 사용될 것으로 예상됩니다.
매개변수 | |
---|---|
cmdArgs | String : 실행할 fastboot 명령 및 인수 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지기 | |
---|---|
DeviceNotAvailableException |
실행Fastboot명령
public CommandResult executeFastbootCommand (long timeout, String... cmdArgs)
fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
기기가 이미 빠른 부팅 모드일 때 사용될 것으로 예상됩니다.매개변수 | |
---|---|
timeout | long : 명령이 만료되기 전의 시간(밀리초) |
cmdArgs | String : 실행할 fastboot 명령 및 인수 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지기 | |
---|---|
DeviceNotAvailableException |
executeLongFastboot명령
public CommandResult executeLongFastbootCommand (String... cmdArgs)
오래 실행되는 fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
더 긴 시간 제한을 사용한다는 점을 제외하면executeFastbootCommand(String)
와 동일합니다.매개변수 | |
---|---|
cmdArgs | String : the fastboot command and arguments to run |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지기 | |
---|---|
DeviceNotAvailableException |
executeLongFastbootCommand
public CommandResult executeLongFastbootCommand (envVarMap, String... cmdArgs)
Helper method which executes a long running fastboot command as a system command with system environment variables.
Identical to executeFastbootCommand(String)
except uses a longer timeout.
매개변수 | |
---|---|
envVarMap | |
cmdArgs | String : the fastboot command and arguments to run |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public String executeShellCommand (String command)
Helper method which executes a adb shell command and returns output as a String
.
매개변수 | |
---|---|
command | String : the adb shell command to run |
보고 | |
---|---|
String | the shell output |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
maxTimeToOutputShellResponse | long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
maxTimeToOutputShellResponse | long : the maximum amount of time during which the command is allowed to not output any response; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellCommand
public void executeShellCommand (String command, IShellOutputReceiver receiver)
Executes the given adb shell command, retrying multiple times if command fails.
A simpler form ofexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
with default values.매개변수 | |
---|---|
command | String : the adb shell command to run |
receiver | IShellOutputReceiver : the IShellOutputReceiver to direct shell output to. |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd)
Helper method which executes a adb shell command and returns the results as a CommandResult
properly populated with the command status output, stdout and stderr.
매개변수 | |
---|---|
cmd | String : The command that should be run. |
보고 | |
---|---|
CommandResult | The result in CommandResult . |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, OutputStream pipeToOutput)
Helper method which executes an adb shell command and returns the results as a CommandResult
properly populated with the command status output and stderr. stdout is directed to the specified stream.
매개변수 | |
---|---|
cmd | String : The command that should be run. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
보고 | |
---|---|
CommandResult | The result in CommandResult . |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput)
Helper method which executes an adb shell command and returns the results as a CommandResult
properly populated with the command status output, stdout and stderr.
매개변수 | |
---|---|
cmd | String : The command that should be run. |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
보고 | |
---|---|
CommandResult | The result in CommandResult . |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
cmd | String : the adb shell command to run |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
보고 | |
---|---|
CommandResult |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, long maxTimeoutForCommand, TimeUnit timeUnit)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
cmd | String : the adb shell command to run |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
보고 | |
---|---|
CommandResult |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
cmd | String : the adb shell command to run |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
보고 | |
---|---|
CommandResult |
던지기 | |
---|---|
DeviceNotAvailableException |
executeShellV2Command
public CommandResult executeShellV2Command (String cmd, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
cmd | String : the adb shell command to run |
pipeAsInput | File : A ERROR(/File) that will be piped as input to the command, or null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) where the std output will be redirected, or null. |
pipeToError | OutputStream : ERROR(/OutputStream) where the std error will be redirected, or null. |
maxTimeoutForCommand | long : the maximum timeout for the command to complete; unit as specified in timeUnit |
timeUnit | TimeUnit : unit for maxTimeToOutputShellResponse |
retryAttempts | int : the maximum number of times to retry command if it fails due to a exception. DeviceNotResponsiveException will be thrown if retryAttempts are performed without success. |
보고 | |
---|---|
CommandResult |
던지기 | |
---|---|
DeviceNotAvailableException |
fastbootWipePartition
public CommandResult fastbootWipePartition (String partition)
Helper method which wipes a partition for the device.
IfgetUseFastbootErase()
is true
, then fastboot erase will be used to wipe the partition. The device must then create a filesystem the next time the device boots. Otherwise, fastboot format is used which will create a new filesystem on the device. Expected to be used when device is already in fastboot mode.매개변수 | |
---|---|
partition | String : the partition to wipe |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지기 | |
---|---|
DeviceNotAvailableException |
getActiveApexes
publicgetActiveApexes ()
Fetch the information about APEXes activated on the device.
보고 | |
---|---|
ERROR(/Set) of ApexInfo currently activated on the device |
던지기 | |
---|---|
DeviceNotAvailableException |
getAllSettings
publicgetAllSettings (String namespace)
Return key value pairs of requested namespace.
매개변수 | |
---|---|
namespace | String : must be one of {"system", "secure", "global"} |
보고 | |
---|---|
the map of key value pairs. Null if namespace is not supported. |
던지기 | |
---|---|
DeviceNotAvailableException |
getAllocationState
public DeviceAllocationState getAllocationState ()
Return the current allocation state of device
보고 | |
---|---|
DeviceAllocationState |
getAndroidId
public String getAndroidId (int userId)
Find and return the android-id associated to a userId, null if not found.
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
String |
던지기 | |
---|---|
DeviceNotAvailableException |
getAndroidIds
publicgetAndroidIds ()
Create a Map of android ids found matching user ids. There is no insurance that each user id will found an android id associated in this function so some user ids may match null.
보고 | |
---|---|
Map of android ids found matching user ids. |
던지기 | |
---|---|
DeviceNotAvailableException |
getApiLevel
public int getApiLevel ()
Get the device API Level. Defaults to UNKNOWN_API_LEVEL
.
보고 | |
---|---|
int | an integer indicating the API Level of device |
던지기 | |
---|---|
DeviceNotAvailableException |
getAppPackageInfo
public PackageInfo getAppPackageInfo (String packageName)
Fetch information about a package installed on device.
매개변수 | |
---|---|
packageName | String |
보고 | |
---|---|
PackageInfo | the PackageInfo or null if information could not be retrieved |
던지기 | |
---|---|
DeviceNotAvailableException |
getAppPackageInfos
publicgetAppPackageInfos ()
Fetch information of packages installed on the device.
보고 | |
---|---|
ERROR(/List) of PackageInfo s installed on the device. |
던지기 | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public String getBasebandVersion ()
Convenience method to get baseband (radio) version of this device. Getting the radio version is device specific, so it might not return the correct information for all devices. This method relies on the gsm.version.baseband propery to return the correct version information. This is not accurate for some CDMA devices and the version returned here might not match the version reported from fastboot and might not return the version for the CDMA radio. TL;DR this method only reports accurate version if the gsm.version.baseband property is the same as the version returned by fastboot getvar version-baseband
.
보고 | |
---|---|
String | the String baseband version or null if it cannot be determined (device has no radio or version string cannot be read) |
던지기 | |
---|---|
DeviceNotAvailableException |
getBattery
public Integer getBattery ()
Returns the current battery level of a device or Null if battery level unavailable.
보고 | |
---|---|
Integer |
getBooleanProperty
public boolean getBooleanProperty (String name, boolean defaultValue)
Returns boolean value of the given property.
매개변수 | |
---|---|
name | String : the property name |
defaultValue | boolean : default value to return if property is empty or doesn't exist. |
보고 | |
---|---|
boolean | true if the property has value "1" , "y" , "yes" , "on" , or "true" , false if the property has value of "0" , "n" , "no" , "off" , "false" , or defaultValue otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
getBootHistory
publicgetBootHistory ()
Helper method collects the boot history map with boot time and boot reason.
보고 | |
---|---|
Map of boot time (UTC time in second since Epoch) and boot reason |
던지기 | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
publicgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. The current device utcEpochTime in Millisecond can be obtained by method getDeviceDate()
.
매개변수 | |
---|---|
utcEpochTime | long : the device time since Epoch. |
timeUnit | TimeUnit : the time unit TimeUnit . |
보고 | |
---|---|
Map of boot time (UTC time in second since Epoch) and boot reason |
던지기 | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public String getBootloaderVersion ()
Convenience method to get the bootloader version of this device.
Will attempt to retrieve bootloader version from the device's current state. (ie if device is in fastboot mode, it will attempt to retrieve version from fastboot)보고 | |
---|---|
String | the String bootloader version or null if it cannot be found |
던지기 | |
---|---|
DeviceNotAvailableException |
getBugreport
public InputStreamSource getBugreport ()
Retrieves a bugreport from the device.
The implementation of this is guaranteed to continue to work on a device without an sdcard (or where the sdcard is not yet mounted).
보고 | |
---|---|
InputStreamSource | An InputStreamSource which will produce the bugreport contents on demand. In case of failure, the InputStreamSource will produce an empty ERROR(/InputStream) . |
getBugreportz
public InputStreamSource getBugreportz ()
Retrieves a bugreportz from the device. Zip format bugreport contains the main bugreport and other log files that are useful for debugging.
Only supported for 'adb version' > 1.0.36
보고 | |
---|---|
InputStreamSource | a InputStreamSource of the zip file containing the bugreportz, return null in case of failure. |
getBuildAlias
public String getBuildAlias ()
Retrieve the alias of the build that the device is currently running.
Build alias is usually a more readable string than build id (typically a number for Nexus builds). For example, final Android 4.2 release has build alias JDQ39, and build id 573038
보고 | |
---|---|
String | the build alias or fall back to build id if it could not be retrieved |
던지기 | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public String getBuildFlavor ()
Retrieve the build flavor for the device.
보고 | |
---|---|
String | the build flavor or null if it could not be retrieved |
던지기 | |
---|---|
DeviceNotAvailableException |
getBuildId
public String getBuildId ()
Retrieve the build the device is currently running.
보고 | |
---|---|
String | the build id or IBuildInfo#UNKNOWN_BUILD_ID if it could not be retrieved |
던지기 | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public String getBuildSigningKeys ()
Returns the key type used to sign the device image
Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers)
보고 | |
---|---|
String | The signing key if found, null otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor ()
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
보고 | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
매개변수 | |
---|---|
shortDescriptor | boolean : Whether or not to limit descriptor to bare minimum info |
보고 | |
---|---|
DeviceDescriptor |
getChildren
public String[] getChildren (String path)
Alternative to using IFileEntry
that sometimes won't work because of permissions.
매개변수 | |
---|---|
path | String : is the path on the device where to do the search |
보고 | |
---|---|
String[] | Array of string containing all the file in a path on the device. |
던지기 | |
---|---|
DeviceNotAvailableException |
getConnection
public AbstractConnection getConnection ()
The current connection associated with the device.
보고 | |
---|---|
AbstractConnection |
getCurrentFoldableState
public DeviceFoldableState getCurrentFoldableState ()
Returns the current foldable state of the device or null if some issues occurred.
보고 | |
---|---|
DeviceFoldableState |
던지기 | |
---|---|
DeviceNotAvailableException |
getCurrentUser
public int getCurrentUser ()
Return the id of the current running user. In case of error, return -10000.
보고 | |
---|---|
int |
던지기 | |
---|---|
DeviceNotAvailableException |
getDeviceClass
public String getDeviceClass ()
Get the device class.
보고 | |
---|---|
String | the String device class. |
getDeviceDate
public long getDeviceDate ()
Return the date of the device in millisecond since epoch.
보고 | |
---|---|
long | the date of the device in epoch format. |
던지기 | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor ()
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
보고 | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
매개변수 | |
---|---|
shortDescriptor | boolean : Whether or not to limit descriptor to bare minimum info |
보고 | |
---|---|
DeviceDescriptor |
getDeviceTimeOffset
public long getDeviceTimeOffset (Date date)
Helper to get the time difference between the device and a given ERROR(/Date)
. Use Epoch time internally.
매개변수 | |
---|---|
date | Date |
보고 | |
---|---|
long | the difference in milliseconds |
던지기 | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public InputStreamSource getEmulatorOutput ()
Get the stream of emulator stdout and stderr
보고 | |
---|---|
InputStreamSource | emulator output |
getEmulatorProcess
public Process getEmulatorProcess ()
Return the Process
corresponding to this emulator.
보고 | |
---|---|
Process | the Process or null |
getExecuteShellCommandLog
public final File getExecuteShellCommandLog ()
The log that contains all the executeShellCommand(String)
logs.
보고 | |
---|---|
File |
getExternalStoreFreeSpace
public long getExternalStoreFreeSpace ()
Helper method to determine amount of free space on device external storage.
보고 | |
---|---|
long | the amount of free space in KB |
던지기 | |
---|---|
DeviceNotAvailableException |
getFastbootPath
public String getFastbootPath ()
Returns the path of the fastboot binary being used. Still requires isFastbootEnabled()
to be true, to have fastboot functions enabled.
보고 | |
---|---|
String |
getFastbootProductType
public String getFastbootProductType ()
Convenience method to get the product type of this device when its in fastboot mode.
This method should only be used if device should be in fastboot. Its a bit safer variant than the genericgetProductType()
method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.보고 | |
---|---|
String | the String product type name or null if it cannot be determined |
던지기 | |
---|---|
DeviceNotAvailableException |
getFastbootProductVariant
public String getFastbootProductVariant ()
Convenience method to get the product type of this device when its in fastboot mode.
This method should only be used if device should be in fastboot. Its a bit safer variant than the genericgetProductType()
method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.보고 | |
---|---|
String | the String product type name or null if it cannot be determined |
던지기 | |
---|---|
DeviceNotAvailableException |
getFastbootSerialNumber
public String getFastbootSerialNumber ()
Returns the fastboot mode serial number.
보고 | |
---|---|
String |
getFastbootVariable
public String getFastbootVariable (String variableName)
Retrieve the given fastboot variable value from the device.
매개변수 | |
---|---|
variableName | String : the variable name |
보고 | |
---|---|
String | the property value or null if it does not exist |
던지기 | |
---|---|
DeviceNotAvailableException |
getFastbootVersion
public String getFastbootVersion ()
Returns the version string of the fastboot binary being used. Or null if something goes wrong.
보고 | |
---|---|
String |
getFileEntry
public IFileEntry getFileEntry (String path)
Retrieve a reference to a remote file on device.
매개변수 | |
---|---|
path | String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported) |
보고 | |
---|---|
IFileEntry | the IFileEntry or null if file at given path cannot be found |
던지기 | |
---|---|
DeviceNotAvailableException |
getFileEntry
public IFileEntry getFileEntry (FileListingService.FileEntry entry)
Unofficial helper to get a FileEntry
from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).
매개변수 | |
---|---|
entry | FileListingService.FileEntry : a FileEntry not necessarily root as Ddmlib requires. |
보고 | |
---|---|
IFileEntry | a FileEntryWrapper representing the FileEntry. |
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getFoldableStates
publicgetFoldableStates ()
Returns the list of foldable states on the device. Can be obtained with "cmd device_state print-states".
보고 | |
---|---|
던지기 | |
---|---|
DeviceNotAvailableException |
getIDevice
public IDevice getIDevice ()
Returns a reference to the associated ddmlib IDevice
.
IDevice
may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice
, because that reference may become stale.보고 | |
---|---|
IDevice | the IDevice |
getInstalledPackageNames
publicgetInstalledPackageNames ()
Fetch the application package names present on the device.
보고 | |
---|---|
ERROR(/Set) of String package names currently installed on the device. |
던지기 | |
---|---|
DeviceNotAvailableException |
getIntProperty
public long getIntProperty (String name, long defaultValue)
Returns integer value of the given property from the device.
매개변수 | |
---|---|
name | String : the property name |
defaultValue | long : default value to return if property is empty or doesn't exist. |
보고 | |
---|---|
long | the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value. |
던지기 | |
---|---|
DeviceNotAvailableException |
getIpAddress
public String getIpAddress ()
Gets the device's IP address.
보고 | |
---|---|
String | the device's IP address, or null if device has no IP address |
던지기 | |
---|---|
DeviceNotAvailableException |
getKeyguardState
public KeyguardControllerState getKeyguardState ()
Return an object to get the current state of the keyguard or null if not supported.
보고 | |
---|---|
KeyguardControllerState | a KeyguardControllerState containing a snapshot of the state of the keyguard and returns Null if the Keyguard query is not supported. |
던지기 | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis()
.
보고 | |
---|---|
long |
getLaunchApiLevel
public int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
보고 | |
---|---|
int | an integer indicating the first launched API Level of device |
던지기 | |
---|---|
DeviceNotAvailableException |
getLogcat
public InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat capture보고 | |
---|---|
InputStreamSource |
getLogcat
public InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
매개변수 | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
보고 | |
---|---|
InputStreamSource |
getLogcatDump
public InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
보고 | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
매개변수 | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
보고 | |
---|---|
InputStreamSource |
getMacAddress
public String getMacAddress ()
Returns the MAC address of the device, null if it fails to query from the device.
보고 | |
---|---|
String |
getMainUserId
public Integer getMainUserId ()
Returns the main user id.
보고 | |
---|---|
Integer | the userId of the main user if there is one, and null if there is no main user. |
던지기 | |
---|---|
DeviceNotAvailableException |
getMainlineModuleInfo
publicgetMainlineModuleInfo ()
Get the information about the mainline modules installed on the device.
보고 | |
---|---|
ERROR(/Set) of String mainline modules currently installed on the device. |
던지기 | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfRunningUsersSupported
public int getMaxNumberOfRunningUsersSupported ()
Get the maximum number of supported simultaneously running users. Defaults to 0.
보고 | |
---|---|
int | an integer indicating the number of simultaneously running users |
던지기 | |
---|---|
DeviceNotAvailableException |
getMaxNumberOfUsersSupported
public int getMaxNumberOfUsersSupported ()
Get the maximum number of supported users. Defaults to 0.
보고 | |
---|---|
int | an integer indicating the number of supported users |
던지기 | |
---|---|
DeviceNotAvailableException |
getMicrodroidProcess
public Process getMicrodroidProcess ()
보고 | |
---|---|
Process | Returns the Process of the Microdroid VM. If TestDevice is not a Microdroid, returns null. |
getMonitor
public IDeviceStateMonitor getMonitor ()
Return the IDeviceStateMonitor
associated with device.
보고 | |
---|---|
IDeviceStateMonitor |
getMountPoint
public String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
매개변수 | |
---|---|
mountName | String : the name of the mount point |
보고 | |
---|---|
String | the mount point or null |
getMountPointInfo
public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
매개변수 | |
---|---|
mountpoint | String |
보고 | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
던지기 | |
---|---|
DeviceNotAvailableException |
getMountPointInfo
publicgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
보고 | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
던지기 | |
---|---|
DeviceNotAvailableException |
getOptions
public TestDeviceOptions getOptions ()
Fetch the test options for the device.
보고 | |
---|---|
TestDeviceOptions | TestDeviceOptions related to the device under test. |
getPartitionFreeSpace
public long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
매개변수 | |
---|---|
partition | String |
보고 | |
---|---|
long | the amount of free space in KB |
던지기 | |
---|---|
DeviceNotAvailableException |
getPrimaryUserId
public Integer getPrimaryUserId ()
Returns the primary user id.
보고 | |
---|---|
Integer | the userId of the primary user if there is one, and null if there is no primary user. |
던지기 | |
---|---|
DeviceNotAvailableException |
getProcessByName
public ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
매개변수 | |
---|---|
processName | String : the proces name String. |
보고 | |
---|---|
ProcessInfo | ProcessInfo of given processName |
던지기 | |
---|---|
DeviceNotAvailableException |
getProcessPid
public String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
매개변수 | |
---|---|
process | String : The proces name String. |
보고 | |
---|---|
String |
던지기 | |
---|---|
DeviceNotAvailableException |
getProductType
public String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.보고 | |
---|---|
String | the String product type name. Will not be null |
던지기 | |
---|---|
DeviceNotAvailableException |
getProductVariant
public String getProductVariant ()
Convenience method to get the product variant of this device.
This method will work if device is in either adb or fastboot mode.보고 | |
---|---|
String | the String product variant name or null if it cannot be determined |
던지기 | |
---|---|
DeviceNotAvailableException |
getProperty
public String getProperty (String name)
Retrieve the given property value from the device.
매개변수 | |
---|---|
name | String : the property name |
보고 | |
---|---|
String | the property value or null if it does not exist |
던지기 | |
---|---|
DeviceNotAvailableException |
getRecoveryMode
public ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
보고 | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getScreenshot
public InputStreamSource getScreenshot (String format)
Grabs a screenshot from the device. Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size
매개변수 | |
---|---|
format | String : supported PNG, JPEG |
보고 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
던지기 | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (long displayId)
Grabs a screenshot from the device given display id. Format is PNG.
TODO: extend the implementations above to support 'format' and 'rescale'
매개변수 | |
---|---|
displayId | long : the display id of the screen to get screenshot from. |
보고 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
던지기 | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot (String format, boolean rescale)
Grabs a screenshot from the device. Recommended to use getScreenshot(String)
instead with JPEG encoding for smaller size.
매개변수 | |
---|---|
format | String : supported PNG, JPEG |
rescale | boolean : if screenshot should be rescaled to reduce the size of resulting image |
보고 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in format, or null if the screenshot was not successful. |
던지기 | |
---|---|
DeviceNotAvailableException |
getScreenshot
public InputStreamSource getScreenshot ()
Grabs a screenshot from the device.
보고 | |
---|---|
InputStreamSource | a InputStreamSource of the screenshot in png format, or null if the screenshot was not successful. |
던지기 | |
---|---|
DeviceNotAvailableException |
getSerialNumber
public String getSerialNumber ()
Convenience method to get serial number of this device.
보고 | |
---|---|
String | the String serial number |
getSetting
public String getSetting (int userId, String namespace, String key)
Return the value of the requested setting. namespace must be one of: {"system", "secure", "global"}
매개변수 | |
---|---|
userId | int |
namespace | String |
key | String |
보고 | |
---|---|
String | the value associated with the namespace:key of a user. Null if not found. |
던지기 | |
---|---|
DeviceNotAvailableException |
getSetting
public String getSetting (String namespace, String key)
See getSetting(int, String, String)
and performed on system user.
매개변수 | |
---|---|
namespace | String |
key | String |
보고 | |
---|---|
String |
던지기 | |
---|---|
DeviceNotAvailableException |
getSimOperator
public String getSimOperator ()
Return the SIM card operator or null if not available or if device is not available.
보고 | |
---|---|
String |
getSimState
public String getSimState ()
Return the SIM card state or null if not available or device is not available.
보고 | |
---|---|
String |
getTombstones
publicgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
보고 | |
---|---|
A list of tombstone files, empty if no tombstone. |
던지기 | |
---|---|
DeviceNotAvailableException |
getTotalMemory
public long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
보고 | |
---|---|
long |
getUninstallablePackageNames
publicgetUninstallablePackageNames ()
Fetch the application package names that can be uninstalled. This is presently defined as non-system packages, and updated system packages.
보고 | |
---|---|
ERROR(/Set) of uninstallable String package names currently installed on the device. |
던지기 | |
---|---|
DeviceNotAvailableException |
getUseFastbootErase
public boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
보고 | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
getUserFlags
public int getUserFlags (int userId)
Find and return the flags of a given user. Flags are defined in "android.content.pm.UserInfo" class in Android Open Source Project.
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
int | the flags associated with the userId provided if found, -10000 in any other cases. |
던지기 | |
---|---|
DeviceNotAvailableException |
getUserInfos
publicgetUserInfos ()
Gets the Map of useId to UserInfo
on the device. Will throw DeviceRuntimeException
if output from device is not as expected.
보고 | |
---|---|
the list of UserInfo objects. |
던지기 | |
---|---|
DeviceNotAvailableException |
getUserSerialNumber
public int getUserSerialNumber (int userId)
Return the serial number associated to the userId if found, -10000 in any other cases.
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
int |
던지기 | |
---|---|
DeviceNotAvailableException |
handleAllocationEvent
public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)
Process the given DeviceEvent. May transition device to new state. Will inform the IDeviceMonitor
of any state transitions.
Process the DeviceEvent, which may or may not transition this device to a new allocation state.
매개변수 | |
---|---|
event | DeviceEvent |
보고 | |
---|---|
IManagedTestDevice.DeviceEventResponse |
hasFeature
public boolean hasFeature (String feature)
Check if a feature is available on a device.
매개변수 | |
---|---|
feature | String : which format should be "feature: |
보고 | |
---|---|
boolean | True if feature is found, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
installPackage
public String installPackage (File packageFile, boolean reinstall, String... extraArgs)
Install an Android package on device.
매개변수 | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
보고 | |
---|---|
String | a String with an error code, or null if success. |
던지기 | |
---|---|
DeviceNotAvailableException |
installPackage
public String installPackage (File packageFile, boolean reinstall, boolean grantPermissions, String... extraArgs)
Install an Android package on device.
Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.
매개변수 | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
grantPermissions | boolean : if all runtime permissions should be granted at install time |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
보고 | |
---|---|
String | a String with an error code, or null if success. |
던지기 | |
---|---|
DeviceNotAvailableException |
installPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, int userId, String... extraArgs)
Install an Android package on device for a given user.
매개변수 | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
userId | int : the integer user id to install for. |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
보고 | |
---|---|
String | a String with an error code, or null if success. |
던지기 | |
---|---|
DeviceNotAvailableException |
installPackageForUser
public String installPackageForUser (File packageFile, boolean reinstall, boolean grantPermissions, int userId, String... extraArgs)
Install an Android package on device for a given user.
Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.
매개변수 | |
---|---|
packageFile | File : the apk file to install |
reinstall | boolean : true if a reinstall should be performed |
grantPermissions | boolean : if all runtime permissions should be granted at install time |
userId | int : the integer user id to install for. |
extraArgs | String : optional extra arguments to pass. See 'adb shell pm -h' for available options. |
보고 | |
---|---|
String | a String with an error code, or null if success. |
던지기 | |
---|---|
DeviceNotAvailableException |
invalidatePropertyCache
public void invalidatePropertyCache ()
isAdbTcp
public boolean isAdbTcp ()
보고 | |
---|---|
boolean |
isAppEnumerationSupported
public boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
보고 | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
던지기 | |
---|---|
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
보고 | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
던지기 | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public boolean isDeviceEncrypted ()
Returns if the device is encrypted.
보고 | |
---|---|
boolean | true if the device is encrypted. |
던지기 | |
---|---|
DeviceNotAvailableException |
isDirectory
public boolean isDirectory (String path)
Return True if the path on the device is a directory, false otherwise.
매개변수 | |
---|---|
path | String |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isEnableAdbRoot
public boolean isEnableAdbRoot ()
보고 | |
---|---|
boolean | true if adb root should be enabled on device |
isEncryptionSupported
public boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
보고 | |
---|---|
boolean | true if the device supports encryption. |
던지기 | |
---|---|
DeviceNotAvailableException |
isExecutable
public boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
매개변수 | |
---|---|
fullPath | String |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isFastbootEnabled
public boolean isFastbootEnabled ()
Return if fastboot is available for the device.
보고 | |
---|---|
boolean |
isHeadless
public boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isHeadlessSystemUserMode
public boolean isHeadlessSystemUserMode ()
Returns whether the device uses headless system user mode.
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isMainUserPermanentAdmin
public boolean isMainUserPermanentAdmin ()
Returns whether the main user is a permanent admin and can't be deleted or downgraded to non-admin status.
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isMultiUserSupported
public boolean isMultiUserSupported ()
Determines if multi user is supported.
보고 | |
---|---|
boolean | true if multi user is supported, false otherwise |
던지기 | |
---|---|
DeviceNotAvailableException |
isPackageInstalled
public boolean isPackageInstalled (String packageName, String userId)
Query the device for a given package name and given user id to check if it's currently installed or not for that user.
매개변수 | |
---|---|
packageName | String : the package we are checking if it's installed. |
userId | String : The user id we are checking the package is installed for. If null, primary user zero will be used. |
보고 | |
---|---|
boolean | True if the package is reported as installed. False otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
isPackageInstalled
public boolean isPackageInstalled (String packageName)
Query the device for a given package name to check if it's currently installed or not.
매개변수 | |
---|---|
packageName | String |
보고 | |
---|---|
boolean | True if the package is reported as installed. False otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
보고 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
보고 | |
---|---|
boolean |
isUserRunning
public boolean isUserRunning (int userId)
Check if a given user is running.
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
boolean | True if the user is running, false in every other cases. |
던지기 | |
---|---|
DeviceNotAvailableException |
isUserSecondary
public boolean isUserSecondary (int userId)
Return whether the specified user is a secondary user according to it's flags.
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
boolean | true if the user is secondary, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
isUserVisible
public boolean isUserVisible (int userId)
Checks if the given user is visible.
A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities (typically in the default display).
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isUserVisibleOnDisplay
public boolean isUserVisibleOnDisplay (int userId, int displayId)
Checks if the given user is visible in the given display.
A "visible" user is a user that is interacting with the "human" user and hence is able to launch launch activities in that display.
매개변수 | |
---|---|
userId | int |
displayId | int |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isVisibleBackgroundUsersOnDefaultDisplaySupported
public boolean isVisibleBackgroundUsersOnDefaultDisplaySupported ()
Returns whether the device allow users to be started visible in the background in the ERROR(/java.android.view.Display#DEFAULT_DISPLAY)
.
If it does, you could call startVisibleBackgroundUser(int, int, boolean)
, passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers()
(which should include ERROR(/java.android.view.Display#DEFAULT_DISPLAY)
).
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isVisibleBackgroundUsersSupported
public boolean isVisibleBackgroundUsersSupported ()
Returns whether the device allow users to be started visible in the background.
If it does, you could call startVisibleBackgroundUser(int, int, boolean)
, passing a display returned by listDisplayIdsForStartingVisibleBackgroundUsers()
.
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
isWifiEnabled
public boolean isWifiEnabled ()
Test if wifi is enabled.
Checks if wifi is enabled on device. Useful for asserting wifi status before tests that shouldn't run with wifi, eg mobile data tests.보고 | |
---|---|
boolean | true if wifi is enabled. false if disabled |
던지기 | |
---|---|
DeviceNotAvailableException |
listDisplayIds
publiclistDisplayIds ()
Collect the list of available displays id on the device as reported by "dumpsys SurfaceFlinger".
보고 | |
---|---|
The list of displays. Default always returns the default display 0. |
던지기 | |
---|---|
DeviceNotAvailableException |
listDisplayIdsForStartingVisibleBackgroundUsers
publiclistDisplayIdsForStartingVisibleBackgroundUsers ()
Gets the list of displays that can be used to start a user visible in the background
.
보고 | |
---|---|
던지기 | |
---|---|
DeviceNotAvailableException |
listUsers
publiclistUsers ()
Gets the list of users on the device. Will throw DeviceRuntimeException
if output from device is not as expected.
보고 | |
---|---|
the list of user ids. |
던지기 | |
---|---|
DeviceNotAvailableException |
logAnrs
public boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
매개변수 | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
보고 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
logBugreport
public boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
매개변수 | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
보고 | |
---|---|
boolean | True if the logging was successful, false otherwise. |
logOnDevice
public void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
매개변수 | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
던지기 | |
---|---|
DeviceNotAvailableException |
postAdbRootAction
public void postAdbRootAction ()
Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postAdbUnrootAction
public void postAdbUnrootAction ()
Override if the device needs some specific actions to be taken after adb unroot and before the device is back online. Default implementation doesn't include any additional actions. adb root is not guaranteed to be disabled at this stage.
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public void postBootSetup ()
Perform instructions to configure device for testing that after every boot.
Should be called after device is fully booted/available In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot. Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)던지기 | |
---|---|
DeviceNotAvailableException |
postInvocationTearDown
public void postInvocationTearDown (Throwable exception)
Extra steps for device specific required clean up that will be executed after the invocation is done.
매개변수 | |
---|---|
exception | Throwable : if any, the final exception raised by the invocation failure. |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
매개변수 | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
던지기 | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
매개변수 | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
보고 | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pullFile
public boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
매개변수 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
보고 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pullFile
public File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
매개변수 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
보고 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
던지기 | |
---|---|
DeviceNotAvailableException |
pullFile
public File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
매개변수 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
보고 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
던지기 | |
---|---|
DeviceNotAvailableException |
pullFile
public boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
매개변수 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
localFile | File : the local file to store contents in. If non-empty, contents will be replaced. |
userId | int : The user id to pull from |
보고 | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pullFileContents
public String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
매개변수 | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
보고 | |
---|---|
String | A String containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
던지기 | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
매개변수 | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
보고 | |
---|---|
File | A ERROR(/File) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
던지기 | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
매개변수 | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
보고 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pushDir
public boolean pushDir (File localFileDir, String deviceFilePath)
Recursively push directory contents to device.
매개변수 | |
---|---|
localFileDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
보고 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pushFile
public boolean pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)
Variant of pushFile(File, String)
which can optionally consider evaluating the need for the content provider.
매개변수 | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
보고 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pushFile
public boolean pushFile (File localFile, String remoteFilePath)
Push a file to device. By default using a content provider.
매개변수 | |
---|---|
localFile | File : the local file to push |
remoteFilePath | String : the remote destination absolute file path |
보고 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
pushString
public boolean pushString (String contents, String remoteFilePath)
Push file created from a string to device
매개변수 | |
---|---|
contents | String : the contents of the file to push |
remoteFilePath | String : the remote destination absolute file path |
보고 | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
reboot
public void reboot (String reason)
Reboots the device into adb mode with given reason
to be persisted across reboot.
Blocks until device becomes available.
Last reboot reason can be obtained by querying sys.boot.reason
propety.
매개변수 | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
던지기 | |
---|---|
DeviceNotAvailableException |
reboot
public void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.던지기 | |
---|---|
DeviceNotAvailableException |
rebootIntoBootloader
public void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.던지기 | |
---|---|
DeviceNotAvailableException |
rebootIntoFastbootd
public void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
던지기 | |
---|---|
DeviceNotAvailableException |
rebootIntoRecovery
public void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recovery던지기 | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public void rebootIntoSideload ()
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
던지기 | |
---|---|
DeviceNotAvailableException |
rebootIntoSideload
public void rebootIntoSideload (boolean autoReboot)
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
매개변수 | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
던지기 | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
던지기 | |
---|---|
DeviceNotAvailableException |
rebootUntilOnline
public void rebootUntilOnline (String reason)
An alternate to reboot()
that only blocks until device is online ie visible to adb.
매개변수 | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
던지기 | |
---|---|
DeviceNotAvailableException |
rebootUserspace
public void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
던지기 | |
---|---|
DeviceNotAvailableException |
rebootUserspaceUntilOnline
public void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
던지기 | |
---|---|
DeviceNotAvailableException |
recoverDevice
public boolean recoverDevice ()
Attempts to recover device communication.
보고 | |
---|---|
boolean | True if recovery attempted and successful, returns False if recovery was skipped |
던지기 | |
---|---|
DeviceNotAvailableException | if device is no longer available |
registerDeviceActionReceiver
public void registerDeviceActionReceiver (IDeviceActionReceiver deviceActionReceiver)
Registers a IDeviceActionReceiver
for this device.
All registered IDeviceActionReceiver
s will be notified before a device action starts and after the device action ends.
매개변수 | |
---|---|
deviceActionReceiver | IDeviceActionReceiver : A IDeviceActionReceiver which will be registered. |
remountSystemReadOnly
public void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
던지기 | |
---|---|
DeviceNotAvailableException |
remountSystemWritable
public void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
던지기 | |
---|---|
DeviceNotAvailableException |
remountVendorReadOnly
public void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
던지기 | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
던지기 | |
---|---|
DeviceNotAvailableException |
removeAdmin
public boolean removeAdmin (String componentName, int userId)
Remove given device admin in given user and return true
if it is successful, false
otherwise.
매개변수 | |
---|---|
componentName | String : of device admin to be removed. |
userId | int : of user that the device admin lives in. |
보고 | |
---|---|
boolean | True if it is successful, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
removeOwners
public void removeOwners ()
Remove all existing device profile owners with the best effort.
던지기 | |
---|---|
DeviceNotAvailableException |
removeUser
public boolean removeUser (int userId)
Remove a given user from the device.
매개변수 | |
---|---|
userId | int : of the user to remove |
보고 | |
---|---|
boolean | true if we were successful in removing the user, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
resetContentProviderSetup
public void resetContentProviderSetup ()
Reset the flag for content provider setup in order to trigger it again.
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)
Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))
with one or more listeners passed as parameters.
매개변수 | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
보고 | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
던지기 | |
---|---|
DeviceNotAvailableException |
runInstrumentationTests
public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,listeners)
Runs instrumentation tests, and provides device recovery.
If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.
If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.
매개변수 | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
보고 | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
던지기 | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
매개변수 | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
매개변수 | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
setConfiguration
public void setConfiguration (IConfiguration configuration)
Injects the IConfiguration
in use.
매개변수 | |
---|---|
configuration | IConfiguration |
setConnectionAvdInfo
public final void setConnectionAvdInfo (GceAvdInfo avdInfo)
매개변수 | |
---|---|
avdInfo | GceAvdInfo |
setDate
public void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
매개변수 | |
---|---|
date | Date : specify a particular date; will use host date if null |
던지기 | |
---|---|
DeviceNotAvailableException |
setDeviceOwner
public boolean setDeviceOwner (String componentName, int userId)
Set a device admin component as device owner in given user.
매개변수 | |
---|---|
componentName | String : of device admin to be device owner. |
userId | int : of the user that the device owner lives in. |
보고 | |
---|---|
boolean | True if it is successful, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
setDeviceState
public void setDeviceState (TestDeviceState deviceState)
Update the device's state.
매개변수 | |
---|---|
deviceState | TestDeviceState : the TestDeviceState |
setEmulatorOutputStream
public void setEmulatorOutputStream (SizeLimitedOutputStream output)
For emulator set SizeLimitedOutputStream
to log output
매개변수 | |
---|---|
output | SizeLimitedOutputStream : to log the output |
setEmulatorProcess
public void setEmulatorProcess (Process p)
Sets the Process
, when this device is an emulator.
매개변수 | |
---|---|
p | Process |
setFastbootEnabled
public void setFastbootEnabled (boolean fastbootEnabled)
Set the fastboot option for the device. Should be set when device is first allocated.
매개변수 | |
---|---|
fastbootEnabled | boolean : whether fastboot is available for the device or not |
setFastbootPath
public void setFastbootPath (String fastbootPath)
Sets the path to the fastboot binary that should be used. Still requires isFastbootEnabled()
to be true, to have fastboot functions enabled.
매개변수 | |
---|---|
fastbootPath | String |
setIDevice
public void setIDevice (IDevice newDevice)
Update the IDevice associated with this ITestDevice.
The new IDevice must refer the same physical device as the current reference. This method will be called if DDMS has allocated a new IDevice매개변수 | |
---|---|
newDevice | IDevice : the IDevice |
setLogStartDelay
public void setLogStartDelay (int delay)
Sets the time in ms to wait before starting logcat capture for a online device.
매개변수 | |
---|---|
delay | int : the delay in ms |
setOptions
public void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
매개변수 | |
---|---|
options | TestDeviceOptions |
setProperty
public boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
매개변수 | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
보고 | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
setRecovery
public void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
매개변수 | |
---|---|
recovery | IDeviceRecovery : the IDeviceRecovery |
setRecoveryMode
public void setRecoveryMode (ITestDevice.RecoveryMode mode)
Set the current recovery mode to use for the device.
Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc매개변수 | |
---|---|
mode | ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not. |
setSetting
public void setSetting (String namespace, String key, String value)
See setSetting(int, String, String, String)
and performed on system user.
매개변수 | |
---|---|
namespace | String |
key | String |
value | String |
던지기 | |
---|---|
DeviceNotAvailableException |
setSetting
public void setSetting (int userId, String namespace, String key, String value)
Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}
매개변수 | |
---|---|
userId | int |
namespace | String |
key | String |
value | String |
던지기 | |
---|---|
DeviceNotAvailableException |
setTestLogger
public void setTestLogger (ITestLogger testLogger)
Injects the ITestLogger
instance
매개변수 | |
---|---|
testLogger | ITestLogger |
setUseFastbootErase
public void setUseFastbootErase (boolean useFastbootErase)
Set whether to use fastboot erase or fastboot format to wipe a partition on the device.
매개변수 | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
startLogcat
public void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.startUser
public boolean startUser (int userId)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.
매개변수 | |
---|---|
userId | int : of the user to start in the background |
보고 | |
---|---|
boolean | true if the user was successfully started in the background. |
던지기 | |
---|---|
DeviceNotAvailableException |
startUser
public boolean startUser (int userId, boolean waitFlag)
Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.
매개변수 | |
---|---|
userId | int : of the user to start in the background |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
보고 | |
---|---|
boolean | true if the user was successfully started in the background. |
던지기 | |
---|---|
DeviceNotAvailableException |
startVisibleBackgroundUser
public boolean startVisibleBackgroundUser (int userId, int displayId, boolean waitFlag)
Starts a given user in the background, visible in the given display (ie, allowing the user to launch activities in that display).
NOTE: this command doesn't check if the user exists, display is available, device supports such feature
, etc.
매개변수 | |
---|---|
userId | int : of the user to start in the background |
displayId | int : display to start user visible on |
waitFlag | boolean : will make the command wait until user is started and unlocked. |
보고 | |
---|---|
boolean | true if the user was successfully started visible in the background. |
던지기 | |
---|---|
DeviceNotAvailableException |
stopEmulatorOutput
public void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.stopUser
public boolean stopUser (int userId)
Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.
매개변수 | |
---|---|
userId | int : of the user to stop. |
보고 | |
---|---|
boolean | true if the user was successfully stopped. |
던지기 | |
---|---|
DeviceNotAvailableException |
stopUser
public boolean stopUser (int userId, boolean waitFlag, boolean forceFlag)
Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.
매개변수 | |
---|---|
userId | int : of the user to stop. |
waitFlag | boolean : will make the command wait until user is stopped. |
forceFlag | boolean : will force stop the user. |
보고 | |
---|---|
boolean | true if the user was successfully stopped. |
던지기 | |
---|---|
DeviceNotAvailableException |
switchToAdbTcp
public String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
보고 | |
---|---|
String | the tcp serial number or null if device could not be switched |
던지기 | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public boolean switchToAdbUsb ()
Switch device to adb over usb mode.
보고 | |
---|---|
boolean | true if switch was successful, false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
switchUser
public boolean switchUser (int userId)
Switch to another userId with a default timeout. switchUser(int, long)
.
매개변수 | |
---|---|
userId | int |
보고 | |
---|---|
boolean | True if the new userId matches the userId provider. False otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
switchUser
public boolean switchUser (int userId, long timeout)
Switch to another userId with the provided timeout as deadline. Attempt to disable keyguard after user change is successful.
매개변수 | |
---|---|
userId | int |
timeout | long : to wait before returning false for switch-user failed. |
보고 | |
---|---|
boolean | True if the new userId matches the userId provider. False otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
syncFiles
public boolean syncFiles (File localFileDir, String deviceFilePath)
Incrementally syncs the contents of a local file directory to device.
Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date. Hidden files (with names starting with ".") will be ignored. Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.매개변수 | |
---|---|
localFileDir | File : the local file directory containing files to recursively push. |
deviceFilePath | String : the remote destination absolute file path root. All directories in thos file path must be readable. ie pushing to /data/local/tmp when adb is not root will fail |
보고 | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
던지기 | |
---|---|
DeviceNotAvailableException |
takeBugreport
public Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue. File referenced in the Bugreport object need to be cleaned via Bugreport.close()
.
보고 | |
---|---|
Bugreport |
uninstallPackage
public String uninstallPackage (String packageName)
Uninstall an Android package from device.
매개변수 | |
---|---|
packageName | String : the Android package to uninstall |
보고 | |
---|---|
String | a String with an error code, or null if success. |
던지기 | |
---|---|
DeviceNotAvailableException |
uninstallPackageForUser
public String uninstallPackageForUser (String packageName, int userId)
Uninstall an Android package from device for a given user.
매개변수 | |
---|---|
packageName | String : the Android package to uninstall |
userId | int : the integer user id to uninstall for. |
보고 | |
---|---|
String | a String with an error code, or null if success. |
던지기 | |
---|---|
DeviceNotAvailableException |
unlockDevice
public boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.보고 | |
---|---|
boolean | true if successful or if the device is unencrypted. |
던지기 | |
---|---|
DeviceNotAvailableException |
waitForBootComplete
public boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
매개변수 | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
보고 | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
보고 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
매개변수 | |
---|---|
waitTime | long : the time in ms to wait |
보고 | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailableInRecoverPath
public boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
매개변수 | |
---|---|
waitTime | long |
보고 | |
---|---|
boolean | True if device is available, False if unavailable. |
던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceBootloader
public void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceInRecovery
public boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
매개변수 | |
---|---|
waitTime | long : the time in ms to wait |
보고 | |
---|---|
boolean | true if device boots into recovery before time expires. false otherwise |
waitForDeviceInSideload
public boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
매개변수 | |
---|---|
waitTime | long : the time in ms to wait |
보고 | |
---|---|
boolean | true if device boots into sideload before time expires. false otherwise |
waitForDeviceNotAvailable
public boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
매개변수 | |
---|---|
waitTime | long : the time in ms to wait |
보고 | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceOnline
public void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.매개변수 | |
---|---|
waitTime | long : the time in ms to wait |
던지기 | |
---|---|
DeviceNotAvailableException |
waitForDeviceShell
public boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
매개변수 | |
---|---|
waitTime | long : the time in ms to wait |
보고 | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |
Protected methods
addExtraConnectionBuilderArgs
protected void addExtraConnectionBuilderArgs (DefaultConnection.ConnectionBuilder builder)
매개변수 | |
---|---|
builder | DefaultConnection.ConnectionBuilder |
buildAdbShellCommand
protected String[] buildAdbShellCommand (String command, boolean forceExitStatusDetection)
Builds the OS command for the given adb shell command session and args
매개변수 | |
---|---|
command | String |
forceExitStatusDetection | boolean |
보고 | |
---|---|
String[] |
checkApiLevelAgainst
protected void checkApiLevelAgainst (String feature, int strictMinLevel)
매개변수 | |
---|---|
feature | String |
strictMinLevel | int |
createRebootDeviceAction
protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, String reason)
Create a RebootDeviceAction
to be used when performing a reboot action.
매개변수 | |
---|---|
rebootMode | NativeDevice.RebootMode : a mode of this reboot. |
reason | String : for this reboot. |
보고 | |
---|---|
NativeDevice.RebootDeviceAction | the created RebootDeviceAction . |
doAdbReboot
protected void doAdbReboot (NativeDevice.RebootMode rebootMode, String reason)
Perform a adb reboot.
매개변수 | |
---|---|
rebootMode | NativeDevice.RebootMode : a mode of this reboot. |
reason | String : for this reboot. |
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
ensureRuntimePermissionSupported
protected void ensureRuntimePermissionSupported ()
helper method to throw exception if runtime permission isn't supported
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getApiLevelSafe
protected int getApiLevelSafe ()
보고 | |
---|---|
int |
initializeConnection
protected void initializeConnection (IBuildInfo info, MultiMap<String, String> attributes)
매개변수 | |
---|---|
info | IBuildInfo |
attributes | MultiMap |
던지기 | |
---|---|
DeviceNotAvailableException | |
TargetSetupError |
internalGetProperty
protected String internalGetProperty (String propName, String fastbootVar, String description)
Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.
매개변수 | |
---|---|
propName | String : The name of the device property as returned by `adb shell getprop` |
fastbootVar | String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted |
description | String : A simple description of the variable. First letter should be capitalized. |
보고 | |
---|---|
String | A string, possibly null or empty, containing the value of the given property |
던지기 | |
---|---|
DeviceNotAvailableException |
isInRebootCallback
protected boolean isInRebootCallback ()
Returns whether reboot callbacks is currently being executed or not. All public api's for reboot should be disabled if true.
보고 | |
---|---|
boolean |
isNewer
protected boolean isNewer (File localFile, IFileEntry entry)
Return true
if local file is newer than remote file. IFileEntry
being accurate to the minute, in case of equal times, the file will be considered newer.
매개변수 | |
---|---|
localFile | File |
entry | IFileEntry |
보고 | |
---|---|
boolean |
notifyRebootEnded
protected void notifyRebootEnded ()
Notifies all IDeviceActionReceiver
about reboot end event.
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
notifyRebootStarted
protected void notifyRebootStarted ()
Notifies all IDeviceActionReceiver
about reboot start event.
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
performDeviceAction
protected boolean performDeviceAction (String actionDescription, NativeDevice.DeviceAction action, int retryAttempts)
Performs an action on this device. Attempts to recover device and optionally retry command if action fails.
매개변수 | |
---|---|
actionDescription | String : a short description of action to be performed. Used for logging purposes only. |
action | NativeDevice.DeviceAction : the action to be performed |
retryAttempts | int : the retry attempts to make for action if it fails but recovery succeeds |
보고 | |
---|---|
boolean | true if action was performed successfully |
던지기 | |
---|---|
DeviceNotAvailableException | if recovery attempt fails or max attempts done without success |
postAdbReboot
protected void postAdbReboot ()
Possible extra actions that can be taken after a reboot.
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
prePostBootSetup
protected void prePostBootSetup ()
Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.
던지기 | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
pullFileInternal
protected boolean pullFileInternal (String remoteFilePath, File localFile)
매개변수 | |
---|---|
remoteFilePath | String |
localFile | File |
보고 | |
---|---|
boolean |
던지기 | |
---|---|
DeviceNotAvailableException |
setClock
protected void setClock (Clock clock)
Set the Clock instance to use.
매개변수 | |
---|---|
clock | Clock |
setMicrodroidProcess
protected void setMicrodroidProcess (Process process)
Marks the TestDevice as microdroid and sets its CID.
매개변수 | |
---|---|
process | Process : Process of the Microdroid VM. |
setTestDeviceOptions
protected void setTestDeviceOptions (deviceOptions)
매개변수 | |
---|---|
deviceOptions |
simpleFastbootCommand
protected CommandResult simpleFastbootCommand (long timeout,envVarMap, String[] fullCmd)
Executes a simple fastboot command with environment variables and report the status of the command.
매개변수 | |
---|---|
timeout | long |
envVarMap | |
fullCmd | String |
보고 | |
---|---|
CommandResult |
simpleFastbootCommand
protected CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)
Executes a simple fastboot command and report the status of the command.
매개변수 | |
---|---|
timeout | long |
fullCmd | String |
보고 | |
---|---|
CommandResult |
waitForDeviceNotAvailable
protected boolean waitForDeviceNotAvailable (String operationDesc, long time)
Wait to see the device going unavailable (stop reporting to adb).
매개변수 | |
---|---|
operationDesc | String : The name of the operation that is waiting for unavailable. |
time | long : The time to wait for unavailable to occur. |
보고 | |
---|---|
boolean | True if device did become unavailable. |
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2023-07-19(UTC)