INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Cung cấp API đáng tin cậy và cấp cao hơn một chút cho ddmlib IDevice
.
Bản tóm tắt
hằng số | |
---|---|
int | UNKNOWN_API_LEVEL Giá trị mặc định khi không thể phát hiện Cấp độ API |
Phương thức công khai | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Kiểm tra xem một tính năng hiện có được hỗ trợ hay không ở mức được hỗ trợ tối thiểu. |
abstract void | clearLogcat () Xóa mọi dữ liệu logcat tích lũy. |
abstract void | deleteFile (String deviceFilePath) Phương thức trợ giúp để xóa tệp hoặc thư mục trên thiết bị. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) Phương pháp trợ giúp để kiểm tra xem thiết bị có khởi động lại mềm hay không bằng cách so sánh system_server hiện tại với system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Phương pháp trợ giúp để kiểm tra xem thiết bị có khởi động lại mềm kể từ thời gian UTC kể từ Epoch từ thiết bị và |
abstract boolean | disableAdbRoot () Tắt adb root. |
abstract boolean | doesFileExist (String deviceFilePath) Phương pháp trợ giúp để xác định xem tệp trên thiết bị có tồn tại hay không. |
abstract boolean | enableAdbRoot () Bật adb root. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống với thời gian chờ được chỉ định. |
abstract String | executeAdbCommand (String... commandArgs) Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống. |
abstract String | executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs) Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống với thời gian chờ được chỉ định. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) Phương thức trợ giúp thực thi lệnh fastboot dưới dạng lệnh hệ thống. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) Phương thức trợ giúp thực thi lệnh fastboot dưới dạng lệnh hệ thống với thời gian chờ mặc định là 2 phút. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) Phương thức trợ giúp thực thi lệnh fastboot chạy dài dưới dạng lệnh hệ thống. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Phương thức trợ giúp thực thi lệnh fastboot chạy dài dưới dạng lệnh hệ thống với các biến môi trường hệ thống. |
abstract String | executeShellCommand (String command) Phương thức trợ giúp thực thi lệnh shell adb và trả về đầu ra dưới dạng |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) Thực thi lệnh adb shell đã cho, thử lại nhiều lần nếu lệnh không thành công. |
abstract CommandResult | executeShellV2Command (String command) Phương thức trợ giúp thực thi lệnh trình bao adb và trả về kết quả dưới dạng |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Phương thức trợ giúp thực thi lệnh trình bao adb và trả về kết quả dưới dạng |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Phương thức trợ giúp thực thi lệnh trình bao adb và trả về kết quả dưới dạng |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh. |
abstract CommandResult | fastbootWipePartition (String partition) Phương thức trợ giúp xóa phân vùng cho thiết bị. |
abstract int | getApiLevel () Nhận cấp độ API của thiết bị. |
abstract String | getBasebandVersion () Phương pháp thuận tiện để có được phiên bản băng tần cơ sở (radio) của thiết bị này. |
abstract Integer | getBattery () Trả về mức pin hiện tại của thiết bị hoặc Null nếu không có mức pin. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Trả về giá trị boolean của thuộc tính đã cho. |
abstract | getBootHistory () Phương thức trợ giúp thu thập bản đồ lịch sử khởi động với thời gian khởi động và lý do khởi động. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Phương thức của trình trợ giúp thu thập bản đồ lịch sử khởi động với thời gian khởi động và lý do khởi động kể từ thời điểm đã cho kể từ kỷ nguyên từ thiết bị và đơn vị thời gian được chỉ định. |
abstract String | getBootloaderVersion () Phương pháp thuận tiện để tải phiên bản bộ nạp khởi động của thiết bị này. |
abstract String | getBuildAlias () Truy xuất bí danh của bản dựng mà thiết bị hiện đang chạy. |
abstract String | getBuildFlavor () Truy xuất hương vị xây dựng cho thiết bị. |
abstract String | getBuildId () Truy xuất bản dựng mà thiết bị hiện đang chạy. |
abstract String | getBuildSigningKeys () Trả về loại khóa được sử dụng để ký hình ảnh thiết bị Thông thường, các thiết bị Android có thể được ký bằng khóa kiểm tra (như trong AOSP) hoặc khóa phát hành (do nhà sản xuất thiết bị riêng lẻ kiểm soát) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Trả về một |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Trả về một |
abstract String[] | getChildren (String deviceFilePath) Thay thế cho việc sử dụng |
abstract AbstractConnection | getConnection () Trả về kết nối được liên kết với thiết bị. |
abstract String | getDeviceClass () Nhận lớp thiết bị. |
abstract long | getDeviceDate () Trả về ngày của thiết bị tính bằng mili giây kể từ epoch. |
abstract DeviceDescriptor | getDeviceDescriptor () Trả về một |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Trả về một |
abstract TestDeviceState | getDeviceState () Nhận trạng thái của thiết bị. |
abstract long | getDeviceTimeOffset (Date date) Trình trợ giúp để nhận chênh lệch múi giờ giữa thiết bị và |
abstract InputStreamSource | getEmulatorOutput () Nhận luồng trình giả lập thiết bị xuất chuẩn và thiết bị xuất chuẩn |
abstract long | getExternalStoreFreeSpace () Phương pháp trợ giúp để xác định dung lượng trống trên bộ nhớ ngoài của thiết bị. |
abstract String | getFastbootProductType () Phương pháp thuận tiện để lấy loại sản phẩm của thiết bị này khi thiết bị ở chế độ fastboot. |
abstract String | getFastbootProductVariant () Phương pháp thuận tiện để lấy loại sản phẩm của thiết bị này khi thiết bị ở chế độ fastboot. |
abstract String | getFastbootSerialNumber () Trả về số sê-ri chế độ fastboot. |
abstract String | getFastbootVariable (String variableName) Truy xuất giá trị biến fastboot đã cho từ thiết bị. |
abstract IFileEntry | getFileEntry (String path) Truy xuất tham chiếu đến tệp từ xa trên thiết bị. |
abstract IDevice | getIDevice () Trả về một tham chiếu đến ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Trả về giá trị nguyên của thuộc tính đã cho từ thiết bị. |
abstract long | getLastExpectedRebootTimeMillis () Trả về lần cuối cùng API được trao đổi kích hoạt khởi động lại sau mili giây kể từ EPOCH khi được trả về bởi |
abstract int | getLaunchApiLevel () Nhận Cấp API khởi chạy đầu tiên của thiết bị. |
abstract InputStreamSource | getLogcat () Lấy một luồng ảnh chụp nhanh của dữ liệu logcat. |
abstract InputStreamSource | getLogcat (int maxBytes) Lấy một luồng ảnh chụp nhanh của |
abstract InputStreamSource | getLogcatDump () Nhận kết xuất logcat hiện tại cho thiết bị. |
abstract InputStreamSource | getLogcatSince (long date) Lấy một luồng ảnh chụp nhanh dữ liệu logcat đã chụp bắt đầu từ ngày được cung cấp. |
abstract String | getMountPoint (String mountName) Trả về một điểm gắn kết. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Trả về |
abstract | getMountPointInfo () Trả về phiên bản được phân tích cú pháp của thông tin trong /proc/mounts trên thiết bị |
abstract long | getPartitionFreeSpace (String partition) Phương pháp trợ giúp để xác định dung lượng trống trên phân vùng thiết bị. |
abstract ProcessInfo | getProcessByName (String processName) Phương thức của trình trợ giúp chạy lệnh "pidof" và "stat" và trả về đối tượng |
abstract String | getProcessPid (String process) Trả về pid của dịch vụ hoặc null nếu xảy ra sự cố. |
abstract String | getProductType () Phương pháp thuận tiện để có được loại sản phẩm của thiết bị này. |
abstract String | getProductVariant () Phương pháp thuận tiện để có được biến thể sản phẩm của thiết bị này. |
abstract String | getProperty (String name) Truy xuất giá trị thuộc tính đã cho từ thiết bị. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () Nhận chế độ khôi phục hiện tại được sử dụng cho thiết bị. |
abstract String | getSerialNumber () Phương pháp thuận tiện để lấy số sê-ri của thiết bị này. |
abstract | getTombstones () Tìm nạp và trả lại danh sách các bia mộ từ thiết bị. |
abstract long | getTotalMemory () Trả về tổng kích thước bộ nhớ vật lý theo byte hoặc -1 trong trường hợp có lỗi nội bộ |
abstract boolean | getUseFastbootErase () Nhận xem nên sử dụng xóa fastboot hay định dạng fastboot để xóa phân vùng trên thiết bị. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () Kiểm tra xem nền tảng trên thiết bị có hỗ trợ liệt kê ứng dụng hay không |
abstract boolean | isBypassLowTargetSdkBlockSupported () Kiểm tra xem nền tảng trên thiết bị có hỗ trợ bỏ qua khối sdk mục tiêu thấp khi cài đặt ứng dụng hay không |
abstract boolean | isDeviceEncrypted () Trả về nếu thiết bị được mã hóa. |
abstract boolean | isDirectory (String deviceFilePath) Trả về True nếu đường dẫn trên thiết bị là một thư mục, ngược lại là false. |
abstract boolean | isEncryptionSupported () Trả về nếu mã hóa được hỗ trợ trên thiết bị. |
abstract boolean | isExecutable (String fullPath) Trả về True nếu đường dẫn tệp trên thiết bị là tệp thực thi, nếu không thì trả về false. |
abstract boolean | isHeadless () Trả về true nếu thiết bị không đầu (không có màn hình), ngược lại trả về false. |
abstract boolean | isRuntimePermissionSupported () Kiểm tra xem nền tảng trên thiết bị có hỗ trợ cấp quyền trong thời gian chạy không |
abstract boolean | isStateBootloaderOrFastbootd () Trả về true nếu thiết bị đang ở |
abstract boolean | logAnrs ( ITestLogger logger) Thu thập và ghi nhật ký ANR từ thiết bị. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Đăng một tin nhắn trong logcat của thiết bị. |
abstract void | nonBlockingReboot () Đưa ra lệnh khởi động lại thiết bị và trả về khi hoàn thành lệnh và khi thiết bị không còn hiển thị với adb. |
abstract void | postBootSetup () Thực hiện hướng dẫn cấu hình thiết bị để kiểm tra sau mỗi lần khởi động. |
default void | postInvocationTearDown () Phương pháp này không được chấp nhận. Thay vào đó, hãy sử dụng |
abstract void | postInvocationTearDown (Throwable invocationException) Các bước bổ sung để dọn dẹp theo yêu cầu cụ thể của thiết bị sẽ được thực thi sau khi lệnh gọi hoàn tất. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) Các bước bổ sung cho thiết lập bắt buộc cụ thể của thiết bị sẽ được thực thi trên thiết bị trước quy trình gọi. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Kéo đệ quy nội dung thư mục từ thiết bị. |
abstract File | pullFile (String remoteFilePath, int userId) Truy xuất một tệp từ thiết bị, lưu trữ tệp đó trong |
abstract File | pullFile (String remoteFilePath) Truy xuất một tệp từ thiết bị, lưu trữ tệp đó trong |
abstract boolean | pullFile (String remoteFilePath, File localFile) Truy xuất tệp từ thiết bị. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Truy xuất tệp từ thiết bị. |
abstract String | pullFileContents (String remoteFilePath) Truy xuất tệp từ thiết bị và trả về nội dung. |
abstract File | pullFileFromExternal (String remoteFilePath) Một phương pháp thuận tiện để truy xuất một tệp từ bộ nhớ ngoài của thiết bị, lưu trữ tệp đó trong một |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) Đệ quy đẩy nội dung thư mục vào thiết bị trong khi loại trừ một số thư mục được lọc. |
abstract boolean | pushDir (File localDir, String deviceFilePath) Đệ quy đẩy nội dung thư mục vào thiết bị. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) Biến thể của |
abstract boolean | pushFile (File localFile, String deviceFilePath) Đẩy một tập tin vào thiết bị. |
abstract boolean | pushString (String contents, String deviceFilePath) Đẩy tệp được tạo từ một chuỗi vào thiết bị |
abstract void | reboot () Khởi động lại thiết bị vào chế độ adb. |
abstract void | reboot (String reason) Khởi động lại thiết bị vào chế độ adb với |
abstract void | rebootIntoBootloader () Khởi động lại thiết bị vào chế độ bootloader. |
abstract void | rebootIntoFastbootd () Khởi động lại thiết bị vào chế độ fastbootd. |
abstract void | rebootIntoRecovery () Khởi động lại thiết bị vào chế độ khôi phục adb. |
abstract void | rebootIntoSideload (boolean autoReboot) Khởi động lại thiết bị vào chế độ adb sideload (lưu ý rằng đây là chế độ đặc biệt đang được khôi phục) Chặn cho đến khi thiết bị vào chế độ sideload |
abstract void | rebootIntoSideload () Khởi động lại thiết bị vào chế độ adb sideload (lưu ý rằng đây là chế độ đặc biệt đang được khôi phục) Chặn cho đến khi thiết bị vào chế độ sideload |
abstract void | rebootUntilOnline () Một thay thế để |
abstract void | rebootUntilOnline (String reason) Một thay thế để |
abstract void | rebootUserspace () Chỉ khởi động lại phần không gian người dùng của thiết bị. |
abstract void | rebootUserspaceUntilOnline () Một giải pháp thay thế cho |
abstract void | remountSystemWritable () Làm cho phân vùng hệ thống trên thiết bị có thể ghi được. |
abstract void | remountVendorWritable () Làm cho phân vùng nhà cung cấp trên thiết bị có thể ghi được. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) Phương pháp thuận tiện để thực hiện |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) Chạy thử nghiệm thiết bị và cung cấp khả năng khôi phục thiết bị. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) Tương tự như |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Tương tự như |
abstract void | setDate (Date date) Đặt ngày trên thiết bị Lưu ý: cài đặt ngày trên thiết bị yêu cầu root |
abstract void | setOptions ( TestDeviceOptions options) Đặt |
abstract boolean | setProperty (String propKey, String propValue) Đặt giá trị thuộc tính đã cho trên thiết bị. |
abstract void | setRecovery ( IDeviceRecovery recovery) Đặt |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) Đặt chế độ khôi phục hiện tại để sử dụng cho thiết bị. |
abstract void | setUseFastbootErase (boolean useFastbootErase) Đặt có sử dụng xóa fastboot hoặc định dạng fastboot để xóa phân vùng trên thiết bị hay không. |
abstract void | startLogcat () Bắt đầu chụp đầu ra logcat từ thiết bị ở chế độ nền. |
abstract void | stopEmulatorOutput () Đóng và xóa đầu ra của trình mô phỏng. |
abstract void | stopLogcat () Dừng chụp đầu ra logcat từ thiết bị và hủy dữ liệu logcat hiện được lưu. |
abstract String | switchToAdbTcp () Chuyển thiết bị sang chế độ adb-over-tcp. |
abstract boolean | switchToAdbUsb () Chuyển thiết bị sang chế độ adb qua usb. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) Đồng bộ hóa dần dần nội dung của thư mục tệp cục bộ với thiết bị. |
abstract boolean | unlockDevice () Mở khóa thiết bị nếu thiết bị ở trạng thái được mã hóa. |
abstract boolean | waitForBootComplete (long timeOut) Chặn cho đến khi cờ hoàn tất khởi động của thiết bị được đặt. |
abstract boolean | waitForDeviceAvailable () Đợi thiết bị phản hồi và có sẵn để thử nghiệm. |
abstract boolean | waitForDeviceAvailable (long waitTime) Đợi thiết bị phản hồi và có sẵn để thử nghiệm. |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) Đợi thiết bị phản hồi và khả dụng mà không xem xét đường dẫn khôi phục. |
abstract void | waitForDeviceBootloader () Chặn cho đến khi thiết bị hiển thị qua fastboot. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Chặn để thiết bị ở trạng thái 'khôi phục adb' (lưu ý rằng điều này khác với |
abstract boolean | waitForDeviceInSideload (long waitTime) Chặn để thiết bị ở trạng thái 'adb sideload' |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Các khối cho thiết bị không khả dụng, tức là bị thiếu trong adb |
abstract void | waitForDeviceOnline () Chặn cho đến khi thiết bị hiển thị qua adb. |
abstract void | waitForDeviceOnline (long waitTime) Chặn cho đến khi thiết bị hiển thị qua adb. |
abstract boolean | waitForDeviceShell (long waitTime) Đợi thiết bị phản hồi lại lệnh trình bao adb cơ bản. |
hằng số
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
Giá trị mặc định khi không thể phát hiện Cấp độ API
Giá trị không đổi: -1 (0xffffffff)
Phương thức công khai
checkApiLevelAgainstNextRelease
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Kiểm tra xem một tính năng hiện có được hỗ trợ hay không ở mức được hỗ trợ tối thiểu. Phương pháp này tính đến các tính năng chưa được phát hành trước khi cấp độ API được nâng lên.
Thông số | |
---|---|
strictMinLevel | int : Mức tối thiểu nghiêm ngặt có thể hỗ trợ tính năng này. |
trả lại | |
---|---|
boolean | Đúng nếu mức được hỗ trợ. Sai nếu không. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
rõ ràngLogcat
public abstract void clearLogcat ()
Xóa mọi dữ liệu logcat tích lũy.
Điều này hữu ích cho các trường hợp khi bạn muốn đảm bảoITestDevice#getLogcat()
chỉ trả về dữ liệu nhật ký được tạo sau một thời điểm nhất định (chẳng hạn như sau khi cài đặt bản dựng thiết bị mới, v.v.). xóa tài liệu
public abstract void deleteFile (String deviceFilePath)
Phương thức trợ giúp để xóa tệp hoặc thư mục trên thiết bị.
Thông số | |
---|---|
deviceFilePath | String : Đường dẫn tuyệt đối của tệp trên thiết bị. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftKhởi động lại
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Phương pháp trợ giúp để kiểm tra xem thiết bị có khởi động lại mềm hay không bằng cách so sánh system_server hiện tại với system_server ProcessInfo
trước đó. Sử dụng getProcessByName(String)
để nhận ProcessInfo
.
Thông số | |
---|---|
prevSystemServerProcess | ProcessInfo : quy trình system_server trước đó ProcessInfo . |
trả lại | |
---|---|
boolean | true nếu thiết bị khởi động lại mềm |
ném | |
---|---|
| nếu thiết bị có lý do khởi động bất thường |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestartedKể từ khi
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Phương pháp trợ giúp để kiểm tra xem thiết bị có khởi động lại mềm kể từ thời gian UTC kể từ Epoch từ thiết bị và ERROR(/TimeUnit)
của thiết bị hay không. Khởi động lại mềm đề cập đến system_server được khởi động lại bên ngoài khởi động lại cứng thiết bị (ví dụ: khởi động lại được yêu cầu). Thiết bị hiện tại utcEpochTime tính bằng Millisecond có thể được lấy bằng phương thức getDeviceDate()
.
Thông số | |
---|---|
utcEpochTime | long : thời gian thiết bị tính bằng giây kể từ epoch. |
timeUnit | TimeUnit : đơn vị thời gian TimeUnit cho utcEpochTime đã cho. |
trả lại | |
---|---|
boolean | true nếu thiết bị khởi động lại mềm |
ném | |
---|---|
| nếu thiết bị có lý do khởi động bất thường |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
vô hiệu hóaAdbRoot
public abstract boolean disableAdbRoot ()
Tắt adb root.
Vô hiệu hóa adb root có thể khiến thiết bị ngắt kết nối khỏi adb. Phương pháp này sẽ chặn cho đến khi có thiết bị.trả lại | |
---|---|
boolean | true nếu thành công. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Phương pháp trợ giúp để xác định xem tệp trên thiết bị có tồn tại hay không.
Thông số | |
---|---|
deviceFilePath | String : đường dẫn tuyệt đối của tệp trên thiết bị để kiểm tra |
trả lại | |
---|---|
boolean | true nếu tệp tồn tại, false nếu không. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
enableAdbRoot
public abstract boolean enableAdbRoot ()
Bật adb root. Nếu cài đặt "enable-root" là "false", sẽ ghi lại một thông báo và quay lại mà không bật root.
Bật adb root có thể khiến thiết bị ngắt kết nối khỏi adb. Phương pháp này sẽ chặn cho đến khi có thiết bị.trả lại | |
---|---|
boolean | true nếu thành công. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống với thời gian chờ được chỉ định.
executeShellCommand(String)
nên được sử dụng thay thế bất cứ khi nào có thể, vì phương pháp đó mang lại hiệu suất và khả năng phát hiện lỗi tốt hơn.
Thông số | |
---|---|
timeout | long : thời gian tính bằng mili giây trước khi thiết bị được coi là không phản hồi, 0L không có thời gian chờ |
commandArgs | String : lệnh adb và các đối số để chạy |
trả lại | |
---|---|
String | thiết bị xuất chuẩn từ lệnh. null nếu lệnh không thực thi được. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống.
executeShellCommand(String)
nên được sử dụng thay thế bất cứ khi nào có thể, vì phương pháp đó mang lại hiệu suất và khả năng phát hiện lỗi tốt hơn.Thông số | |
---|---|
commandArgs | String : lệnh adb và các đối số để chạy |
trả lại | |
---|---|
String | thiết bị xuất chuẩn từ lệnh. null nếu lệnh không thực thi được. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiAdbCommand
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống với thời gian chờ được chỉ định.
executeShellCommand(String)
nên được sử dụng thay thế bất cứ khi nào có thể, vì phương pháp đó mang lại hiệu suất và khả năng phát hiện lỗi tốt hơn.
Thông số | |
---|---|
timeout | long : thời gian tính bằng mili giây trước khi thiết bị được coi là không phản hồi, 0L không có thời gian chờ |
envMap | |
commandArgs | String : lệnh adb và các đối số để chạy |
trả lại | |
---|---|
String | thiết bị xuất chuẩn từ lệnh. null nếu lệnh không thực thi được. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiFastbootCommand
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
Phương thức trợ giúp thực thi lệnh fastboot dưới dạng lệnh hệ thống.
Dự kiến sẽ được sử dụng khi thiết bị đã ở chế độ fastboot.Thông số | |
---|---|
timeout | long : thời gian tính bằng mili giây trước khi lệnh hết hạn |
commandArgs | String : lệnh fastboot và các đối số để chạy |
trả lại | |
---|---|
CommandResult | CommandResult chứa đầu ra của lệnh |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiFastbootCommand
public abstract CommandResult executeFastbootCommand (String... commandArgs)
Phương thức trợ giúp thực thi lệnh fastboot dưới dạng lệnh hệ thống với thời gian chờ mặc định là 2 phút.
Dự kiến sẽ được sử dụng khi thiết bị đã ở chế độ fastboot.
Thông số | |
---|---|
commandArgs | String : lệnh fastboot và các đối số để chạy |
trả lại | |
---|---|
CommandResult | CommandResult chứa đầu ra của lệnh |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
execLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Phương thức trợ giúp thực thi lệnh fastboot chạy dài dưới dạng lệnh hệ thống.
Giống hệt vớiexecuteFastbootCommand(String)
ngoại trừ sử dụng thời gian chờ lâu hơn.Thông số | |
---|---|
commandArgs | String : lệnh fastboot và các đối số để chạy |
trả lại | |
---|---|
CommandResult | CommandResult chứa đầu ra của lệnh |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
execLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Phương thức trợ giúp thực thi lệnh fastboot chạy dài dưới dạng lệnh hệ thống với các biến môi trường hệ thống.
Giống hệt với executeFastbootCommand(String)
ngoại trừ sử dụng thời gian chờ lâu hơn.
Thông số | |
---|---|
envVarMap | |
commandArgs | String : lệnh fastboot và các đối số để chạy |
trả lại | |
---|---|
CommandResult | CommandResult chứa đầu ra của lệnh |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellCommand
public abstract String executeShellCommand (String command)
Phương thức trợ giúp thực thi lệnh shell adb và trả về đầu ra dưới dạng ERROR(/String)
.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
trả lại | |
---|---|
String | đầu ra vỏ |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
receiver | IShellOutputReceiver : IShellOutputReceiver để hướng đầu ra shell tới. |
maxTimeToOutputShellResponse | long : lượng thời gian tối đa mà lệnh được phép không đưa ra bất kỳ phản hồi nào; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
retryAttempts | int : số lần tối đa để thử lại lệnh nếu nó không thành công do một ngoại lệ. DeviceNotResponsiveException sẽ bị ném nếu retryAttempts được thực hiện không thành công. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
receiver | IShellOutputReceiver : IShellOutputReceiver để hướng đầu ra shell tới. |
maxTimeoutForCommand | long : thời gian chờ tối đa để lệnh hoàn thành; đơn vị như được chỉ định trong timeUnit |
maxTimeToOutputShellResponse | long : lượng thời gian tối đa mà lệnh được phép không đưa ra bất kỳ phản hồi nào; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
retryAttempts | int : số lần tối đa để thử lại lệnh nếu nó không thành công do một ngoại lệ. DeviceNotResponsiveException sẽ bị ném nếu retryAttempts được thực hiện không thành công. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
Thực thi lệnh adb shell đã cho, thử lại nhiều lần nếu lệnh không thành công.
Một dạng đơn giản hơn củaexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
với các giá trị mặc định.Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
receiver | IShellOutputReceiver : IShellOutputReceiver để hướng đầu ra shell tới. |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command)
Phương thức trợ giúp thực thi lệnh trình bao adb và trả về kết quả dưới dạng CommandResult
được điền đúng với đầu ra trạng thái lệnh, thiết bị xuất chuẩn và thiết bị xuất chuẩn.
Thông số | |
---|---|
command | String : Lệnh sẽ được chạy. |
trả lại | |
---|---|
CommandResult | Kết quả trong CommandResult . |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
Phương thức trợ giúp thực thi lệnh trình bao adb và trả về kết quả dưới dạng CommandResult
được điền đúng với đầu ra trạng thái lệnh và thiết bị xuất chuẩn. thiết bị xuất chuẩn được hướng đến luồng đã chỉ định.
Thông số | |
---|---|
command | String : Lệnh sẽ được chạy. |
pipeToOutput | OutputStream : ERROR(/OutputStream) trong đó đầu ra tiêu chuẩn sẽ được chuyển hướng hoặc null. |
trả lại | |
---|---|
CommandResult | Kết quả trong CommandResult . |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
Phương thức trợ giúp thực thi lệnh trình bao adb và trả về kết quả dưới dạng CommandResult
được điền đúng với đầu ra trạng thái lệnh, thiết bị xuất chuẩn và thiết bị xuất chuẩn.
Thông số | |
---|---|
command | String : Lệnh sẽ được chạy. |
pipeAsInput | File : MỘT ERROR(/File) sẽ được đặt làm đầu vào cho lệnh hoặc null. |
trả lại | |
---|---|
CommandResult | Kết quả trong CommandResult . |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
maxTimeoutForCommand | long : thời gian chờ tối đa để lệnh hoàn thành; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
retryAttempts | int : số lần tối đa để thử lại lệnh nếu nó không thành công do một ngoại lệ. DeviceNotResponsiveException sẽ bị ném nếu retryAttempts được thực hiện không thành công. |
trả lại | |
---|---|
CommandResult |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
Xem thêm:
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
maxTimeoutForCommand | long : thời gian chờ tối đa để lệnh hoàn thành; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
trả lại | |
---|---|
CommandResult |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
Xem thêm:
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
pipeAsInput | File : MỘT ERROR(/File) sẽ được đặt làm đầu vào cho lệnh hoặc null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) trong đó đầu ra tiêu chuẩn sẽ được chuyển hướng hoặc null. |
maxTimeoutForCommand | long : thời gian chờ tối đa để lệnh hoàn thành; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
retryAttempts | int : số lần tối đa để thử lại lệnh nếu nó không thành công do một ngoại lệ. DeviceNotResponsiveException sẽ bị ném nếu retryAttempts được thực hiện không thành công. |
trả lại | |
---|---|
CommandResult |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
Xem thêm:
thực thiShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Thực thi lệnh adb shell, với nhiều tham số hơn để kiểm soát hành vi của lệnh.
Thông số | |
---|---|
command | String : lệnh shell adb để chạy |
pipeAsInput | File : MỘT ERROR(/File) sẽ được đặt làm đầu vào cho lệnh hoặc null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) trong đó đầu ra tiêu chuẩn sẽ được chuyển hướng hoặc null. |
pipeToError | OutputStream : ERROR(/OutputStream) trong đó lỗi tiêu chuẩn sẽ được chuyển hướng hoặc null. |
maxTimeoutForCommand | long : thời gian chờ tối đa để lệnh hoàn thành; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
retryAttempts | int : số lần tối đa để thử lại lệnh nếu nó không thành công do một ngoại lệ. DeviceNotResponsiveException sẽ bị ném nếu retryAttempts được thực hiện không thành công. |
trả lại | |
---|---|
CommandResult |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
Xem thêm:
fastbootWipePhân vùng
public abstract CommandResult fastbootWipePartition (String partition)
Phương thức trợ giúp xóa phân vùng cho thiết bị.
NếugetUseFastbootErase()
là true
thì quá trình xóa fastboot sẽ được sử dụng để xóa phân vùng. Sau đó, thiết bị phải tạo một hệ thống tệp vào lần khởi động tiếp theo của thiết bị. Mặt khác, định dạng fastboot được sử dụng sẽ tạo một hệ thống tệp mới trên thiết bị. Dự kiến sẽ được sử dụng khi thiết bị đã ở chế độ fastboot.Thông số | |
---|---|
partition | String : phân vùng cần xóa |
trả lại | |
---|---|
CommandResult | CommandResult chứa đầu ra của lệnh |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
getApiLevel
public abstract int getApiLevel ()
Nhận cấp độ API của thiết bị. Mặc định là UNKNOWN_API_LEVEL
.
trả lại | |
---|---|
int | một số nguyên cho biết Cấp độ API của thiết bị |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
phiên bản getBaseband
public abstract String getBasebandVersion ()
Phương pháp thuận tiện để có được phiên bản băng tần cơ sở (radio) của thiết bị này. Nhận phiên bản radio là dành riêng cho thiết bị, vì vậy phiên bản này có thể không trả lại thông tin chính xác cho tất cả các thiết bị. Phương pháp này dựa vào thuộc tính gsm.version.baseband để trả về thông tin phiên bản chính xác. Điều này không chính xác đối với một số thiết bị CDMA và phiên bản được trả lại ở đây có thể không khớp với phiên bản được báo cáo từ fastboot và có thể không trả lại phiên bản cho đài CDMA. TL; DR phương pháp này chỉ báo cáo phiên bản chính xác nếu thuộc tính gsm.version.baseband giống với phiên bản được trả về bởi fastboot getvar version-baseband
.
trả lại | |
---|---|
String | phiên bản dải cơ sở ERROR(/String) hoặc null nếu không thể xác định được (thiết bị không có radio hoặc chuỗi phiên bản không thể đọc được) |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
lấy pin
public abstract Integer getBattery ()
Trả về mức pin hiện tại của thiết bị hoặc Null nếu không có mức pin.
trả lại | |
---|---|
Integer |
getBooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
Trả về giá trị boolean của thuộc tính đã cho.
Thông số | |
---|---|
name | String : tên thuộc tính |
defaultValue | boolean : giá trị mặc định trả về nếu thuộc tính trống hoặc không tồn tại. |
trả lại | |
---|---|
boolean | true nếu thuộc tính có giá trị "1" , "y" , "yes" , "on" hoặc "true" , false nếu thuộc tính có giá trị là "0" , "n" , "no" , "off" , "false" hoặc defaultValue nếu không. |
ném | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
Phương thức trợ giúp thu thập bản đồ lịch sử khởi động với thời gian khởi động và lý do khởi động.
trả lại | |
---|---|
Bản đồ thời gian khởi động (thời gian UTC tính bằng giây kể từ Epoch) và lý do khởi động |
ném | |
---|---|
DeviceNotAvailableException |
getBootHistoryKể từ
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Phương thức của trình trợ giúp thu thập bản đồ lịch sử khởi động với thời gian khởi động và lý do khởi động kể từ thời điểm đã cho kể từ kỷ nguyên từ thiết bị và đơn vị thời gian được chỉ định. Có thể lấy thiết bị hiện tại utcEpochTime tính bằng Milli giây bằng phương thức getDeviceDate()
.
Thông số | |
---|---|
utcEpochTime | long : thời gian thiết bị kể từ Epoch. |
timeUnit | TimeUnit : đơn vị thời gian TimeUnit . |
trả lại | |
---|---|
Bản đồ thời gian khởi động (thời gian UTC tính bằng giây kể từ Epoch) và lý do khởi động |
ném | |
---|---|
DeviceNotAvailableException |
phiên bản getBootloader
public abstract String getBootloaderVersion ()
Phương pháp thuận tiện để tải phiên bản bộ nạp khởi động của thiết bị này.
Sẽ cố gắng truy xuất phiên bản bộ nạp khởi động từ trạng thái hiện tại của thiết bị. (nghĩa là nếu thiết bị đang ở chế độ fastboot, nó sẽ cố truy xuất phiên bản từ fastboot)trả lại | |
---|---|
String | phiên bản bộ tải khởi động ERROR(/String) hoặc null nếu không tìm thấy |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
getBuildAlias
public abstract String getBuildAlias ()
Truy xuất bí danh của bản dựng mà thiết bị hiện đang chạy.
Bí danh bản dựng thường là một chuỗi dễ đọc hơn id bản dựng (thường là một số cho bản dựng Nexus). Ví dụ: bản phát hành Android 4.2 cuối cùng có bí danh bản dựng là JDQ39 và id bản dựng là 573038
trả lại | |
---|---|
String | bí danh bản dựng hoặc quay lại id bản dựng nếu không thể truy xuất |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildHương vị
public abstract String getBuildFlavor ()
Truy xuất hương vị xây dựng cho thiết bị.
trả lại | |
---|---|
String | hương vị bản dựng hoặc null nếu không thể truy xuất được |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Truy xuất bản dựng mà thiết bị hiện đang chạy.
trả lại | |
---|---|
String | id bản dựng hoặc IBuildInfo#UNKNOWN_BUILD_ID nếu không thể truy xuất |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
Trả về loại khóa được sử dụng để ký hình ảnh thiết bị
Thông thường, các thiết bị Android có thể được ký bằng khóa kiểm tra (như trong AOSP) hoặc khóa phát hành (do nhà sản xuất thiết bị riêng lẻ kiểm soát)
trả lại | |
---|---|
String | Khóa ký nếu tìm thấy, null nếu không. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Trả về một DeviceDescriptor
được lưu trong bộ nhớ cache nếu thiết bị được cấp phát, nếu không thì trả về DeviceDescriptor
hiện tại.
trả lại | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Trả về một DeviceDescriptor
được lưu trong bộ nhớ cache nếu thiết bị được cấp phát, nếu không thì trả về DeviceDescriptor
hiện tại.
Thông số | |
---|---|
shortDescriptor | boolean : Có hay không giới hạn bộ mô tả ở mức thông tin tối thiểu |
trả lại | |
---|---|
DeviceDescriptor |
nhận con
public abstract String[] getChildren (String deviceFilePath)
Thay thế cho việc sử dụng IFileEntry
đôi khi không hoạt động do có quyền.
Thông số | |
---|---|
deviceFilePath | String : là đường dẫn trên thiết bị để thực hiện tìm kiếm |
trả lại | |
---|---|
String[] | Mảng chuỗi chứa tất cả tệp trong một đường dẫn trên thiết bị. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
kết nối
public abstract AbstractConnection getConnection ()
Trả về kết nối được liên kết với thiết bị.
trả lại | |
---|---|
AbstractConnection |
getDeviceClass
public abstract String getDeviceClass ()
Nhận lớp thiết bị.
trả lại | |
---|---|
String | lớp thiết bị ERROR(/String) . |
getDeviceDate
public abstract long getDeviceDate ()
Trả về ngày của thiết bị tính bằng mili giây kể từ epoch.
trả lại | |
---|---|
long | ngày của thiết bị ở định dạng epoch. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Trả về một DeviceDescriptor
từ thông tin thiết bị để nhận thông tin về thiết bị mà không chuyển đối tượng thiết bị thực tế.
trả lại | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Trả về một DeviceDescriptor
từ thông tin thiết bị để nhận thông tin về thiết bị mà không chuyển đối tượng thiết bị thực tế.
Thông số | |
---|---|
shortDescriptor | boolean : Có hay không giới hạn bộ mô tả ở mức thông tin tối thiểu |
trả lại | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Nhận trạng thái của thiết bị.
trả lại | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Trình trợ giúp để nhận chênh lệch múi giờ giữa thiết bị và ERROR(/Date)
đã cho. Sử dụng thời gian Epoch trong nội bộ.
Thông số | |
---|---|
date | Date |
trả lại | |
---|---|
long | sự khác biệt tính bằng mili giây |
ném | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
Nhận luồng trình giả lập thiết bị xuất chuẩn và thiết bị xuất chuẩn
trả lại | |
---|---|
InputStreamSource | đầu ra giả lập |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Phương pháp trợ giúp để xác định dung lượng trống trên bộ nhớ ngoài của thiết bị.
trả lại | |
---|---|
long | dung lượng trống tính bằng KB |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
getFastbootProductType
public abstract String getFastbootProductType ()
Phương pháp thuận tiện để lấy loại sản phẩm của thiết bị này khi thiết bị ở chế độ fastboot.
Phương pháp này chỉ nên được sử dụng nếu thiết bị phải ở chế độ fastboot. Đây là một biến thể an toàn hơn một chút so với phương thứcgetProductType()
chung trong trường hợp này, bởi vì ITestDevice sẽ biết khôi phục thiết bị về chế độ fastboot nếu thiết bị ở trạng thái không chính xác hoặc không phản hồi.trả lại | |
---|---|
String | tên loại sản phẩm ERROR(/String) hoặc null nếu không xác định được |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
Phương pháp thuận tiện để lấy loại sản phẩm của thiết bị này khi thiết bị ở chế độ fastboot.
Phương pháp này chỉ nên được sử dụng nếu thiết bị phải ở chế độ fastboot. Đây là một biến thể an toàn hơn một chút so với phương thứcgetProductType()
chung trong trường hợp này, bởi vì ITestDevice sẽ biết khôi phục thiết bị về chế độ fastboot nếu thiết bị ở trạng thái không chính xác hoặc không phản hồi.trả lại | |
---|---|
String | tên loại sản phẩm ERROR(/String) hoặc null nếu không xác định được |
ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể phục hồi. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Trả về số sê-ri chế độ fastboot.
trả lại | |
---|---|
String |
getFastbootBiến
public abstract String getFastbootVariable (String variableName)
Truy xuất giá trị biến fastboot đã cho từ thiết bị.
Thông số | |
---|---|
variableName | String : tên biến |
trả lại | |
---|---|
String | giá trị thuộc tính hoặc null nếu nó không tồn tại |
ném | |
---|---|
| Hoạt động ngoại lệ không được hỗ trợ |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
Truy xuất tham chiếu đến tệp từ xa trên thiết bị.
Thông số | |
---|---|
path | String : đường dẫn file cần lấy. Có thể là đường dẫn tuyệt đối hoặc đường dẫn liên quan đến '/'. (nghĩa là cả cú pháp "/system" và "system" đều được hỗ trợ) |
trả lại | |
---|---|
IFileEntry | IFileEntry hoặc null nếu không tìm thấy tệp tại path đã cho |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Trả về một tham chiếu đến ddmlib IDevice
được liên kết.
IDevice
mới có thể được DDMS phân bổ mỗi khi thiết bị ngắt kết nối và kết nối lại từ adb. Do đó, người gọi không nên giữ tham chiếu đến IDevice
vì tham chiếu đó có thể trở nên cũ.trả lại | |
---|---|
IDevice | IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Trả về giá trị nguyên của thuộc tính đã cho từ thiết bị.
Thông số | |
---|---|
name | String : tên thuộc tính |
defaultValue | long : giá trị mặc định trả về nếu thuộc tính trống hoặc không tồn tại. |
trả lại | |
---|---|
long | giá trị thuộc tính hoặc defaultValue nếu thuộc tính trống, không tồn tại hoặc không có giá trị số nguyên. |
ném | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Trả về lần cuối cùng API được trao đổi kích hoạt khởi động lại sau mili giây kể từ EPOCH khi được trả về bởi ERROR(/System#currentTimeMillis())
.
trả lại | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Nhận Cấp API khởi chạy đầu tiên của thiết bị. Mặc định là UNKNOWN_API_LEVEL
.
trả lại | |
---|---|
int | một số nguyên cho biết Cấp độ API được khởi chạy đầu tiên của thiết bị |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Lấy một luồng ảnh chụp nhanh của dữ liệu logcat.
Hoạt động ở hai chế độ:
TestDeviceOptions.getMaxLogcatDataSize()
byte nội dung hiện tại của quá trình chụp logcat ở chế độ nềntrả lại | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Lấy một luồng ảnh chụp nhanh của maxBytes
cuối cùng của dữ liệu logcat đã chụp.
Hữu ích cho các trường hợp khi bạn muốn chụp ảnh chụp nhanh thường xuyên của dữ liệu logcat đã chụp mà không phải chịu hình phạt dung lượng ổ đĩa lớn có khả năng nhận được toàn bộ ảnh chụp nhanh getLogcat()
.
Thông số | |
---|---|
maxBytes | int : lượng dữ liệu tối đa cần trả về. Phải là một số tiền có thể thoải mái phù hợp với bộ nhớ |
trả lại | |
---|---|
InputStreamSource |
getLogcatDump
public abstract InputStreamSource getLogcatDump ()
Nhận kết xuất logcat hiện tại cho thiết bị. 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.
trả lại | |
---|---|
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()
.
Thông số | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
trả lại | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Trả về một điểm gắn kết.
Truy vấn thiết bị trực tiếp nếu thông tin được lưu trong bộ nhớ cache trongIDevice
không khả dụng. CẦN LÀM: chuyển hành vi này sang IDevice#getMountPoint(String)
Thông số | |
---|---|
mountName | String : tên của điểm gắn kết |
trả lại | |
---|---|
String | điểm gắn kết hoặc 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.
Thông số | |
---|---|
mountpoint | String |
trả lại | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
ném | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
trả lại | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
ném | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
Thông số | |
---|---|
partition | String |
trả lại | |
---|---|
long | the amount of free space in KB |
ném | |
---|---|
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.
Thông số | |
---|---|
processName | String : the proces name String. |
trả lại | |
---|---|
ProcessInfo | ProcessInfo of given processName |
ném | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
Thông số | |
---|---|
process | String : The proces name String. |
trả lại | |
---|---|
String |
ném | |
---|---|
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.trả lại | |
---|---|
String | the ERROR(/String) product type name. Will not be null |
ném | |
---|---|
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.trả lại | |
---|---|
String | the ERROR(/String) product variant name or null if it cannot be determined |
ném | |
---|---|
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.
Thông số | |
---|---|
name | String : the property name |
trả lại | |
---|---|
String | the property value or null if it does not exist |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
trả lại | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
trả lại | |
---|---|
String | the ERROR(/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.
trả lại | |
---|---|
A list of tombstone files, empty if no tombstone. |
ném | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
trả lại | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
trả lại | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
trả lại | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
trả lại | |
---|---|
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
trả lại | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public abstract boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
trả lại | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
trả lại | |
---|---|
boolean | true if the device is encrypted. |
ném | |
---|---|
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.
Thông số | |
---|---|
deviceFilePath | String |
trả lại | |
---|---|
boolean |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
trả lại | |
---|---|
boolean | true if the device supports encryption. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
Thông số | |
---|---|
fullPath | String |
trả lại | |
---|---|
boolean |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
trả lại | |
---|---|
boolean |
ném | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
trả lại | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
trả lại | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
Thông số | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
trả lại | |
---|---|
boolean | True if the logging was successful, false otherwise. |
ném | |
---|---|
DeviceNotAvailableException |
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.
Thông số | |
---|---|
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.
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
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)ném | |
---|---|
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.
Thông số | |
---|---|
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.
Thông số | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
ném | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
Thông số | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
trả lại | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
ném | |
---|---|
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
.
Thông số | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
trả lại | |
---|---|
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) |
ném | |
---|---|
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
.
Thông số | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
trả lại | |
---|---|
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) |
ném | |
---|---|
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.
Thông số | |
---|---|
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. |
trả lại | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
ném | |
---|---|
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.
Thông số | |
---|---|
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 |
trả lại | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
ném | |
---|---|
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.
Thông số | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
trả lại | |
---|---|
String | A ERROR(/String) containing the contents of the device file, or null if the copy failed for any reason (including problems with the host filesystem) |
ném | |
---|---|
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
.
Thông số | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
trả lại | |
---|---|
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) |
ném | |
---|---|
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.
Thông số | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
trả lại | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
ném | |
---|---|
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.
Thông số | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
trả lại | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
ném | |
---|---|
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.
Thông số | |
---|---|
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 |
trả lại | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
ném | |
---|---|
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.
Thông số | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
trả lại | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
ném | |
---|---|
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
Thông số | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
trả lại | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
ném | |
---|---|
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.ném | |
---|---|
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.
Thông số | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
ném | |
---|---|
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.ném | |
---|---|
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.
ném | |
---|---|
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 recoveryném | |
---|---|
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
Thông số | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
ném | |
---|---|
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
ném | |
---|---|
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.
ném | |
---|---|
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.
Thông số | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
ném | |
---|---|
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.
ném | |
---|---|
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.
ném | |
---|---|
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.
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
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.
Thông số | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
trả lại | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
ném | |
---|---|
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.
Thông số | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
trả lại | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
ném | |
---|---|
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,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.
Thông số | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
trả lại | |
---|---|
boolean |
ném | |
---|---|
DeviceNotAvailableException |
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.
Thông số | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
trả lại | |
---|---|
boolean |
ném | |
---|---|
DeviceNotAvailableException |
setDate
public abstract void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
Thông số | |
---|---|
date | Date : specify a particular date; will use host date if null |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
Thông số | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
Thông số | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
trả lại | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setRecovery
public abstract void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
Thông số | |
---|---|
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, etcThông số | |
---|---|
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.
Thông số | |
---|---|
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.
trả lại | |
---|---|
String | the tcp serial number or null if device could not be switched |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
trả lại | |
---|---|
boolean | true if switch was successful, false otherwise. |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
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.Thông số | |
---|---|
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 |
trả lại | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
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.trả lại | |
---|---|
boolean | true if successful or if the device is unencrypted. |
ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
| 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.
Thông số | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
trả lại | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
ném | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
waitForDeviceCó sẵn
public abstract boolean waitForDeviceAvailable ()
Đợi thiết bị phản hồi và có sẵn để thử nghiệm. Uses default timeout.
trả lại | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceCó sẵn
public abstract boolean waitForDeviceAvailable (long waitTime)
Đợi thiết bị phản hồi và có sẵn để thử nghiệm.
Thông số | |
---|---|
waitTime | long : thời gian tính bằng ms để chờ đợi |
trả lại | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
ném | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceAvailableInRecoverPath
public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
Thông số | |
---|---|
waitTime | long |
trả lại | |
---|---|
boolean | True if device is available, False if unavailable. |
ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
WaitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
ném | |
---|---|
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
).
Thông số | |
---|---|
waitTime | long : thời gian tính bằng ms để chờ đợi |
trả lại | |
---|---|
boolean | true if device boots into recovery before time expires. sai nếu false |
waitForDeviceInSideload
public abstract boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
Thông số | |
---|---|
waitTime | long : thời gian tính bằng ms để chờ đợi |
trả lại | |
---|---|
boolean | true if device boots into sideload before time expires. sai nếu false |
waitForDeviceNotAvailable
public abstract boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
Thông số | |
---|---|
waitTime | long : thời gian tính bằng ms để chờ đợi |
trả lại | |
---|---|
boolean | true if device becomes not available before time expires. sai nếu false |
waitForDeviceTrực tuyến
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.ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceTrực tuyến
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.Thông số | |
---|---|
waitTime | long : thời gian tính bằng ms để chờ đợi |
ném | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
WaitForDeviceShell
public abstract boolean waitForDeviceShell (long waitTime)
Đợi thiết bị phản hồi lại lệnh trình bao adb cơ bản.
Thông số | |
---|---|
waitTime | long : thời gian tính bằng ms để chờ đợi |
trả lại | |
---|---|
boolean | true nếu thiết bị phản hồi trước khi waitTime trôi qua. |