INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
ddmlib IDevice
에 안정적이고 약간 더 높은 수준의 API를 제공합니다.
요약
상수 | |
---|---|
int | UNKNOWN_API_LEVEL API 레벨을 감지할 수 없는 경우 기본값 |
공개 메서드 | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) 최소 지원 수준에서 현재 기능이 지원되는지 확인하십시오. |
abstract void | clearLogcat () 누적된 모든 logcat 데이터를 삭제합니다. |
abstract void | deleteFile (String deviceFilePath) 장치에서 파일 또는 디렉터리를 삭제하는 도우미 메서드입니다. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) 현재 system_server 와 이전 system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) 장치 및 해당 |
abstract boolean | disableAdbRoot () adb 루트를 끕니다. |
abstract boolean | doesFileExist (String deviceFilePath) 장치에 파일이 있는지 확인하는 도우미 메서드입니다. |
abstract boolean | enableAdbRoot () adb 루트를 켭니다. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) 지정된 시간 초과가 있는 시스템 명령으로 adb 명령을 실행하는 도우미 메서드입니다. |
abstract String | executeAdbCommand (String... commandArgs) adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) 기본 시간 제한이 2분인 시스템 명령으로 fastboot 명령을 실행하는 도우미 메서드입니다. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) 시스템 환경 변수를 사용하여 시스템 명령으로 장기 실행 fastboot 명령을 실행하는 도우미 메서드입니다. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) 장기 실행 fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다. |
abstract String | executeShellCommand (String command) adb 셸 명령을 실행하고 출력을 |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) 주어진 adb 쉘 명령을 실행하고 명령이 실패하면 여러 번 재시도합니다. |
abstract CommandResult | executeShellV2Command (String command) adb 셸 명령을 실행하고 명령 상태 출력, stdout 및 stderr로 적절히 채워진 |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) adb 셸 명령을 실행하고 명령 상태 출력 및 stderr로 적절하게 채워진 |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) adb 셸 명령을 실행하고 명령 상태 출력, stdout 및 stderr로 적절하게 채워진 |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) 명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) 명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다. |
abstract CommandResult | fastbootWipePartition (String partition) 장치의 파티션을 지우는 도우미 메서드입니다. |
abstract int | getApiLevel () 장치 API 레벨을 가져옵니다. |
abstract String | getBasebandVersion () 이 장치의 기저대역(무선) 버전을 가져오는 편리한 방법입니다. |
abstract Integer | getBattery () 장치의 현재 배터리 수준을 반환하거나 배터리 수준을 사용할 수 없는 경우 Null을 반환합니다. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) 주어진 속성의 부울 값을 반환합니다. |
abstract | getBootHistory () 도우미 메서드는 부팅 시간 및 부팅 이유가 포함된 부팅 히스토리 맵을 수집합니다. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Helper 메서드는 장치의 epoch 이후 지정된 시간 이후의 부팅 시간 및 부팅 이유와 지정된 시간 단위가 포함된 부팅 히스토리 맵을 수집합니다. |
abstract String | getBootloaderVersion () 이 장치의 부트로더 버전을 가져오는 편리한 방법입니다. |
abstract InputStreamSource | getBugreport () 장치에서 버그 보고서를 검색합니다. |
abstract InputStreamSource | getBugreportz () 장치에서 bugreportz를 검색합니다. |
abstract String | getBuildAlias () 장치가 현재 실행 중인 빌드의 별칭을 검색합니다. |
abstract String | getBuildFlavor () 디바이스의 빌드 플레이버를 검색합니다. |
abstract String | getBuildId () 장치가 현재 실행 중인 빌드를 검색합니다. |
abstract String | getBuildSigningKeys () 장치 이미지에 서명하는 데 사용된 키 유형을 반환합니다. 일반적으로 Android 기기는 테스트 키(AOSP에서와 같이) 또는 릴리스 키(개별 기기 제조업체에서 제어)로 서명될 수 있습니다. |
abstract DeviceDescriptor | getCachedDeviceDescriptor () 장치가 할당된 경우 캐시된 |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) 장치가 할당된 경우 캐시된 |
abstract String[] | getChildren (String deviceFilePath) 권한 때문에 때때로 작동하지 않는 |
abstract String | getDeviceClass () 장치 클래스를 가져옵니다. |
abstract long | getDeviceDate () Epoch 이후의 장치 날짜를 밀리초 단위로 반환합니다. |
abstract DeviceDescriptor | getDeviceDescriptor () 실제 장치 개체를 전달하지 않고 장치 정보를 얻기 위해 장치 정보에서 |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) 실제 장치 개체를 전달하지 않고 장치 정보를 얻기 위해 장치 정보에서 |
abstract TestDeviceState | getDeviceState () 장치의 상태를 가져옵니다. |
abstract long | getDeviceTimeOffset (Date date) 장치와 주어진 |
abstract InputStreamSource | getEmulatorOutput () 에뮬레이터 stdout 및 stderr의 스트림 가져오기 |
abstract long | getExternalStoreFreeSpace () 장치 외부 저장소의 여유 공간을 확인하는 도우미 메서드입니다. |
abstract String | getFastbootProductType () 빠른 부팅 모드에 있을 때 이 장치의 제품 유형을 가져오는 편리한 방법입니다. |
abstract String | getFastbootProductVariant () 빠른 부팅 모드에 있을 때 이 장치의 제품 유형을 가져오는 편리한 방법입니다. |
abstract String | getFastbootSerialNumber () 빠른 부팅 모드 일련 번호를 반환합니다. |
abstract String | getFastbootVariable (String variableName) 장치에서 지정된 fastboot 변수 값을 검색합니다. |
abstract IFileEntry | getFileEntry (String path) 장치의 원격 파일에 대한 참조를 검색합니다. |
abstract IDevice | getIDevice () 연결된 ddmlib |
abstract long | getIntProperty (String name, long defaultValue) 장치에서 주어진 속성의 정수 값을 반환합니다. |
abstract long | getLastExpectedRebootTimeMillis () |
abstract int | getLaunchApiLevel () 장치의 첫 번째 실행 API 레벨을 가져옵니다. |
abstract InputStreamSource | getLogcat () logcat 데이터의 스냅샷 스트림을 가져옵니다. |
abstract InputStreamSource | getLogcat (int maxBytes) 캡처된 logcat 데이터의 마지막 |
abstract InputStreamSource | getLogcatDump () 장치에 대한 현재 logcat의 덤프를 가져옵니다. |
abstract InputStreamSource | getLogcatSince (long date) 제공된 날짜부터 캡처된 logcat 데이터의 스냅샷 스트림을 가져옵니다. |
abstract String | getMountPoint (String mountName) 마운트 지점을 반환합니다. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) 지정된 마운트 지점 경로에 해당하는 |
abstract | getMountPointInfo () 장치의 /proc/mounts에 있는 정보의 구문 분석된 버전을 반환합니다. |
abstract long | getPartitionFreeSpace (String partition) 장치 파티션의 여유 공간을 결정하는 도우미 메서드입니다. |
abstract ProcessInfo | getProcessByName (String processName) Helper 메서드는 "pidof" 및 "stat" 명령을 실행하고 주어진 프로세스의 PID 및 프로세스 시작 시간과 함께 |
abstract String | getProcessPid (String process) 서비스의 pid를 반환하거나 문제가 발생한 경우 null을 반환합니다. |
abstract String | getProductType () 이 장치의 제품 유형을 가져오는 편리한 방법입니다. |
abstract String | getProductVariant () 이 장치의 제품 변형을 가져오는 편리한 방법입니다. |
abstract String | getProperty (String name) 디바이스에서 주어진 속성 값을 검색합니다. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () 장치에 사용된 현재 복구 모드를 가져옵니다. |
abstract String | getSerialNumber () 이 장치의 일련 번호를 가져오는 편리한 방법입니다. |
abstract | getTombstones () 장치에서 삭제 표시 목록을 가져와 반환합니다. |
abstract long | getTotalMemory () 총 실제 메모리 크기를 바이트 단위로 반환하거나 내부 오류의 경우 -1을 반환합니다. |
abstract boolean | getUseFastbootErase () 장치의 파티션을 지우기 위해 fastboot 지우기 또는 fastboot 형식을 사용할지 여부를 가져옵니다. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () 기기의 플랫폼이 앱 열거를 지원하는지 확인 |
abstract boolean | isDeviceEncrypted () 장치가 암호화되었는지 여부를 반환합니다. |
abstract boolean | isDirectory (String deviceFilePath) 장치의 경로가 디렉터리이면 True를 반환하고 그렇지 않으면 False를 반환합니다. |
abstract boolean | isEncryptionSupported () 장치에서 암호화가 지원되는지 여부를 반환합니다. |
abstract boolean | isExecutable (String fullPath) 장치의 파일 경로가 실행 파일이면 True를 반환하고 그렇지 않으면 False를 반환합니다. |
abstract boolean | isHeadless () 장치가 헤드리스(화면 없음)이면 true를 반환하고 그렇지 않으면 false를 반환합니다. |
abstract boolean | isRuntimePermissionSupported () 기기의 플랫폼이 런타임 권한 부여를 지원하는지 확인 |
abstract boolean | isStateBootloaderOrFastbootd () 장치가 |
abstract boolean | logAnrs ( ITestLogger logger) 기기에서 ANR을 수집하고 기록합니다. |
abstract boolean | logBugreport (String dataName, ITestLogger listener) 버그 보고를 받아 보고자에게 기록하는 도우미 메서드입니다. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) 장치의 logcat에 메시지를 기록합니다. |
abstract void | nonBlockingReboot () 장치를 재부팅하라는 명령을 실행하고 명령이 완료되고 장치가 adb에 더 이상 표시되지 않을 때 반환됩니다. |
abstract void | postBootSetup () 부팅할 때마다 테스트하기 위해 장치를 구성하는 지침을 수행합니다. |
default void | postInvocationTearDown () 이 메서드는 더 이상 사용되지 않습니다. 대신 |
abstract void | postInvocationTearDown (Throwable invocationException) 호출이 완료된 후 실행될 장치별 필수 정리에 대한 추가 단계입니다. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) 호출 흐름 전에 장치에서 실행될 장치별 필수 설정에 대한 추가 단계입니다. |
abstract boolean | pullDir (String deviceFilePath, File localDir) 장치에서 디렉토리 내용을 재귀적으로 가져옵니다. |
abstract File | pullFile (String remoteFilePath, int userId) 장치에서 파일을 검색하고 로컬 임시 |
abstract File | pullFile (String remoteFilePath) 장치에서 파일을 검색하고 로컬 임시 |
abstract boolean | pullFile (String remoteFilePath, File localFile) 장치에서 파일을 검색합니다. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) 장치에서 파일을 검색합니다. |
abstract String | pullFileContents (String remoteFilePath) 장치에서 파일을 검색하고 내용을 반환합니다. |
abstract File | pullFileFromExternal (String remoteFilePath) 장치의 외부 저장소에서 파일을 검색하고 로컬 임시 |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) 필터링된 일부 디렉터리를 제외하면서 디렉터리 내용을 장치에 재귀적으로 푸시합니다. |
abstract boolean | pushDir (File localDir, String deviceFilePath) 디렉토리 내용을 장치에 재귀적으로 푸시합니다. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) 선택적으로 콘텐츠 제공자의 필요성 평가를 고려할 수 있는 |
abstract boolean | pushFile (File localFile, String deviceFilePath) 파일을 장치에 푸시합니다. |
abstract boolean | pushString (String contents, String deviceFilePath) 문자열에서 생성된 파일을 장치로 푸시 |
abstract void | reboot () 장치를 adb 모드로 재부팅합니다. |
abstract void | reboot (String reason) 재부팅 후에도 지속되도록 지정된 |
abstract void | rebootIntoBootloader () 장치를 부트로더 모드로 재부팅합니다. |
abstract void | rebootIntoFastbootd () 장치를 fastbootd 모드로 재부팅합니다. |
abstract void | rebootIntoRecovery () 장치를 adb 복구 모드로 재부팅합니다. |
abstract void | rebootIntoSideload (boolean autoReboot) 기기를 adb 사이드로드 모드로 재부팅합니다(이는 복구 중인 특수 모드입니다). 기기가 사이드로드 모드로 전환될 때까지 차단 |
abstract void | rebootIntoSideload () 기기를 adb 사이드로드 모드로 재부팅합니다(이는 복구 중인 특수 모드입니다). 기기가 사이드로드 모드로 전환될 때까지 차단 |
abstract void | rebootUntilOnline () 장치가 온라인, 즉 adb에 표시될 때까지만 차단하는 |
abstract void | rebootUntilOnline (String reason) 장치가 온라인, 즉 adb에 표시될 때까지만 차단하는 |
abstract void | rebootUserspace () 장치의 사용자 공간 부분만 재부팅합니다. |
abstract void | rebootUserspaceUntilOnline () 장치가 온라인, 즉 adb에 표시될 때까지만 차단하는 |
abstract void | remountSystemWritable () 장치의 시스템 파티션을 쓰기 가능하게 만드십시오. |
abstract void | remountVendorWritable () 장치의 공급업체 파티션을 쓰기 가능하게 만드십시오. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) 매개변수로 전달된 하나 이상의 리스너로 |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) 계측 테스트를 실행하고 장치 복구를 제공합니다. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) |
abstract void | setDate (Date date) 장치에 날짜를 설정합니다 참고: 장치에서 날짜를 설정하려면 루트가 필요합니다. |
abstract void | setOptions ( TestDeviceOptions options) 장치에 대한 |
abstract boolean | setProperty (String propKey, String propValue) 장치에 지정된 속성 값을 설정합니다. |
abstract void | setRecovery ( IDeviceRecovery recovery) 이 장치에 사용할 |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) 장치에 사용할 현재 복구 모드를 설정합니다. |
abstract void | setUseFastbootErase (boolean useFastbootErase) 장치의 파티션을 지우기 위해 fastboot 지우기 또는 fastboot 형식을 사용할지 여부를 설정합니다. |
abstract void | startLogcat () 백그라운드에서 장치의 logcat 출력 캡처를 시작합니다. |
abstract void | stopEmulatorOutput () 에뮬레이터 출력을 닫고 삭제합니다. |
abstract void | stopLogcat () 장치에서 logcat 출력 캡처를 중지하고 현재 저장된 logcat 데이터를 버립니다. |
abstract String | switchToAdbTcp () 장치를 adb-over-tcp 모드로 전환합니다. |
abstract boolean | switchToAdbUsb () USB 모드를 통해 장치를 adb로 전환하십시오. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) 로컬 파일 디렉토리의 내용을 장치에 증분 동기화합니다. |
abstract Bugreport | takeBugreport () bugreport를 가져 와서 처리하기 위해 |
abstract boolean | unlockDevice () 장치가 암호화된 상태인 경우 장치의 잠금을 해제합니다. |
abstract boolean | waitForBootComplete (long timeOut) 장치의 부팅 완료 플래그가 설정될 때까지 차단됩니다. |
abstract boolean | waitForDeviceAvailable () 장치가 응답하고 테스트할 수 있을 때까지 기다립니다. |
abstract boolean | waitForDeviceAvailable (long waitTime) 장치가 응답하고 테스트할 수 있을 때까지 기다립니다. |
abstract void | waitForDeviceBootloader () 장치가 fastboot를 통해 표시될 때까지 차단됩니다. |
abstract boolean | waitForDeviceInRecovery (long waitTime) 장치가 'adb 복구' 상태에 있도록 차단합니다( |
abstract boolean | waitForDeviceInSideload (long waitTime) 기기가 'adb 사이드로드' 상태에 있도록 차단 |
abstract boolean | waitForDeviceNotAvailable (long waitTime) 장치를 사용할 수 없는 블록(예: adb에서 누락됨) |
abstract void | waitForDeviceOnline () 장치가 adb를 통해 표시될 때까지 차단됩니다. |
abstract void | waitForDeviceOnline (long waitTime) 장치가 adb를 통해 표시될 때까지 차단됩니다. |
abstract boolean | waitForDeviceShell (long waitTime) 장치가 기본 adb 셸 명령에 응답할 때까지 기다립니다. |
상수
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
API 레벨을 감지할 수 없는 경우 기본값
상수 값: -1(0xffffffff)
공개 메서드
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
최소 지원 수준에서 현재 기능이 지원되는지 확인하십시오. 이 방법은 API 레벨이 올라가기 전에 아직 출시되지 않은 기능을 고려합니다.
매개변수 | |
---|---|
strictMinLevel | int : 기능을 지원하는 엄격한 최소 가능한 수준입니다. |
보고 | |
---|---|
boolean | 지원되는 수준이면 True입니다. 그렇지 않으면 거짓입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
클리어로그캣
public abstract void clearLogcat ()
누적된 모든 logcat 데이터를 삭제합니다.
이는ITestDevice#getLogcat()
이 특정 시점 이후에 생성된 로그 데이터만 반환하도록 하려는 경우에 유용합니다(예: 새 장치 빌드를 플래시한 후 등). 파일 삭제
public abstract void deleteFile (String deviceFilePath)
장치에서 파일 또는 디렉터리를 삭제하는 도우미 메서드입니다.
매개변수 | |
---|---|
deviceFilePath | String : 장치에 있는 파일의 절대 경로입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
현재 system_server 와 이전 system_server ProcessInfo
를 비교하여 장치가 소프트 재시작되었는지 확인하는 도우미 메서드입니다. getProcessByName(String)
을 사용하여 ProcessInfo
를 가져옵니다.
매개변수 | |
---|---|
prevSystemServerProcess | ProcessInfo : 이전 system_server 프로세스 ProcessInfo 입니다. |
보고 | |
---|---|
boolean | 장치가 소프트 재시작되면 true |
던지다 | |
---|---|
RuntimeException | 장치에 비정상적인 부팅 이유가 있는 경우 |
DeviceNotAvailableException |
deviceSoftRestarted부터
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
장치 및 해당 ERROR(/TimeUnit)
의 epoch 이후 UTC 시간 이후 장치가 소프트 다시 시작되었는지 확인하는 도우미 메서드입니다. Soft-Restart는 장치 하드 재부팅(예: 재부팅 요청) 외부에서 다시 시작된 system_server를 나타냅니다. 밀리초 단위의 현재 장치 utcEpochTime은 getDeviceDate()
메서드로 얻을 수 있습니다.
매개변수 | |
---|---|
utcEpochTime | long : Epoch 이후의 장치 시간(초)입니다. |
timeUnit | TimeUnit : 주어진 utcEpochTime에 대한 시간 단위 TimeUnit . |
보고 | |
---|---|
boolean | 장치가 소프트 재시작되면 true |
던지다 | |
---|---|
RuntimeException | 장치에 비정상적인 부팅 이유가 있는 경우 |
DeviceNotAvailableException |
비활성화AdbRoot
public abstract boolean disableAdbRoot ()
adb 루트를 끕니다.
adb 루트를 비활성화하면 장치가 adb에서 연결 해제될 수 있습니다. 이 방법은 장치를 사용할 수 있을 때까지 차단됩니다.보고 | |
---|---|
boolean | 성공하면 true 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
파일 존재
public abstract boolean doesFileExist (String deviceFilePath)
장치에 파일이 있는지 확인하는 도우미 메서드입니다.
매개변수 | |
---|---|
deviceFilePath | String : 확인할 장치의 파일 절대 경로 |
보고 | |
---|---|
boolean | 파일이 있으면 true , 그렇지 않으면 false 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
adb 루트를 켭니다. "루트 활성화" 설정이 "거짓"이면 메시지를 기록하고 루트를 활성화하지 않고 반환합니다.
adb 루트를 활성화하면 장치가 adb에서 연결 해제될 수 있습니다. 이 방법은 장치를 사용할 수 있을 때까지 차단됩니다.보고 | |
---|---|
boolean | 성공하면 true 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행Adb명령
public abstract String executeAdbCommand (long timeout, String... commandArgs)
지정된 시간 초과가 있는 시스템 명령으로 adb 명령을 실행하는 도우미 메서드입니다.
executeShellCommand(String)
는 더 나은 오류 감지 및 성능을 제공하므로 가능한 한 대신 사용해야 합니다.
매개변수 | |
---|---|
timeout | long : 장치가 응답하지 않는 것으로 간주되기까지의 시간(밀리초), 시간 초과가 없는 경우 0L |
commandArgs | String : 실행할 adb 명령 및 인수 |
보고 | |
---|---|
String | 명령에서 stdout. 명령 실행에 실패한 경우 null 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행Adb명령
public abstract String executeAdbCommand (String... commandArgs)
adb 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
executeShellCommand(String)
는 더 나은 오류 감지 및 성능을 제공하므로 가능한 한 대신 사용해야 합니다.매개변수 | |
---|---|
commandArgs | String : 실행할 adb 명령 및 인수 |
보고 | |
---|---|
String | 명령에서 stdout. 명령 실행에 실패한 경우 null 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
빠른 부팅 명령 실행
public abstract CommandResult executeFastbootCommand (String... commandArgs)
기본 시간 제한이 2분인 시스템 명령으로 fastboot 명령을 실행하는 도우미 메서드입니다.
장치가 이미 fastboot 모드에 있을 때 사용될 것으로 예상됩니다.매개변수 | |
---|---|
commandArgs | String : fastboot 명령 및 실행할 인수 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
빠른 부팅 명령 실행
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
장치가 이미 fastboot 모드에 있을 때 사용될 것으로 예상됩니다.매개변수 | |
---|---|
timeout | long : 명령이 만료되기 전의 시간(밀리초) |
commandArgs | String : fastboot 명령 및 실행할 인수 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
긴빠른부트명령 실행
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
시스템 환경 변수를 사용하여 시스템 명령으로 장기 실행 fastboot 명령을 실행하는 도우미 메서드입니다.
더 긴 시간 초과를 사용한다는 점을 제외하고 executeFastbootCommand(String)
와 동일합니다.
매개변수 | |
---|---|
envVarMap | |
commandArgs | String : fastboot 명령 및 실행할 인수 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
긴빠른부트명령 실행
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
장기 실행 fastboot 명령을 시스템 명령으로 실행하는 도우미 메서드입니다.
더 긴 시간 초과를 사용한다는 점을 제외하고executeFastbootCommand(String)
와 동일합니다.매개변수 | |
---|---|
commandArgs | String : fastboot 명령 및 실행할 인수 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
쉘 명령 실행
public abstract String executeShellCommand (String command)
adb 셸 명령을 실행하고 출력을 String
으로 반환하는 도우미 메서드입니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
보고 | |
---|---|
String | 쉘 출력 |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
쉘 명령 실행
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
receiver | IShellOutputReceiver : 쉘 출력을 지시할 IShellOutputReceiver 입니다. |
maxTimeToOutputShellResponse | long : 명령이 응답을 출력하지 않는 최대 시간입니다. timeUnit 에 지정된 단위 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 의 단위 |
retryAttempts | int : 예외로 인해 실패한 경우 명령을 재시도하는 최대 횟수입니다. retryAttempts가 성공하지 않고 수행되면 retryAttempts 이 발생합니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
쉘 명령 실행
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
receiver | IShellOutputReceiver : 쉘 출력을 지시할 IShellOutputReceiver 입니다. |
maxTimeoutForCommand | long : 명령이 완료되는 최대 시간 초과입니다. timeUnit 에 지정된 단위 |
maxTimeToOutputShellResponse | long : 명령이 응답을 출력하지 않는 최대 시간입니다. timeUnit 에 지정된 단위 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 의 단위 |
retryAttempts | int : 예외로 인해 실패한 경우 명령을 재시도하는 최대 횟수입니다. retryAttempts가 성공하지 않고 수행되면 retryAttempts 이 발생합니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
쉘 명령 실행
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
주어진 adb 쉘 명령을 실행하고 명령이 실패하면 여러 번 재시도합니다.
기본값을 사용하는 더 단순한 형태의executeShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
.매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
receiver | IShellOutputReceiver : 쉘 출력을 지시할 IShellOutputReceiver 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command)
adb 셸 명령을 실행하고 명령 상태 출력, stdout 및 stderr로 적절히 채워진 CommandResult
로 결과를 반환하는 도우미 메서드입니다.
매개변수 | |
---|---|
command | String : 실행해야 하는 명령입니다. |
보고 | |
---|---|
CommandResult | CommandResult 의 결과입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
adb 셸 명령을 실행하고 명령 상태 출력 및 stderr로 적절하게 채워진 CommandResult
로 결과를 반환하는 도우미 메서드입니다. stdout은 지정된 스트림으로 지정됩니다.
매개변수 | |
---|---|
command | String : 실행해야 하는 명령입니다. |
pipeToOutput | OutputStream : 표준 출력이 리디렉션되는 ERROR(/OutputStream) 또는 null입니다. |
보고 | |
---|---|
CommandResult | CommandResult 의 결과입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
adb 셸 명령을 실행하고 명령 상태 출력, stdout 및 stderr로 적절하게 채워진 CommandResult
로 결과를 반환하는 도우미 메서드입니다.
매개변수 | |
---|---|
command | String : 실행해야 하는 명령입니다. |
pipeAsInput | File : 명령에 대한 입력으로 파이프될 ERROR(/File) 또는 null입니다. |
보고 | |
---|---|
CommandResult | CommandResult 의 결과입니다. |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
maxTimeoutForCommand | long : 명령이 완료되는 최대 시간 초과입니다. timeUnit 에 지정된 단위 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 의 단위 |
retryAttempts | int : 예외로 인해 실패한 경우 명령을 재시도하는 최대 횟수입니다. retryAttempts가 성공하지 않고 수행되면 retryAttempts 이 발생합니다. |
보고 | |
---|---|
CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
maxTimeoutForCommand | long : 명령이 완료되는 최대 시간 초과입니다. timeUnit 에 지정된 단위 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 의 단위 |
보고 | |
---|---|
CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
pipeAsInput | File : 명령에 대한 입력으로 파이프될 ERROR(/File) 또는 null입니다. |
pipeToOutput | OutputStream : 표준 출력이 리디렉션되는 ERROR(/OutputStream) 또는 null입니다. |
maxTimeoutForCommand | long : 명령이 완료되는 최대 시간 초과입니다. timeUnit 에 지정된 단위 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 의 단위 |
retryAttempts | int : 예외로 인해 실패한 경우 명령을 재시도하는 최대 횟수입니다. retryAttempts가 성공하지 않고 수행되면 retryAttempts 이 발생합니다. |
보고 | |
---|---|
CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
실행ShellV2명령
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
명령 동작을 제어하는 더 많은 매개변수와 함께 adb 셸 명령을 실행합니다.
매개변수 | |
---|---|
command | String : 실행할 adb 셸 명령 |
pipeAsInput | File : 명령에 대한 입력으로 파이프될 ERROR(/File) 또는 null입니다. |
pipeToOutput | OutputStream : 표준 출력이 리디렉션되는 ERROR(/OutputStream) 또는 null입니다. |
pipeToError | OutputStream : 표준 오류가 리디렉션되는 ERROR(/OutputStream) 또는 null입니다. |
maxTimeoutForCommand | long : 명령이 완료되는 최대 시간 초과입니다. timeUnit 에 지정된 단위 |
timeUnit | TimeUnit : maxTimeToOutputShellResponse 의 단위 |
retryAttempts | int : 예외로 인해 실패한 경우 명령을 재시도하는 최대 횟수입니다. retryAttempts가 성공하지 않고 수행되면 retryAttempts 이 발생합니다. |
보고 | |
---|---|
CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
fastbootWipe파티션
public abstract CommandResult fastbootWipePartition (String partition)
장치의 파티션을 지우는 도우미 메서드입니다.
getUseFastbootErase()
가 true
fastboot 지우기가 파티션을 지우는 데 사용됩니다. 그런 다음 장치는 다음에 장치가 부팅될 때 파일 시스템을 생성해야 합니다. 그렇지 않으면 장치에 새 파일 시스템을 생성하는 fastboot 형식이 사용됩니다. 장치가 이미 fastboot 모드에 있을 때 사용될 것으로 예상됩니다.매개변수 | |
---|---|
partition | String : 지울 파티션 |
보고 | |
---|---|
CommandResult | 명령의 출력을 포함하는 CommandResult |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
getApiLevel
public abstract int getApiLevel ()
장치 API 레벨을 가져옵니다. 기본값은 UNKNOWN_API_LEVEL
입니다.
보고 | |
---|---|
int | 기기의 API 레벨을 나타내는 정수 |
던지다 | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
이 장치의 기저대역(무선) 버전을 가져오는 편리한 방법입니다. 라디오 버전을 가져오는 것은 장치에 따라 다르므로 모든 장치에 대해 올바른 정보를 반환하지 않을 수 있습니다. 이 메서드는 gsm.version.baseband 속성을 사용하여 올바른 버전 정보를 반환합니다. 이것은 일부 CDMA 장치에 대해 정확하지 않으며 여기에 반환된 버전은 fastboot에서 보고된 버전과 일치하지 않을 수 있으며 CDMA 라디오에 대한 버전을 반환하지 않을 수 있습니다. TL;DR 이 방법은 gsm.version.baseband 속성이 fastboot getvar version-baseband
에서 반환된 버전과 동일한 경우에만 정확한 버전을 보고합니다.
보고 | |
---|---|
String | String 베이스밴드 버전 또는 확인할 수 없는 경우 null (장치에 라디오가 없거나 버전 문자열을 읽을 수 없음) |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
배터리 가져오기
public abstract Integer getBattery ()
장치의 현재 배터리 수준을 반환하거나 배터리 수준을 사용할 수 없는 경우 Null을 반환합니다.
보고 | |
---|---|
Integer |
getBoolean속성
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
주어진 속성의 부울 값을 반환합니다.
매개변수 | |
---|---|
name | String : 속성 이름 |
defaultValue | boolean : 속성이 비어 있거나 존재하지 않는 경우 반환할 기본값입니다. |
보고 | |
---|---|
boolean | 속성 값이 "1" , "y" , "yes" , "on" 또는 "true" true 속성 값이 "0" , "n" , "no" , "off" 이면 false , "false" 또는 그렇지 않으면 defaultValue 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
도우미 메서드는 부팅 시간 및 부팅 이유가 포함된 부팅 히스토리 맵을 수집합니다.
보고 | |
---|---|
부팅 시간(Epoch 이후 초 단위 UTC 시간) 및 부팅 이유 맵 |
던지다 | |
---|---|
DeviceNotAvailableException |
getBootHistory 이후
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Helper 메서드는 장치의 epoch 이후 지정된 시간 이후의 부팅 시간 및 부팅 이유와 지정된 시간 단위가 포함된 부팅 히스토리 맵을 수집합니다. 밀리초 단위의 현재 장치 utcEpochTime은 getDeviceDate()
메서드로 얻을 수 있습니다.
매개변수 | |
---|---|
utcEpochTime | long : Epoch 이후의 장치 시간입니다. |
timeUnit | TimeUnit : 시간 단위 TimeUnit . |
보고 | |
---|---|
부팅 시간(Epoch 이후 초 단위 UTC 시간) 및 부팅 이유 맵 |
던지다 | |
---|---|
DeviceNotAvailableException |
getBootloader 버전
public abstract String getBootloaderVersion ()
이 장치의 부트로더 버전을 가져오는 편리한 방법입니다.
기기의 현재 상태에서 부트로더 버전 검색을 시도합니다. (즉, 장치가 fastboot 모드에 있으면 fastboot에서 버전 검색을 시도합니다)보고 | |
---|---|
String | String 부트로더 버전 또는 찾을 수 없는 경우 null |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
getBugreport
public abstract InputStreamSource getBugreport ()
장치에서 버그 보고서를 검색합니다.
이 구현은 sdcard가 없는(또는 sdcard가 아직 마운트되지 않은) 장치에서 계속 작동하도록 보장됩니다.보고 | |
---|---|
InputStreamSource | 요청 시 버그 보고서 콘텐츠를 생성하는 InputStreamSource 입니다. 실패할 경우 InputStreamSource 는 빈 ERROR(/InputStream) 을 생성합니다. |
getBugreportz
public abstract InputStreamSource getBugreportz ()
장치에서 bugreportz를 검색합니다. Zip 형식의 bugreport에는 디버깅에 유용한 주요 버그 보고서 및 기타 로그 파일이 포함되어 있습니다.
'adb 버전' > 1.0.36에서만 지원됨보고 | |
---|---|
InputStreamSource | bugreportz를 포함하는 zip 파일의 InputStreamSource 는 실패할 경우 null을 반환합니다. |
getBuildAlias
public abstract String getBuildAlias ()
장치가 현재 실행 중인 빌드의 별칭을 검색합니다.
빌드 별칭은 일반적으로 빌드 ID(일반적으로 Nexus 빌드의 경우 숫자)보다 읽기 쉬운 문자열입니다. 예를 들어 최종 Android 4.2 릴리스에는 JDQ39 빌드 별칭과 빌드 ID 573038이 있습니다.
보고 | |
---|---|
String | 검색할 수 없는 경우 빌드 별칭 또는 빌드 ID로 대체 |
던지다 | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
디바이스의 빌드 플레이버를 검색합니다.
보고 | |
---|---|
String | 빌드 플레이버 또는 검색할 수 없는 경우 null |
던지다 | |
---|---|
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
장치가 현재 실행 중인 빌드를 검색합니다.
보고 | |
---|---|
String | 검색할 수 없는 경우 빌드 ID 또는 IBuildInfo#UNKNOWN_BUILD_ID |
던지다 | |
---|---|
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
장치 이미지에 서명하는 데 사용된 키 유형을 반환합니다.
일반적으로 Android 기기는 테스트 키(AOSP에서와 같이) 또는 릴리스 키(개별 기기 제조업체에서 제어)로 서명될 수 있습니다.
보고 | |
---|---|
String | 서명 키가 있으면 발견되고 그렇지 않으면 null입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
장치가 할당된 경우 캐시된 DeviceDescriptor
를 반환하고, 그렇지 않으면 현재 DeviceDescriptor
를 반환합니다.
보고 | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
장치가 할당된 경우 캐시된 DeviceDescriptor
를 반환하고, 그렇지 않으면 현재 DeviceDescriptor
를 반환합니다.
매개변수 | |
---|---|
shortDescriptor | boolean : 디스크립터를 최소한의 정보로 제한할지 여부 |
보고 | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
권한 때문에 때때로 작동하지 않는 IFileEntry
를 사용하는 대신.
매개변수 | |
---|---|
deviceFilePath | String : 검색을 수행할 장치의 경로입니다. |
보고 | |
---|---|
String[] | 장치의 경로에 있는 모든 파일을 포함하는 문자열 배열입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
getDeviceDate
public abstract long getDeviceDate ()
Epoch 이후의 장치 날짜를 밀리초 단위로 반환합니다.
보고 | |
---|---|
long | Epoch 형식의 장치 날짜입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
실제 장치 개체를 전달하지 않고 장치 정보를 얻기 위해 장치 정보에서 DeviceDescriptor
를 반환합니다.
보고 | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
실제 장치 개체를 전달하지 않고 장치 정보를 얻기 위해 장치 정보에서 DeviceDescriptor
를 반환합니다.
매개변수 | |
---|---|
shortDescriptor | boolean : 디스크립터를 최소한의 정보로 제한할지 여부 |
보고 | |
---|---|
DeviceDescriptor |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
장치와 주어진 ERROR(/Date)
사이의 시간 차이를 가져오는 도우미입니다. 내부적으로 Epoch 시간을 사용합니다.
매개변수 | |
---|---|
date | Date |
보고 | |
---|---|
long | 밀리초의 차이 |
던지다 | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
에뮬레이터 stdout 및 stderr의 스트림 가져오기
보고 | |
---|---|
InputStreamSource | 에뮬레이터 출력 |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
장치 외부 저장소의 여유 공간을 확인하는 도우미 메서드입니다.
보고 | |
---|---|
long | 여유 공간의 양(KB) |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
getFastboot 제품 유형
public abstract String getFastbootProductType ()
빠른 부팅 모드에 있을 때 이 장치의 제품 유형을 가져오는 편리한 방법입니다.
이 방법은 장치가 fastboot에 있어야 하는 경우에만 사용해야 합니다. ITestDevice는 장치가 잘못된 상태에 있거나 응답하지 않는 경우 장치를 fastboot로 복구하는 것을 알고 있기 때문에 이 경우 일반getProductType()
메서드보다 조금 더 안전한 변형입니다.보고 | |
---|---|
String | String 제품 유형 이름 또는 결정할 수 없는 경우 null |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
빠른 부팅 모드에 있을 때 이 장치의 제품 유형을 가져오는 편리한 방법입니다.
이 방법은 장치가 fastboot에 있어야 하는 경우에만 사용해야 합니다. ITestDevice는 장치가 잘못된 상태에 있거나 응답하지 않는 경우 장치를 fastboot로 복구하는 것을 알고 있기 때문에 이 경우 일반getProductType()
메서드보다 조금 더 안전한 변형입니다.보고 | |
---|---|
String | String 제품 유형 이름 또는 결정할 수 없는 경우 null |
던지다 | |
---|---|
DeviceNotAvailableException | 장치와의 연결이 끊어져 복구할 수 없는 경우. |
getFastboot일련번호
public abstract String getFastbootSerialNumber ()
빠른 부팅 모드 일련 번호를 반환합니다.
보고 | |
---|---|
String |
getFastboot변수
public abstract String getFastbootVariable (String variableName)
장치에서 지정된 fastboot 변수 값을 검색합니다.
매개변수 | |
---|---|
variableName | String : 변수 이름 |
보고 | |
---|---|
String | 속성 값 또는 존재하지 않는 경우 null |
던지다 | |
---|---|
| 지원되지 않는 작업 예외 |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
장치의 원격 파일에 대한 참조를 검색합니다.
매개변수 | |
---|---|
path | String : 검색할 파일 경로입니다. 절대 경로 또는 '/'에 대한 상대 경로일 수 있습니다. (즉, "/system" 및 "system" 구문이 모두 지원됨) |
보고 | |
---|---|
IFileEntry | IFileEntry 또는 지정된 path 의 파일을 찾을 수 없는 경우 null |
던지다 | |
---|---|
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
연결된 ddmlib IDevice
에 대한 참조를 반환합니다.
IDevice
를 할당할 수 있습니다. 따라서 호출자는 IDevice
에 대한 참조를 유지해서는 안 됩니다. 해당 참조가 오래될 수 있기 때문입니다.보고 | |
---|---|
IDevice | IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
장치에서 주어진 속성의 정수 값을 반환합니다.
매개변수 | |
---|---|
name | String : 속성 이름 |
defaultValue | long : 속성이 비어 있거나 존재하지 않는 경우 반환할 기본값입니다. |
보고 | |
---|---|
long | 속성 값 또는 속성이 비어 있거나 존재하지 않거나 정수 값이 없는 경우 defaultValue 입니다. |
던지다 | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
System.currentTimeMillis()
에서 반환된 EPOCH 이후 Tradefed API가 재부팅을 트리거한 마지막 시간을 반환합니다.
보고 | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
기기에서 처음 실행된 API 레벨을 가져옵니다. 기본값은 UNKNOWN_API_LEVEL
입니다.
보고 | |
---|---|
int | 장치의 첫 번째 실행된 API 레벨을 나타내는 정수 |
던지다 | |
---|---|
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
logcat 데이터의 스냅샷 스트림을 가져옵니다.
두 가지 모드에서 작동합니다.
TestDeviceOptions.getMaxLogcatDataSize()
바이트를 반환합니다.보고 | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
캡처된 logcat 데이터의 마지막 maxBytes
의 스냅샷 스트림을 가져옵니다.
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 abstract 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 abstract 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 |
getMountPoint
public abstract 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 |
See also:
getMountPointInfo
public abstract 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 |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
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 |
getPartitionFreeSpace
public abstract 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 | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract 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 abstract 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 abstract 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 | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract 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 | if connection with device is lost and cannot be recovered. |
getProperty
public abstract 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 abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
보고 | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
보고 | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
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 |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
보고 | |
---|---|
long |
getUseFastbootErase
public abstract 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. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
보고 | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
보고 | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
보고 | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
던지다 | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
보고 | |
---|---|
boolean | true if the device is encrypted. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
매개변수 | |
---|---|
deviceFilePath | String |
보고 | |
---|---|
boolean |
던지다 | |
---|---|
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
보고 | |
---|---|
boolean | true if the device supports encryption. |
던지다 | |
---|---|
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
매개변수 | |
---|---|
fullPath | String |
보고 | |
---|---|
boolean |
던지다 | |
---|---|
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
보고 | |
---|---|
boolean |
던지다 | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
보고 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
보고 | |
---|---|
boolean |
logAnrs
public abstract 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 abstract 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 abstract 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 abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
던지다 | |
---|---|
DeviceNotAvailableException |
postBootSetup
public abstract 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 | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
매개변수 | |
---|---|
invocationException | 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 |
던지다 | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
매개변수 | |
---|---|
localDir | 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 | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
매개변수 | |
---|---|
localDir | 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 | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, 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 |
deviceFilePath | 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 | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
매개변수 | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
보고 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
매개변수 | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
보고 | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract 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 | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recovery던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract 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 | if device is not available after reboot |
See also:
rebootUserspace
public abstract 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 | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
던지다 | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
던지다 | |
---|---|
DeviceNotAvailableException |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract 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 |
runInstrumentationTestsAsUser
public abstract 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 |
setDate
public abstract 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 |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
매개변수 | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract 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 abstract 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 abstract 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. |
setUseFastbootErase
public abstract 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. |
See also:
startLogcat
public abstract 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.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract 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.switchToAdbTcp
public abstract 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 abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
보고 | |
---|---|
boolean | true if switch was successful, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException |
syncFiles
public abstract 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 | if connection with device is lost and cannot be recovered. |
takeBugreport
public abstract Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue.
Bugreport#close()
.보고 | |
---|---|
Bugreport |
unlockDevice
public abstract 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 | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract 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 | if device is still unresponsive after waitTime expires. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract 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 abstract 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 abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract 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. |
INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Provides an reliable and slightly higher level API to a ddmlib IDevice
.
요약
Constants | |
---|---|
int | UNKNOWN_API_LEVEL Default value when API Level cannot be detected |
공개 메서드 | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Check whether or not a feature is currently supported given a minimally supported level. |
abstract void | clearLogcat () Deletes any accumulated logcat data. |
abstract void | deleteFile (String deviceFilePath) Helper method to delete a file or directory on the device. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) Helper method to check if device soft-restarted by comparing current system_server with previous system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Helper method to check whether device soft-restarted since the UTC time since epoch from device and its |
abstract boolean | disableAdbRoot () Turns off adb root. |
abstract boolean | doesFileExist (String deviceFilePath) Helper method to determine if file on device exists. |
abstract boolean | enableAdbRoot () Turns on adb root. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) Helper method which executes a adb command as a system command with a specified timeout. |
abstract String | executeAdbCommand (String... commandArgs) Helper method which executes a adb command as a system command. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) Helper method which executes a fastboot command as a system command with a default timeout of 2 minutes. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) Helper method which executes a fastboot command as a system command. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Helper method which executes a long running fastboot command as a system command with system environment variables. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) Helper method which executes a long running fastboot command as a system command. |
abstract String | executeShellCommand (String command) Helper method which executes a adb shell command and returns output as a |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract 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. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) Executes the given adb shell command, retrying multiple times if command fails. |
abstract CommandResult | executeShellV2Command (String command) Helper method which executes a adb shell command and returns the results as a |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Helper method which executes an adb shell command and returns the results as a |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Helper method which executes an adb shell command and returns the results as a |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Executes a adb shell command, with more parameters to control command behavior. |
abstract CommandResult | fastbootWipePartition (String partition) Helper method which wipes a partition for the device. |
abstract int | getApiLevel () Get the device API Level. |
abstract String | getBasebandVersion () Convenience method to get baseband (radio) version of this device. |
abstract Integer | getBattery () Returns the current battery level of a device or Null if battery level unavailable. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Returns boolean value of the given property. |
abstract | getBootHistory () Helper method collects the boot history map with boot time and boot reason. |
abstract | getBootHistorySince (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. |
abstract String | getBootloaderVersion () Convenience method to get the bootloader version of this device. |
abstract InputStreamSource | getBugreport () Retrieves a bugreport from the device. |
abstract InputStreamSource | getBugreportz () Retrieves a bugreportz from the device. |
abstract String | getBuildAlias () Retrieve the alias of the build that the device is currently running. |
abstract String | getBuildFlavor () Retrieve the build flavor for the device. |
abstract String | getBuildId () Retrieve the build the device is currently running. |
abstract 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) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Returns a cached |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Returns a cached |
abstract String[] | getChildren (String deviceFilePath) Alternative to using |
abstract String | getDeviceClass () Get the device class. |
abstract long | getDeviceDate () Return the date of the device in millisecond since epoch. |
abstract DeviceDescriptor | getDeviceDescriptor () Return a |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Return a |
abstract TestDeviceState | getDeviceState () Get the device's state. |
abstract long | getDeviceTimeOffset (Date date) Helper to get the time difference between the device and a given |
abstract InputStreamSource | getEmulatorOutput () Get the stream of emulator stdout and stderr |
abstract long | getExternalStoreFreeSpace () Helper method to determine amount of free space on device external storage. |
abstract String | getFastbootProductType () Convenience method to get the product type of this device when its in fastboot mode. |
abstract String | getFastbootProductVariant () Convenience method to get the product type of this device when its in fastboot mode. |
abstract String | getFastbootSerialNumber () Returns the fastboot mode serial number. |
abstract String | getFastbootVariable (String variableName) Retrieve the given fastboot variable value from the device. |
abstract IFileEntry | getFileEntry (String path) Retrieve a reference to a remote file on device. |
abstract IDevice | getIDevice () Returns a reference to the associated ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Returns integer value of the given property from the device. |
abstract long | getLastExpectedRebootTimeMillis () Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by |
abstract int | getLaunchApiLevel () Get the device's first launched API Level. |
abstract InputStreamSource | getLogcat () Grabs a snapshot stream of the logcat data. |
abstract InputStreamSource | getLogcat (int maxBytes) Grabs a snapshot stream of the last |
abstract InputStreamSource | getLogcatDump () Get a dump of the current logcat for device. |
abstract InputStreamSource | getLogcatSince (long date) Grabs a snapshot stream of captured logcat data starting the date provided. |
abstract String | getMountPoint (String mountName) Returns a mount point. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Returns a |
abstract | getMountPointInfo () Returns a parsed version of the information in /proc/mounts on the device |
abstract long | getPartitionFreeSpace (String partition) Helper method to determine amount of free space on device partition. |
abstract ProcessInfo | getProcessByName (String processName) Helper method runs the "pidof" and "stat" command and returns |
abstract String | getProcessPid (String process) Returns the pid of the service or null if something went wrong. |
abstract String | getProductType () Convenience method to get the product type of this device. |
abstract String | getProductVariant () Convenience method to get the product variant of this device. |
abstract String | getProperty (String name) Retrieve the given property value from the device. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () Get the current recovery mode used for the device. |
abstract String | getSerialNumber () Convenience method to get serial number of this device. |
abstract | getTombstones () Fetch and return the list of tombstones from the devices. |
abstract long | getTotalMemory () Returns total physical memory size in bytes or -1 in case of internal error |
abstract boolean | getUseFastbootErase () Get whether to use fastboot erase or fastboot format to wipe a partition on the device. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () Check whether platform on device supports app enumeration |
abstract boolean | isDeviceEncrypted () Returns if the device is encrypted. |
abstract boolean | isDirectory (String deviceFilePath) Return True if the path on the device is a directory, false otherwise. |
abstract boolean | isEncryptionSupported () Returns if encryption is supported on the device. |
abstract boolean | isExecutable (String fullPath) Returns True if the file path on the device is an executable file, false otherwise. |
abstract boolean | isHeadless () Return true if the device is headless (no screen), false otherwise. |
abstract boolean | isRuntimePermissionSupported () Check whether platform on device supports runtime permission granting |
abstract boolean | isStateBootloaderOrFastbootd () Returns true if device is in |
abstract boolean | logAnrs ( ITestLogger logger) Collects and log ANRs from the device. |
abstract boolean | logBugreport (String dataName, ITestLogger listener) Helper method to take a bugreport and log it to the reporters. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Log a message in the logcat of the device. |
abstract void | nonBlockingReboot () Issues a command to reboot device and returns on command complete and when device is no longer visible to adb. |
abstract void | postBootSetup () Perform instructions to configure device for testing that after every boot. |
default void | postInvocationTearDown () This method is deprecated. Use |
abstract void | postInvocationTearDown (Throwable invocationException) Extra steps for device specific required clean up that will be executed after the invocation is done. |
default 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. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Recursively pull directory contents from device. |
abstract File | pullFile (String remoteFilePath, int userId) Retrieves a file off device, stores it in a local temporary |
abstract File | pullFile (String remoteFilePath) Retrieves a file off device, stores it in a local temporary |
abstract boolean | pullFile (String remoteFilePath, File localFile) Retrieves a file off device. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Retrieves a file off device. |
abstract String | pullFileContents (String remoteFilePath) Retrieves a file off device, and returns the contents. |
abstract File | pullFileFromExternal (String remoteFilePath) A convenience method to retrieve a file from the device's external storage, stores it in a local temporary |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) Recursively push directory contents to device while excluding some directories that are filtered. |
abstract boolean | pushDir (File localDir, String deviceFilePath) Recursively push directory contents to device. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) Variant of |
abstract boolean | pushFile (File localFile, String deviceFilePath) Push a file to device. |
abstract boolean | pushString (String contents, String deviceFilePath) Push file created from a string to device |
abstract void | reboot () Reboots the device into adb mode. |
abstract void | reboot (String reason) Reboots the device into adb mode with given |
abstract void | rebootIntoBootloader () Reboots the device into bootloader mode. |
abstract void | rebootIntoFastbootd () Reboots the device into fastbootd mode. |
abstract void | rebootIntoRecovery () Reboots the device into adb recovery mode. |
abstract 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 |
abstract void | rebootIntoSideload () Reboots the device into adb sideload mode (note that this is a special mode under recovery) Blocks until device enters sideload mode |
abstract void | rebootUntilOnline () An alternate to |
abstract void | rebootUntilOnline (String reason) An alternate to |
abstract void | rebootUserspace () Reboots only userspace part of device. |
abstract void | rebootUserspaceUntilOnline () An alternate to |
abstract void | remountSystemWritable () Make the system partition on the device writable. |
abstract void | remountVendorWritable () Make the vendor partition on the device writable. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) Convenience method for performing |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) Runs instrumentation tests, and provides device recovery. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Same as |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) Same as |
abstract void | setDate (Date date) Sets the date on device Note: setting date on device requires root |
abstract void | setOptions ( TestDeviceOptions options) Set the |
abstract boolean | setProperty (String propKey, String propValue) Sets the given property value on the device. |
abstract void | setRecovery ( IDeviceRecovery recovery) Set the |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) Set the current recovery mode to use for the device. |
abstract void | setUseFastbootErase (boolean useFastbootErase) Set whether to use fastboot erase or fastboot format to wipe a partition on the device. |
abstract void | startLogcat () Start capturing logcat output from device in the background. |
abstract void | stopEmulatorOutput () Close and delete the emulator output. |
abstract void | stopLogcat () Stop capturing logcat output from device, and discard currently saved logcat data. |
abstract String | switchToAdbTcp () Switch device to adb-over-tcp mode. |
abstract boolean | switchToAdbUsb () Switch device to adb over usb mode. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) Incrementally syncs the contents of a local file directory to device. |
abstract Bugreport | takeBugreport () Take a bugreport and returns it inside a |
abstract boolean | unlockDevice () Unlocks the device if the device is in an encrypted state. |
abstract boolean | waitForBootComplete (long timeOut) Blocks until the device's boot complete flag is set. |
abstract boolean | waitForDeviceAvailable () Waits for the device to be responsive and available for testing. |
abstract boolean | waitForDeviceAvailable (long waitTime) Waits for the device to be responsive and available for testing. |
abstract void | waitForDeviceBootloader () Blocks until device is visible via fastboot. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Blocks for the device to be in the 'adb recovery' state (note this is distinct from |
abstract boolean | waitForDeviceInSideload (long waitTime) Blocks for the device to be in the 'adb sideload' state |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Blocks for the device to be not available ie missing from adb |
abstract void | waitForDeviceOnline () Blocks until device is visible via adb. |
abstract void | waitForDeviceOnline (long waitTime) Blocks until device is visible via adb. |
abstract boolean | waitForDeviceShell (long waitTime) Waits for device to be responsive to a basic adb shell command. |
Constants
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
Default value when API Level cannot be detected
Constant Value: -1 (0xffffffff)
공개 메서드
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Check whether or not a feature is currently supported given a minimally supported level. This method takes into account unreleased features yet, before API level is raised.
매개변수 | |
---|---|
strictMinLevel | int : The strict min possible level that supports the feature. |
보고 | |
---|---|
boolean | True if the level is supported. False otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
Deletes any accumulated logcat data.
This is useful for cases when you want to ensureITestDevice#getLogcat()
only returns log data produced after a certain point (such as after flashing a new device build, etc). deleteFile
public abstract void deleteFile (String deviceFilePath)
Helper method to delete a file or directory on the device.
매개변수 | |
---|---|
deviceFilePath | String : The absolute path of the file on the device. |
던지다 | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Helper method to check if device soft-restarted by comparing current system_server with previous system_server ProcessInfo
. Use getProcessByName(String)
to get ProcessInfo
.
매개변수 | |
---|---|
prevSystemServerProcess | ProcessInfo : the previous system_server process ProcessInfo . |
보고 | |
---|---|
boolean | true if device soft-restarted |
던지다 | |
---|---|
RuntimeException | if device has abnormal boot reason |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Helper method to check whether device soft-restarted since the UTC time since epoch from device and its ERROR(/TimeUnit)
. Soft-Restart refers to system_server restarted outside of a device hard reboot (for example: requested reboot). The current device utcEpochTime in Milliseccond can be obtained by method getDeviceDate()
.
매개변수 | |
---|---|
utcEpochTime | long : the device time in second since epoch. |
timeUnit | TimeUnit : the time unit TimeUnit for the given utcEpochTime. |
보고 | |
---|---|
boolean | true if device soft-restarted |
던지다 | |
---|---|
RuntimeException | if device has abnormal boot reason |
DeviceNotAvailableException |
disableAdbRoot
public abstract boolean disableAdbRoot ()
Turns off adb root.
Disabling adb root may cause device to disconnect from adb. This method will block until device is available.보고 | |
---|---|
boolean | true if successful. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Helper method to determine if file on device exists.
매개변수 | |
---|---|
deviceFilePath | String : the absolute path of file on device to check |
보고 | |
---|---|
boolean | true if file exists, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
Turns on adb root. If the "enable-root" setting is "false", will log a message and return without enabling root.
Enabling adb root may cause device to disconnect from adb. This method will block until device is available.보고 | |
---|---|
boolean | true if successful. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Helper method which executes a adb command as a system command with a specified timeout.
executeShellCommand(String)
should be used instead wherever possible, as that method provides better failure detection and performance.
매개변수 | |
---|---|
timeout | long : the time in milliseconds before the device is considered unresponsive, 0L for no timeout |
commandArgs | String : the adb command and arguments to run |
보고 | |
---|---|
String | the stdout from command. null if command failed to execute. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Helper method which executes a adb command as a system command.
executeShellCommand(String)
should be used instead wherever possible, as that method provides better failure detection and performance.매개변수 | |
---|---|
commandArgs | String : the adb command and arguments to run |
보고 | |
---|---|
String | the stdout from command. null if command failed to execute. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (String... commandArgs)
Helper method which executes a fastboot command as a system command with a default timeout of 2 minutes.
Expected to be used when device is already in fastboot mode.매개변수 | |
---|---|
commandArgs | String : the fastboot command and arguments to run |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
Helper method which executes a fastboot command as a system command.
Expected to be used when device is already in fastboot mode.매개변수 | |
---|---|
timeout | long : the time in milliseconds before the command expire |
commandArgs | String : the fastboot command and arguments to run |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
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 | |
commandArgs | String : the fastboot command and arguments to run |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Helper method which executes a long running fastboot command as a system command.
Identical toexecuteFastbootCommand(String)
except uses a longer timeout.매개변수 | |
---|---|
commandArgs | String : the fastboot command and arguments to run |
보고 | |
---|---|
CommandResult | the CommandResult containing output of command |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract 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 | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract 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 | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract 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 | if connection with device is lost and cannot be recovered. |
executeShellCommand
public abstract 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 | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command)
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.
매개변수 | |
---|---|
command | String : The command that should be run. |
보고 | |
---|---|
CommandResult | The result in CommandResult . |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, 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.
매개변수 | |
---|---|
command | 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 | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, 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.
매개변수 | |
---|---|
command | 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 | if connection with device is lost and cannot be recovered. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
command | 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 | if connection with device is lost and cannot be recovered. |
See also:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
command | 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 | if connection with device is lost and cannot be recovered. |
See also:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
command | 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 | if connection with device is lost and cannot be recovered. |
See also:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Executes a adb shell command, with more parameters to control command behavior.
매개변수 | |
---|---|
command | 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 | if connection with device is lost and cannot be recovered. |
See also:
fastbootWipePartition
public abstract 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 | if connection with device is lost and cannot be recovered. |
getApiLevel
public abstract int getApiLevel ()
Get the device API Level. Defaults to UNKNOWN_API_LEVEL
.
보고 | |
---|---|
int | an integer indicating the API Level of device |
던지다 | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public abstract 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 | if the connection with the device is lost and cannot be recovered. |
getBattery
public abstract Integer getBattery ()
Returns the current battery level of a device or Null if battery level unavailable.
보고 | |
---|---|
Integer |
getBooleanProperty
public abstract 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
public abstractgetBootHistory ()
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
public abstractgetBootHistorySince (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 abstract 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 | if connection with device is lost and cannot be recovered. |
getBugreport
public abstract 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 abstract 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 abstract 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 abstract String getBuildFlavor ()
Retrieve the build flavor for the device.
보고 | |
---|---|
String | the build flavor or null if it could not be retrieved |
던지다 | |
---|---|
DeviceNotAvailableException |
getBuildId
public abstract 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 abstract 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 abstract DeviceDescriptor getCachedDeviceDescriptor ()
Returns a cached DeviceDescriptor
if the device is allocated, otherwise returns the current DeviceDescriptor
.
보고 | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract 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 abstract String[] getChildren (String deviceFilePath)
Alternative to using IFileEntry
that sometimes won't work because of permissions.
매개변수 | |
---|---|
deviceFilePath | 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 |
getDeviceClass
public abstract String getDeviceClass ()
Get the device class.
보고 | |
---|---|
String | the String device class. |
getDeviceDate
public abstract long getDeviceDate ()
Return the date of the device in millisecond since epoch.
보고 | |
---|---|
long | the date of the device in epoch format. |
던지다 | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Return a DeviceDescriptor
from the device information to get info on it without passing the actual device object.
보고 | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract 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 |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Get the device's state.
보고 | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract 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 abstract InputStreamSource getEmulatorOutput ()
Get the stream of emulator stdout and stderr
보고 | |
---|---|
InputStreamSource | emulator output |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Helper method to determine amount of free space on device external storage.
보고 | |
---|---|
long | the amount of free space in KB |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getFastbootProductType
public abstract 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 | if connection with device is lost and cannot be recovered. |
getFastbootProductVariant
public abstract 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 | if connection with device is lost and cannot be recovered. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Returns the fastboot mode serial number.
보고 | |
---|---|
String |
getFastbootVariable
public abstract 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 |
던지다 | |
---|---|
| UnsupportedOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract 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 |
getIDevice
public abstract 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 |
getIntProperty
public abstract 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 |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis()
.
보고 | |
---|---|
long |
getLaunchApiLevel
public abstract 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 abstract 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 abstract 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 abstract 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 abstract 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 |
getMountPoint
public abstract 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 |
See also:
getMountPointInfo
public abstract 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 |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
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 |
getPartitionFreeSpace
public abstract 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 | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract 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 abstract 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 abstract 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 | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract 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 | if connection with device is lost and cannot be recovered. |
getProperty
public abstract 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 abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
보고 | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
보고 | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
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 |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
보고 | |
---|---|
long |
getUseFastbootErase
public abstract 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. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
보고 | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
보고 | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
보고 | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
던지다 | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
보고 | |
---|---|
boolean | true if the device is encrypted. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
매개변수 | |
---|---|
deviceFilePath | String |
보고 | |
---|---|
boolean |
던지다 | |
---|---|
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
보고 | |
---|---|
boolean | true if the device supports encryption. |
던지다 | |
---|---|
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
매개변수 | |
---|---|
fullPath | String |
보고 | |
---|---|
boolean |
던지다 | |
---|---|
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
보고 | |
---|---|
boolean |
던지다 | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
보고 | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
보고 | |
---|---|
boolean |
logAnrs
public abstract 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 abstract 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 abstract 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 abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
던지다 | |
---|---|
DeviceNotAvailableException |
postBootSetup
public abstract 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 | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
매개변수 | |
---|---|
invocationException | 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 |
던지다 | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFile
public abstract 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 | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
매개변수 | |
---|---|
localDir | 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 | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
매개변수 | |
---|---|
localDir | 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 | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, 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 |
deviceFilePath | 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 | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
매개변수 | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
보고 | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
매개변수 | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
보고 | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract 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 | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recovery던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootIntoSideload
public abstract 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 | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract 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 | if device is not available after reboot |
See also:
rebootUserspace
public abstract 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 | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
던지다 | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
던지다 | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
던지다 | |
---|---|
DeviceNotAvailableException |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract 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 | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract 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 |
runInstrumentationTestsAsUser
public abstract 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 |
setDate
public abstract 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 |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
매개변수 | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract 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 abstract 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 abstract 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. |
setUseFastbootErase
public abstract 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. |
See also:
startLogcat
public abstract 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.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract 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.switchToAdbTcp
public abstract 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 abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
보고 | |
---|---|
boolean | true if switch was successful, false otherwise. |
던지다 | |
---|---|
DeviceNotAvailableException |
syncFiles
public abstract 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 | if connection with device is lost and cannot be recovered. |
takeBugreport
public abstract Bugreport takeBugreport ()
Take a bugreport and returns it inside a Bugreport
object to handle it. Return null in case of issue.
Bugreport#close()
.보고 | |
---|---|
Bugreport |
unlockDevice
public abstract 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 | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract 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 | if device is still unresponsive after waitTime expires. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
던지다 | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract 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 abstract 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 abstract 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 abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract 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 | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract 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. |