INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Cung cấp API cấp độ đáng tin cậy và cao hơn một chút cho IDevice 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 pháp 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 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 pháp người 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 processInfo |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Phương pháp của người trợ giúp để kiểm tra xem thiết bị có khởi động lại mềm kể từ thời điểm UTC kể từ kỷ nguyên từ thiết bị hay không và |
abstract boolean | disableAdbRoot () Tắt adb root. |
abstract boolean | doesFileExist (String deviceFilePath) Phương pháp của người 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 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 | 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 | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Phương thức trợ giúp thực thi lệnh fastboot đang chạy lâu 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 CommandResult | executeLongFastbootCommand (String... commandArgs) Phương thức trợ giúp thực thi lệnh fastboot chạy dài như một lệnh hệ thống. |
abstract String | executeShellCommand (String command) Phương thức trợ giúp thực thi lệnh adb shell và trả về kết quả đầu ra dưới dạng |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Thực thi một 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 một 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 adb shell 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 adb shell 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 adb shell và trả về kết quả dưới dạng |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Thực thi một 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 một 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 một 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 một 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 pháp trình trợ giúp xóa một phân vùng cho thiết bị. |
abstract int | getApiLevel () Nhận Cấp API thiết bị. |
abstract String | getBasebandVersion () Phương pháp thuận tiện để lấy 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 mức pin không khả dụng. |
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 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 nhất định 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 InputStreamSource | getBugreport () Truy xuất báo cáo lỗi từ thiết bị. |
abstract InputStreamSource | getBugreportz () Truy xuất báo cáo lỗi từ thiết bị. |
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 (được kiểm soát bởi các nhà sản xuất thiết bị riêng lẻ) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Trả về |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Trả về |
abstract String[] | getChildren (String deviceFilePath) Thay thế cho việc sử dụng |
abstract String | getDeviceClass () Nhận loại thiết bị. |
abstract long | getDeviceDate () Trả lại ngày của thiết bị trong mili giây kể từ kỷ nguyên. |
abstract DeviceDescriptor | getDeviceDescriptor () Trả lại |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Trả lại |
abstract TestDeviceState | getDeviceState () Nhận trạng thái của thiết bị. |
abstract long | getDeviceTimeOffset (Date date) Người trợ giúp nhận được chênh lệch thời gian giữa thiết bị và một |
abstract InputStreamSource | getEmulatorOutput () Nhận luồng trình giả lập stdout và stderr |
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 nó ở chế độ khởi động nhanh. |
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 nó ở chế độ khởi động nhanh. |
abstract String | getFastbootSerialNumber () Trả về số sê-ri của 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 một tệp từ xa trên thiết bị. |
abstract IDevice | getIDevice () Trả về một tham chiếu đến IDevice |
abstract long | getIntProperty (String name, long defaultValue) Trả về giá trị số nguyên của thuộc tính đã cho từ thiết bị. |
abstract long | getLastExpectedRebootTimeMillis () Trả về lần cuối cùng các API Tradefed kích hoạt khởi động lại trong mili giây kể từ EPOCH như được trả về bởi |
abstract int | getLaunchApiLevel () Nhận Cấp API được 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 bản kết xuất của logcat hiện tại cho thiết bị. |
abstract InputStreamSource | getLogcatSince (long date) Lấy một luồng ảnh chụp nhanh của dữ liệu logcat đã chụp bắt đầu từ ngày được cung cấp. |
abstract String | getMountPoint (String mountName) Trả về đ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 người 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 có 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 để nhận được biến thể sản phẩm của thiết bị này. |
abstract String | getProperty (String name) Lấy 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 bia mộ từ các thiết bị. |
abstract long | getTotalMemory () Trả về tổng kích thước bộ nhớ vật lý tính bằng byte hoặc -1 trong trường hợp lỗi nội bộ |
abstract boolean | getUseFastbootErase () Nhận xem sử dụng định dạng fastboot xóa hay fastboot để xóa một 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ợ tính năng liệt kê ứ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 có đầu (không có màn hình), ngược lại là false. |
abstract boolean | isRuntimePermissionSupported () Kiểm tra xem nền tảng trên thiết bị có hỗ trợ cấp quyền thời gian chạy hay không |
abstract boolean | isStateBootloaderOrFastbootd () Trả về true nếu thiết bị ở trong |
abstract boolean | logAnrs ( ITestLogger logger) Thu thập và ghi lại các ANR từ thiết bị. |
abstract boolean | logBugreport (String dataName, ITestLogger listener) Phương pháp trợ giúp để thực hiện một báo cáo lỗi và ghi lại nó cho các phóng viên. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Ghi tin nhắn vào logcat của thiết bị. |
abstract void | nonBlockingReboot () Ra lệnh khởi động lại thiết bị và trả lại khi lệnh hoàn tất và khi thiết bị không còn hiển thị với adb. |
abstract void | postBootSetup () Thực hiện các 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 dùng nữa. Thay vào đó, hãy sử dụng |
abstract void | postInvocationTearDown (Throwable invocationException) Các bước bổ sung để dọn dẹp được yêu cầu cụ thể của thiết bị sẽ được thực hiện sau khi thực hiện xong. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) Các bước bổ sung để thiết lập yêu cầu cụ thể cho thiết bị sẽ được thực hiện trên thiết bị trước khi quy trình gọi. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Đệ quy kéo nội dung thư mục từ thiết bị. |
abstract File | pullFile (String remoteFilePath, int userId) Truy xuất tệp khỏi thiết bị, lưu trữ tệp đó trong |
abstract File | pullFile (String remoteFilePath) Truy xuất tệp khỏi thiết bị, lưu trữ tệp đó trong |
abstract boolean | pullFile (String remoteFilePath, File localFile) Truy xuất tệp khỏi thiết bị. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Truy xuất tệp khỏi thiết bị. |
abstract String | pullFileContents (String remoteFilePath) Truy xuất tệp khỏi thiết bị và trả về nội dung. |
abstract File | pullFileFromExternal (String remoteFilePath) Một phương pháp tiện lợi để truy xuất tệp từ bộ nhớ ngoài của thiết bị, lưu trữ tệp đó trong |
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 tệp vào thiết bị. |
abstract boolean | pushString (String contents, String deviceFilePath) Đẩy tệp được tạo từ một chuỗi sang thiết bị |
abstract void | reboot () Khởi động lại thiết bị ở chế độ adb. |
abstract void | reboot (String reason) Khởi động lại thiết bị ở chế độ adb với |
abstract void | rebootIntoBootloader () Khởi động lại thiết bị ở chế độ bộ nạp khởi động. |
abstract void | rebootIntoFastbootd () Khởi động lại thiết bị ở 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ị ở chế độ sideload adb (lưu ý rằng đây là một chế độ đặc biệt đang được khôi phục) Chặn cho đến khi thiết bị chuyển sang chế độ sideload |
abstract void | rebootIntoSideload () Khởi động lại thiết bị ở chế độ sideload adb (lưu ý rằng đây là một chế độ đặc biệt đang được khôi phục) Chặn cho đến khi thiết bị chuyển sang 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 thay thế để |
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 của 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 các bài kiểm tra thiết bị đo và cung cấp khả năng khôi phục thiết bị. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Tương tự như |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) Giống 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 sử dụng định dạng fastboot xóa hay fastboot để xóa một phân vùng trên thiết bị. |
abstract void | startLogcat () Bắt đầu ghi lại đầu ra logcat từ thiết bị ở chế độ nền. |
abstract void | stopEmulatorOutput () Đóng và xóa đầu ra trình giả lập. |
abstract void | stopLogcat () Dừng chụp đầu ra logcat từ thiết bị và hủy dữ liệu logcat hiện đã 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) Tăng dần đồng bộ hóa nội dung của một thư mục tệp cục bộ với thiết bị. |
abstract Bugreport | takeBugreport () Thực hiện một báo cáo lỗi và trả về bên trong một |
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 thành khởi động của thiết bị được đặt. |
abstract boolean | waitForDeviceAvailable () Chờ thiết bị phản hồi và có sẵn để thử nghiệm. |
abstract boolean | waitForDeviceAvailable (long waitTime) Chờ thiết bị phản hồi và có sẵn để thử nghiệm. |
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) Các khối để thiết bị ở trạng thái 'adb sideload' |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Các khối cho thiết bị không có sẵn tức là bị thiếu trong adb |
abstract void | waitForDeviceOnline () Chặn cho đến khi thiết bị được hiển thị qua adb. |
abstract void | waitForDeviceOnline (long waitTime) Chặn cho đến khi thiết bị được hiển thị qua adb. |
abstract boolean | waitForDeviceShell (long waitTime) Chờ thiết bị phản hồi với lệnh adb shell 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 pháp 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 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. |
Lợi nhuận | |
---|---|
boolean | Đúng nếu mức được hỗ trợ. Sai khác. |
Ném | |
---|---|
DeviceNotAvailableException |
clearLogcat
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 flash mộ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 pháp người 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 | |
---|---|
DeviceNotAvailableException |
deviceSoftRestarted
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 processInfo ProcessInfo
trước đó. Sử dụng getProcessByName(String)
để lấy ProcessInfo
.
Thông số | |
---|---|
prevSystemServerProcess | ProcessInfo : quy trình system_server trước ProcessInfo . |
Lợi nhuận | |
---|---|
boolean | true nếu thiết bị khởi động lại mềm |
Ném | |
---|---|
RuntimeException | nếu thiết bị có lý do khởi động bất thường |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Phương pháp của người trợ giúp để kiểm tra xem thiết bị có khởi động lại mềm kể từ thời điểm UTC kể từ kỷ nguyên từ thiết bị hay không và ERROR(/TimeUnit)
của thiết bị. Soft-Restart đề cập đến system_server được khởi động lại bên ngoài khởi động lại cứng của thiết bị (ví dụ: khởi động lại được yêu cầu). Thiết bị hiện tại utcEpochTime trong Milliseccond có thể được lấy bằng phương thức getDeviceDate()
.
Thông số | |
---|---|
utcEpochTime | long : thời gian của thiết bị tính bằng giây kể từ kỷ nguyên. |
timeUnit | TimeUnit : đơn vị thời gian TimeUnit cho utcEpochTime đã cho. |
Lợi nhuận | |
---|---|
boolean | true nếu thiết bị khởi động lại mềm |
Ném | |
---|---|
RuntimeException | nếu thiết bị có lý do khởi động bất thường |
DeviceNotAvailableException |
vô hiệu hóaAdbRoot
public abstract boolean disableAdbRoot ()
Tắt adb root.
Việc tắt adb root có thể khiến thiết bị ngắt kết nối khỏi adb. Phương thức này sẽ chặn cho đến khi có thiết bị.Lợi nhuận | |
---|---|
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ể khôi phục được. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Phương pháp của người 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 |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
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à trả về 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 thức này sẽ chặn cho đến khi có thiết bị.Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeAdbCommand
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 đó cung cấp khả năng phát hiện lỗi và hiệu suất tốt hơn.
Thông số | |
---|---|
timeout | long : khoảng 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 |
Lợi nhuận | |
---|---|
String | lệnh stdout from. 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ể khôi phục được. |
executeAdbCommand
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 đó cung cấp khả năng phát hiện lỗi và hiệu suất tốt hơn.Thông số | |
---|---|
commandArgs | String : lệnh adb và các đối số để chạy |
Lợi nhuận | |
---|---|
String | lệnh stdout from. 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ể khôi phục được. |
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ế độ khởi động nhanh.Thông số | |
---|---|
commandArgs | String : lệnh fastboot và các đối số để chạy |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
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ế độ khởi động nhanh.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 |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Phương thức trợ giúp thực thi lệnh fastboot đang chạy lâu 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 nhau để thực 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 |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Phương thức trợ giúp thực thi lệnh fastboot chạy dài như một lệnh hệ thống.
Giống nhau để thựcexecuteFastbootCommand(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 |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeShellCommand
public abstract String executeShellCommand (String command)
Phương thức trợ giúp thực thi lệnh adb shell và trả về kết quả đầu ra dưới dạng String
.
Thông số | |
---|---|
command | String : lệnh adb shell để chạy |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Thực thi một 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 adb shell để chạy |
receiver | IShellOutputReceiver : IShellOutputReceiver để hướng đầu ra shell tới. |
maxTimeToOutputShellResponse | long : khoảng thời gian tối đa mà lệnh được phép không xuất 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ẽ được ném nếu thực hiện retryAttempts mà 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ể khôi phục được. |
executeShellCommand
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Thực thi một 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 adb shell để chạy |
receiver | IShellOutputReceiver : IShellOutputReceiver để hướng đầu ra shell tới. |
maxTimeoutForCommand | long : thời gian chờ tối đa để hoàn thành lệnh; đơn vị như được chỉ định trong timeUnit |
maxTimeToOutputShellResponse | long : khoảng thời gian tối đa mà lệnh được phép không xuất 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ẽ được ném nếu thực hiện retryAttempts mà 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ể khôi phục được. |
executeShellCommand
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 adb shell để 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ể khôi phục được. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command)
Phương thức trợ giúp thực thi lệnh adb shell 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, stdout và stderr.
Thông số | |
---|---|
command | String : Lệnh sẽ được chạy. |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
Phương thức trợ giúp thực thi lệnh adb shell 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à trình lệnh. stdout được dẫn đến luồng được chỉ định.
Thông số | |
---|---|
command | String : Lệnh sẽ được chạy. |
pipeToOutput | OutputStream : ERROR(/OutputStream) nơi đầu ra std sẽ được chuyển hướng hoặc null. |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
Phương thức trợ giúp thực thi lệnh adb shell 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, stdout và stderr.
Thông số | |
---|---|
command | String : Lệnh sẽ được chạy. |
pipeAsInput | File : ERROR(/File) sẽ được đưa vào làm đầu vào cho lệnh hoặc null. |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Thực thi một 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 adb shell để chạy |
maxTimeoutForCommand | long : thời gian chờ tối đa để hoàn thành lệ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ẽ được ném nếu thực hiện retryAttempts mà không thành công. |
Lợi nhuận | |
---|---|
CommandResult |
Ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể khôi phục được. |
Xem thêm:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Thực thi một 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 adb shell để chạy |
maxTimeoutForCommand | long : thời gian chờ tối đa để hoàn thành lệnh; đơn vị như được chỉ định trong timeUnit |
timeUnit | TimeUnit : đơn vị cho maxTimeToOutputShellResponse |
Lợi nhuận | |
---|---|
CommandResult |
Ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể khôi phục được. |
Xem thêm:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Thực thi một 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 adb shell để chạy |
pipeAsInput | File : ERROR(/File) sẽ được đưa vào làm đầu vào cho lệnh hoặc null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) nơi đầu ra std sẽ được chuyển hướng hoặc null. |
maxTimeoutForCommand | long : thời gian chờ tối đa để hoàn thành lệ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ẽ được ném nếu thực hiện retryAttempts mà không thành công. |
Lợi nhuận | |
---|---|
CommandResult |
Ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể khôi phục được. |
Xem thêm:
executeShellV2Command
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Thực thi một 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 adb shell để chạy |
pipeAsInput | File : ERROR(/File) sẽ được đưa vào làm đầu vào cho lệnh hoặc null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) nơi đầu ra std sẽ được chuyển hướng hoặc null. |
pipeToError | OutputStream : ERROR(/OutputStream) trong đó lỗi std sẽ được chuyển hướng hoặc null. |
maxTimeoutForCommand | long : thời gian chờ tối đa để hoàn thành lệ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ẽ được ném nếu thực hiện retryAttempts mà không thành công. |
Lợi nhuận | |
---|---|
CommandResult |
Ném | |
---|---|
DeviceNotAvailableException | nếu kết nối với thiết bị bị mất và không thể khôi phục được. |
Xem thêm:
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
Phương pháp trình trợ giúp xóa một phân vùng cho thiết bị.
NếugetUseFastbootErase()
là true
, thì 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ị. Nếu không, định dạng fastboot được sử dụng sẽ tạo ra 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ế độ khởi động nhanh.Thông số | |
---|---|
partition | String : phân vùng cần xóa |
Lợi nhuận | |
---|---|
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ể khôi phục được. |
getApiLevel
public abstract int getApiLevel ()
Nhận Cấp API thiết bị. Mặc định là UNKNOWN_API_LEVEL
.
Lợi nhuận | |
---|---|
int | một số nguyên cho biết Cấp API của thiết bị |
Ném | |
---|---|
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
Phương pháp thuận tiện để lấy phiên bản băng tần cơ sở (radio) của thiết bị này. Việc tải phiên bản radio dành riêng cho thiết bị, vì vậy, nó 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 thức này dựa vào đề xuất 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
.
Lợi nhuận | |
---|---|
String | phiên bản dải cơ sở String hoặc null nếu nó không thể được xác định (thiết bị không có đài 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ể khôi phục được. |
getBattery
public abstract Integer getBattery ()
Trả về mức pin hiện tại của thiết bị hoặc Null nếu mức pin không khả dụng.
Lợi nhuận | |
---|---|
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 tài sản |
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. |
Lợi nhuận | |
---|---|
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.
Lợi nhuận | |
---|---|
Bản đồ thời gian khởi động (thời gian UTC tính bằng giây kể từ Kỷ nguyên) và lý do khởi động |
Ném | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Phương thức 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 nhất định kể từ kỷ nguyên từ thiết bị và đơn vị thời gian được chỉ định. 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 của thiết bị kể từ Epoch. |
timeUnit | TimeUnit : đơn vị thời gian TimeUnit . |
Lợi nhuận | |
---|---|
Bản đồ thời gian khởi động (thời gian UTC tính bằng giây kể từ Kỷ nguyên) và lý do khởi động |
Ném | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
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ị. (tức là nếu thiết bị ở chế độ khởi động nhanh, nó sẽ cố gắng truy xuất phiên bản từ fastboot)Lợi nhuận | |
---|---|
String | phiên bản bộ nạp khởi động 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ể khôi phục được. |
getBugreport
public abstract InputStreamSource getBugreport ()
Truy xuất báo cáo lỗi từ thiết bị.
Việc thực hiện điều này được đảm bảo tiếp tục hoạt động trên thiết bị không có thẻ sdcard (hoặc nơi thẻ sdcard chưa được gắn kết).Lợi nhuận | |
---|---|
InputStreamSource | InputStreamSource sẽ tạo ra nội dung báo cáo lỗi theo yêu cầu. Trong trường hợp không thành công, InputStreamSource sẽ tạo ra một ERROR(/InputStream) . |
getBugreportz
public abstract InputStreamSource getBugreportz ()
Truy xuất báo cáo lỗi từ thiết bị. Báo cáo lỗi định dạng zip chứa báo cáo lỗi chính và các tệp nhật ký khác hữu ích cho việc gỡ lỗi.
Chỉ hỗ trợ cho 'phiên bản adb'> 1.0.36Lợi nhuận | |
---|---|
InputStreamSource | a InputStreamSource của tệp zip chứa bugreportz, trả về null trong trường hợp không thành công. |
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 các 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 JDQ39 và bản dựng id 573038
Lợi nhuận | |
---|---|
String | bí danh bản dựng hoặc quay lại mã bản dựng nếu không thể truy xuất nó |
Ném | |
---|---|
DeviceNotAvailableException |
getBuildFlavor
public abstract String getBuildFlavor ()
Truy xuất hương vị xây dựng cho thiết bị.
Lợi nhuận | |
---|---|
String | hương vị xây dựng hoặc null nếu nó không thể được truy xuất |
Ném | |
---|---|
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Truy xuất bản dựng mà thiết bị hiện đang chạy.
Lợi nhuận | |
---|---|
String | id bản dựng hoặc IBuildInfo#UNKNOWN_BUILD_ID nếu không thể truy xuất được |
Ném | |
---|---|
DeviceNotAvailableException |
getBuildSagingKeys
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 (được kiểm soát bởi các nhà sản xuất thiết bị riêng lẻ)
Lợi nhuận | |
---|---|
String | Khóa ký nếu được tìm thấy, nếu không thì vô hiệu. |
Ném | |
---|---|
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Trả về DeviceDescriptor
lưu trong bộ nhớ cache nếu thiết bị được cấp phát, nếu không sẽ trả về DeviceDescriptor
hiện tại.
Lợi nhuận | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Trả về DeviceDescriptor
lưu trong bộ nhớ cache nếu thiết bị được cấp phát, nếu không sẽ trả về DeviceDescriptor
hiện tại.
Thông số | |
---|---|
shortDescriptor | boolean : Có hay không giới hạn bộ mô tả ở thông tin tối thiểu |
Lợi nhuận | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
Thay thế cho việc sử dụng IFileEntry
đôi khi không hoạt động vì quyền.
Thông số | |
---|---|
deviceFilePath | String : là đường dẫn trên thiết bị để thực hiện tìm kiếm |
Lợi nhuận | |
---|---|
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 | |
---|---|
DeviceNotAvailableException |
getDeviceClass
public abstract String getDeviceClass ()
Nhận loại thiết bị.
Lợi nhuận | |
---|---|
String | lớp thiết bị String . |
getDeviceDate
public abstract long getDeviceDate ()
Trả lại ngày của thiết bị trong mili giây kể từ kỷ nguyên.
Lợi nhuận | |
---|---|
long | ngày của thiết bị ở định dạng kỷ nguyên. |
Ném | |
---|---|
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Trả lại DeviceDescriptor
từ thông tin thiết bị để lấy thông tin về nó mà không cần chuyển đối tượng thiết bị thực tế.
Lợi nhuận | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Trả lại DeviceDescriptor
từ thông tin thiết bị để lấy thông tin về nó mà không cần 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ả ở thông tin tối thiểu |
Lợi nhuận | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Nhận trạng thái của thiết bị.
Lợi nhuận | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Người trợ giúp nhận được chênh lệch thời gian giữa thiết bị và một ERROR(/Date)
nhất định. Sử dụng thời gian Epoch trong nội bộ.
Thông số | |
---|---|
date | Date |
Lợi nhuận | |
---|---|
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 stdout và stderr
Lợi nhuận | |
---|---|
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ị.
Lợi nhuận | |
---|---|
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ể khôi phục được. |
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 nó ở chế độ khởi động nhanh.
Phương pháp này chỉ nên được sử dụng nếu thiết bị phải ở chế độ khởi động nhanh. Biến thể của nó an toàn hơn một chút so với phương thứcgetProductType()
chung trong trường hợp này, vì ITestDevice sẽ biết cách khôi phục thiết bị vào fastboot nếu thiết bị ở trạng thái không chính xác hoặc không phản hồi.Lợi nhuận | |
---|---|
String | tên loại sản phẩm String hoặc null nếu không thể 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ể khôi phục được. |
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 nó ở chế độ khởi động nhanh.
Phương pháp này chỉ nên được sử dụng nếu thiết bị phải ở chế độ khởi động nhanh. Biến thể của nó an toàn hơn một chút so với phương thứcgetProductType()
chung trong trường hợp này, vì ITestDevice sẽ biết cách khôi phục thiết bị vào fastboot nếu thiết bị ở trạng thái không chính xác hoặc không phản hồi.Lợi nhuận | |
---|---|
String | tên loại sản phẩm String hoặc null nếu không thể 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ể khôi phục được. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Trả về số sê-ri của chế độ fastboot.
Lợi nhuận | |
---|---|
String |
getFastbootVariable
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 |
Lợi nhuận | |
---|---|
String | giá trị thuộc tính hoặc null nếu nó không tồn tại |
Ném | |
---|---|
| Không được hỗ trợOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
Truy xuất tham chiếu đến một tệp từ xa trên thiết bị.
Thông số | |
---|---|
path | String : đường dẫn tập tin cần lấy. Có thể là một đườ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ợ) |
Lợi nhuận | |
---|---|
IFileEntry | IFileEntry hoặc null nếu không tìm thấy tệp ở path đã cho |
Ném | |
---|---|
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Trả về một tham chiếu đến IDevice IDevice
được liên kết.
IDevice
mới có thể được DDMS cấp phát mỗi khi thiết bị ngắt kết nối và kết nối lại từ adb. Vì vậy, người gọi không nên giữ một tham chiếu đến IDevice
, vì tham chiếu đó có thể trở nên cũ.Lợi nhuận | |
---|---|
IDevice | IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Trả về giá trị số nguyên của thuộc tính đã cho từ thiết bị.
Thông số | |
---|---|
name | String : tên tài sản |
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. |
Lợi nhuận | |
---|---|
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 |
getLastEosystemRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Trả về lần cuối cùng các API Tradefed kích hoạt khởi động lại trong mili giây kể từ EPOCH như được trả về bởi System.currentTimeMillis()
.
Lợi nhuận | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Nhận Cấp API được khởi chạy đầu tiên của thiết bị. Mặc định là UNKNOWN_API_LEVEL
.
Lợi nhuận | |
---|---|
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 | |
---|---|
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 chụp logcat nềnLợi nhuận | |
---|---|
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 đã thu được.
Hữu ích cho các trường hợp khi bạn muốn chụp nhanh thường xuyên dữ liệu logcat đã chụp mà không phải chịu hình phạt về 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 : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
Lợi nhuận | |
---|---|
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.
Lợi nhuận | |
---|---|
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') |
Lợi nhuận | |
---|---|
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)
Thông số | |
---|---|
mountName | String : the name of the mount point |
Lợi nhuận | |
---|---|
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.
Thông số | |
---|---|
mountpoint | String |
Lợi nhuận | |
---|---|
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
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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. |
Lợi nhuận | |
---|---|
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. |
Lợi nhuận | |
---|---|
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.Lợi nhuận | |
---|---|
String | the 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.Lợi nhuận | |
---|---|
String | the 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 |
Lợi nhuận | |
---|---|
String | the property value or null if it does not exist |
Ném | |
---|---|
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
Lợi nhuận | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
Lợi nhuận | |
---|---|
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.
Lợi nhuận | |
---|---|
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
Lợi nhuận | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
Lợi nhuận | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
Lợi nhuận | |
---|---|
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 ()
Lợi nhuận | |
---|---|
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
Lợi nhuận | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Ném | |
---|---|
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
boolean |
Ném | |
---|---|
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
Lợi nhuận | |
---|---|
boolean | true if the device supports encryption. |
Ném | |
---|---|
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 |
Lợi nhuận | |
---|---|
boolean |
Ném | |
---|---|
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
Lợi nhuận | |
---|---|
boolean |
Ném | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
Lợi nhuận | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Ném | |
---|---|
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
Lợi nhuận | |
---|---|
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. |
Lợi nhuận | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Ném | |
---|---|
DeviceNotAvailableException |
logBugreport
public abstract boolean logBugreport (String dataName, ITestLogger listener)
Helper method to take a bugreport and log it to the reporters.
Thông số | |
---|---|
dataName | String : name under which the bugreport will be reported. |
listener | ITestLogger : an ITestLogger to log the bugreport. |
Lợi nhuận | |
---|---|
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.
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 | |
---|---|
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 |
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 |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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. |
Lợi nhuận | |
---|---|
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. |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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. |
Lợi nhuận | |
---|---|
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) |
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 |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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 | |
---|---|
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Ném | |
---|---|
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) |
Lợi nhuận | |
---|---|
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 |
Lợi nhuận | |
---|---|
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, 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 |
Lợi nhuận | |
---|---|
boolean |
Ném | |
---|---|
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.
Thông số | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
Lợi nhuận | |
---|---|
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 | |
---|---|
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. |
Lợi nhuận | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Ném | |
---|---|
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.
Lợi nhuận | |
---|---|
String | the tcp serial number or null if device could not be switched |
Ném | |
---|---|
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
Lợi nhuận | |
---|---|
boolean | true if switch was successful, false otherwise. |
Ném | |
---|---|
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 |
Lợi nhuận | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Ném | |
---|---|
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()
.Lợi nhuận | |
---|---|
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.Lợi nhuận | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Ném | |
---|---|
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.
Thông số | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
Lợi nhuận | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Ném | |
---|---|
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
Lợi nhuận | |
---|---|
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. |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
Thông số | |
---|---|
waitTime | long : the time in ms to wait |
Lợi nhuận | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Ném | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
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 : the time in ms to wait |
Lợi nhuận | |
---|---|
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
Thông số | |
---|---|
waitTime | long : the time in ms to wait |
Lợi nhuận | |
---|---|
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
Thông số | |
---|---|
waitTime | long : the time in ms to wait |
Lợi nhuận | |
---|---|
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.Ném | |
---|---|
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.Thông số | |
---|---|
waitTime | long : the time in ms to wait |
Ném | |
---|---|
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.
Thông số | |
---|---|
waitTime | long : the time in ms to wait |
Lợi nhuận | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |