Google cam kết thúc đẩy công bằng chủng tộc cho Cộng đồng người da đen. Xem cách thực hiện.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.

NativeDevice

public class NativeDevice
extends Object implements IManagedTestDevice , IConfigurationReceiver

java.lang.Object
com.android.tradefed.device.NativeDevice


Triển khai mặc định của một thiết bị Android không đầy đủ ngăn xếp ITestDevice .

Bản tóm tắt

Các lớp lồng nhau

class NativeDevice.AdbAction

Một DeviceAction để chạy lệnh OS 'adb ....'.

class NativeDevice.AdbShellAction

class NativeDevice.RebootDeviceAction

DeviceAction để khởi động lại thiết bị.

enum NativeDevice.RebootMode

Một chế độ khởi động lại.

Hằng số

int INVALID_USER_ID

Giá trị được trả về cho bất kỳ id người dùng không hợp lệ / không tìm thấy: UserHandle đã xác định giá trị -10000

long MAX_HOST_DEVICE_TIME_OFFSET

int MAX_RETRY_ATTEMPTS

số lần thử lại lệnh mặc định để thực hiện

Lĩnh vực

protected static final String SD_CARD

protected static final String STORAGE_EMULATED

protected TestDeviceOptions mOptions

protected final IDeviceStateMonitor mStateMonitor

Các nhà xây dựng công cộng

NativeDevice (IDevice device, IDeviceStateMonitor stateMonitor, IDeviceMonitor allocationMonitor)

Tạo một TestDevice .

Phương pháp công khai

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.

boolean checkConnectivity ()

Kiểm tra xem thiết bị có kết nối mạng không.

boolean clearErrorDialogs ()

Cố gắng loại bỏ bất kỳ hộp thoại lỗi nào hiện được hiển thị trên giao diện người dùng của thiết bị.

void clearLastConnectedWifiNetwork ()

Xóa mạng wifi được kết nối gần đây nhất.

void clearLogcat ()

Xóa mọi dữ liệu logcat đã tích lũy.

boolean connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid) connectToWifiNetwork ( wifiSsidToPsk, boolean scanSsid)

Kết nối với mạng wifi.

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk)

Kết nối với mạng wifi.

boolean connectToWifiNetwork ( wifiSsidToPsk) connectToWifiNetwork ( wifiSsidToPsk)

Kết nối với mạng wifi.f

boolean connectToWifiNetwork (String wifiSsid, String wifiPsk, boolean scanSsid)

Kết nối với mạng wifi.

boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk, boolean scanSsid)

Một biến thể của connectToWifiNetwork(String, String) chỉ kết nối nếu thiết bị hiện không có kết nối mạng.

boolean connectToWifiNetworkIfNeeded (String wifiSsid, String wifiPsk)

Một biến thể của connectToWifiNetwork(String, String) chỉ kết nối nếu thiết bị hiện không có kết nối mạng.

int createUser (String name, boolean guest, boolean ephemeral)

Tạo người dùng với tên đã cho và các cờ được cung cấp

int createUser (String name)

Tạo người dùng với tên đã cho và các cờ mặc định 0.

int createUserNoThrow (String name)

Tạo người dùng với tên đã cho và các cờ mặc định 0.

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ị.

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 đó.

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ị.

boolean disableAdbRoot ()

Tắt adb root.

void disableKeyguard ()

Cố gắng tắt khóa phím.

boolean disableNetworkMonitor ()

Tắt tính năng giám sát mạng trên thiết bị.

boolean disconnectFromWifi ()

Ngắt kết nối khỏi mạng Wi-Fi.

boolean doesFileExist (String deviceFilePath, int userId)

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 cho một người dùng nhất định hay không.

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.

File dumpHeap (String process, String devicePath)

Cố gắng kết xuất đống từ system_server.

boolean enableAdbRoot ()

Bật adb root.

boolean enableNetworkMonitor ()

Cho phép giám sát mạng trên thiết bị.

String executeAdbCommand (long timeout, String... cmdArgs)

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.

String executeAdbCommand (String... cmdArgs)

Phương thức trợ giúp thực thi lệnh adb dưới dạng lệnh hệ thống.

CommandResult executeFastbootCommand (String... cmdArgs)

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.

CommandResult executeFastbootCommand (long timeout, String... cmdArgs)

Phương thức trợ giúp thực thi lệnh fastboot dưới dạng lệnh hệ thống.

CommandResult executeLongFastbootCommand ( envVarMap, String... cmdArgs) executeLongFastbootCommand ( envVarMap, String... cmdArgs)

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.

CommandResult executeLongFastbootCommand (String... cmdArgs)

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.

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 .

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.

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.

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.

CommandResult executeShellV2Command (String cmd)

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.

CommandResult executeShellV2Command (String cmd, 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.

CommandResult executeShellV2Command (String cmd, 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.

CommandResult executeShellV2Command (String cmd, 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.

CommandResult executeShellV2Command (String cmd, 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.

CommandResult executeShellV2Command (String cmd, 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.

CommandResult executeShellV2Command (String cmd, 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.

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ị.

getActiveApexes ()

Tìm nạp thông tin về các APEX được kích hoạt trên thiết bị.

getAllSettings (String namespace)

Trả về các cặp giá trị khóa của không gian tên được yêu cầu.

DeviceAllocationState getAllocationState ()

Trả lại trạng thái phân bổ hiện tại của thiết bị

String getAndroidId (int userId)

Tìm và trả về android-id được liên kết với userId, null nếu không tìm thấy.

getAndroidIds ()

Tạo Bản đồ các id android được tìm thấy phù hợp với id người dùng.

int getApiLevel ()

Nhận Cấp API thiết bị.

PackageInfo getAppPackageInfo (String packageName)

Tìm nạp thông tin về gói được cài đặt trên thiết bị.

getAppPackageInfos ()

Tìm nạp thông tin của các gói được cài đặt trên thiết bị.

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.

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.

boolean getBooleanProperty (String name, boolean defaultValue)

Trả về giá trị boolean của thuộc tính đã cho.

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.

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.

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.

InputStreamSource getBugreport ()

Truy xuất báo cáo lỗi từ thiết bị.

InputStreamSource getBugreportz ()

Truy xuất báo cáo lỗi từ thiết bị.

String getBuildAlias ()

Truy xuất bí danh của bản dựng mà thiết bị hiện đang chạy.

String getBuildFlavor ()

Truy xuất hương vị xây dựng cho thiết bị.

String getBuildId ()

Truy xuất bản dựng mà thiết bị hiện đang chạy.

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

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.

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.

String[] getChildren (String path)

Thay thế cho việc sử dụng IFileEntry đôi khi không hoạt động vì quyền.

DeviceFoldableState getCurrentFoldableState ()

Trả về trạng thái có thể gập lại hiện tại của thiết bị hoặc null nếu xảy ra một số sự cố.

int getCurrentUser ()

Trả lại id của người dùng đang chạy hiện tại.

String getDeviceClass ()

Nhận loại thiết bị.

long getDeviceDate ()

Trả lại ngày của thiết bị trong mili giây kể từ kỷ nguyên.

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ế.

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ế.

TestDeviceState getDeviceState ()

Nhận trạng thái của thiết bị.

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.

InputStreamSource getEmulatorOutput ()

Nhận luồng trình giả lập stdout và stderr

Process getEmulatorProcess ()

Trả lại Process tương ứng với trình giả lập này.

final File getExecuteShellCommandLog ()

Nhật ký chứa tất cả các nhật ký executeShellCommand(String) .

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ị.

String getFastbootPath ()

Trả về đường dẫn của tệp nhị phân fastboot đang được sử dụng.

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.

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.

String getFastbootSerialNumber ()

Trả về số sê-ri của chế độ fastboot.

String getFastbootVariable (String variableName)

Truy xuất giá trị biến fastboot đã cho từ thiết bị.

String getFastbootVersion ()

Trả về chuỗi phiên bản của tệp nhị phân fastboot đang được sử dụng.

IFileEntry getFileEntry (String path)

Truy xuất tham chiếu đến một tệp từ xa trên thiết bị.

IFileEntry getFileEntry (FileListingService.FileEntry entry)

Người trợ giúp không chính thức để lấy FileEntry từ một đường dẫn không phải root.

getFoldableStates ()

Trả về danh sách các trạng thái có thể gập lại trên thiết bị.

IDevice getIDevice ()

Trả về một tham chiếu đến IDevice IDevice được liên kết.

getInstalledPackageNames ()

Tìm nạp các tên gói ứng dụng có trên thiết bị.

long getIntProperty (String name, long defaultValue)

Trả về giá trị số nguyên của thuộc tính đã cho từ thiết bị.

String getIpAddress ()

Nhận địa chỉ IP của thiết bị.

KeyguardControllerState getKeyguardState ()

Trả về một đối tượng để có được trạng thái hiện tại của keyguard hoặc null nếu không được hỗ trợ.

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

int getLaunchApiLevel ()

Nhận Cấp API được khởi chạy đầu tiên của thiết bị.

InputStreamSource getLogcat ()

Lấy một luồng ảnh chụp nhanh của dữ liệu logcat.

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.

InputStreamSource getLogcatDump ()

Nhận bản kết xuất của logcat hiện tại cho thiết bị.

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.

String getMacAddress ()

Trả về địa chỉ MAC của thiết bị, null nếu nó không truy vấn được từ thiết bị.

getMainlineModuleInfo ()

Nhận thông tin về các mô-đun dòng chính được cài đặt trên thiết bị.

int getMaxNumberOfRunningUsersSupported ()

Nhận số lượng người dùng chạy đồng thời tối đa được hỗ trợ.

int getMaxNumberOfUsersSupported ()

Nhận số lượng người dùng được hỗ trợ tối đa.

IDeviceStateMonitor getMonitor ()

Trả lại IDeviceStateMonitor liên kết với thiết bị.

String getMountPoint (String mountName)

Trả về điểm gắn kết.

ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

Trả về MountPointInfo tương ứng với đường dẫn điểm gắn kết được chỉ định hoặc null nếu đường dẫn đó không có gì được gắn kết hoặc không xuất hiện trong / proc / mounts dưới dạng điểm gắn kết.

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ị

TestDeviceOptions getOptions ()

Tìm nạp các tùy chọn kiểm tra cho thiết bị.

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ị.

Integer getPrimaryUserId ()

Trả về id người dùng chính.

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 ProcessInfo với PID và thời gian bắt đầu quá trình của quá trình đã cho.

String getProcessPid (String process)

Trả về pid của dịch vụ hoặc null nếu có sự cố.

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.

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.

String getProperty (String name)

Lấy giá trị thuộc tính đã cho từ thiết bị.

ITestDevice.RecoveryMode getRecoveryMode ()

Nhận chế độ khôi phục hiện tại được sử dụng cho thiết bị.

InputStreamSource getScreenshot (String format)

Lấy ảnh chụp màn hình từ thiết bị.

InputStreamSource getScreenshot (long displayId)

Lấy ảnh chụp màn hình từ id hiển thị của thiết bị.

InputStreamSource getScreenshot (String format, boolean rescale)

Lấy ảnh chụp màn hình từ thiết bị.

InputStreamSource getScreenshot ()

Lấy ảnh chụp màn hình từ thiết bị.

String getSerialNumber ()

Phương pháp thuận tiện để lấy số sê-ri của thiết bị này.

String getSetting (int userId, String namespace, String key)

Trả lại giá trị của cài đặt được yêu cầu.

String getSetting (String namespace, String key)

Xem getSetting(int, String, String) và được thực hiện trên người dùng hệ thống.

String getSimOperator ()

Trả lại nhà khai thác thẻ SIM hoặc null nếu không có sẵn hoặc nếu thiết bị không khả dụng.

String getSimState ()

Trả lại trạng thái thẻ SIM hoặc trống nếu không có hoặc thiết bị không khả dụng.

getTombstones ()

Tìm nạp và trả lại danh sách bia mộ từ các thiết bị.

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ộ

getUninstallablePackageNames ()

Tìm nạp các tên gói ứng dụng có thể được gỡ cài đặt.

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ị.

int getUserFlags (int userId)

Tìm và trả về các cờ của một người dùng nhất định.

getUserInfos ()

Nhận Map of useId thành UserInfo trên thiết bị.

int getUserSerialNumber (int userId)

Trả lại số sê-ri được liên kết với userId nếu tìm thấy, -10000 trong bất kỳ trường hợp nào khác.

IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

Xử lý DeviceEvent cho.

Xử lý DeviceEvent, có thể có hoặc không chuyển thiết bị này sang trạng thái cấp phát mới.

boolean hasFeature (String feature)

Kiểm tra xem một tính năng có sẵn trên thiết bị hay không.

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

Cài đặt gói Android trên thiết bị.

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

Cài đặt gói Android trên thiết bị.

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

Cài đặt gói Android trên thiết bị cho một người dùng nhất định.

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

Cài đặt gói Android trên thiết bị cho một người dùng nhất định.

boolean isAdbRoot ()

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

boolean isDeviceEncrypted ()

Trả về nếu thiết bị được mã hóa.

boolean isDirectory (String path)

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.

boolean isEnableAdbRoot ()
boolean isEncryptionSupported ()

Trả về nếu mã hóa được hỗ trợ trên thiết bị.

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.

boolean isFastbootEnabled ()

Quay lại nếu fastboot có sẵn cho thiết bị.

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.

boolean isMultiUserSupported ()

Xác định xem có hỗ trợ nhiều người dùng hay không.

boolean isPackageInstalled (String packageName, String userId)

Truy vấn thiết bị để biết tên gói nhất định và id người dùng đã cho để kiểm tra xem thiết bị hiện đã được cài đặt hay chưa cho người dùng đó.

boolean isPackageInstalled (String packageName)

Truy vấn thiết bị cho một tên gói nhất định để kiểm tra xem nó hiện đã được cài đặt hay chưa.

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

boolean isStateBootloaderOrFastbootd ()

Trả về true nếu thiết bị ở trong TestDeviceState#FASTBOOT hoặc TestDeviceState.FASTBOOTD .

boolean isUserRunning (int userId)

Kiểm tra xem một người dùng nhất định có đang chạy hay không.

boolean isUserSecondary (int userId)

Trả lại xem người dùng được chỉ định có phải là người dùng phụ hay không theo các cờ của nó.

boolean isWifiEnabled ()

Kiểm tra xem đã bật wifi chưa.

listDisplayIds ()

Thu thập danh sách id hiển thị có sẵn trên thiết bị như được báo cáo bởi "bãi bỏ SurfaceFlinger".

listUsers ()

Nhận danh sách người dùng trên thiết bị.

boolean logAnrs ( ITestLogger logger)

Thu thập và ghi lại các ANR từ thiết bị.

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.

void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)

Ghi một tin nhắn vào logcat của thiết bị.

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.

void postAdbRootAction ()

Ghi đè nếu thiết bị cần thực hiện một số hành động cụ thể sau khi root adb và trước khi thiết bị trực tuyến trở lại.

void postAdbUnrootAction ()

Ghi đè nếu thiết bị cần thực hiện một số hành động cụ thể sau khi adb unroot và trước khi thiết bị trực tuyến trở lại.

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.

void postInvocationTearDown (Throwable exception)

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.

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.

boolean pullDir (String deviceFilePath, File localDir)

Đệ quy kéo nội dung thư mục từ thiết bị.

boolean pullFile (String remoteFilePath, File localFile)

Truy xuất tệp từ thiết bị.

File pullFile (String remoteFilePath, int userId)

Truy xuất tệp khỏi thiết bị, lưu trữ tệp đó trong ERROR(/File) và trả lại File đó.

File pullFile (String remoteFilePath)

Truy xuất tệp khỏi thiết bị, lưu trữ tệp đó trong ERROR(/File) và trả lại File đó.

boolean pullFile (String remoteFilePath, File localFile, int userId)

Truy xuất tệp từ thiết bị.

String pullFileContents (String remoteFilePath)

Truy xuất tệp khỏi thiết bị và trả về nội dung.

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 ERROR(/File) và trả về tham chiếu đến File đó.

boolean pushDir (File localFileDir, String deviceFilePath, excludedDirectories) pushDir (File localFileDir, 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.

boolean pushDir (File localFileDir, String deviceFilePath)

Đệ quy đẩy nội dung thư mục vào thiết bị.

boolean pushFile (File localFile, String remoteFilePath, boolean evaluateContentProviderNeeded)

Biến thể của pushFile(File, String) có thể tùy ý xem xét đánh giá nhu cầu đối với nhà cung cấp nội dung.

boolean pushFile (File localFile, String remoteFilePath)

Đẩy tệp vào thiết bị.

boolean pushString (String contents, String remoteFilePath)

Đẩy tệp được tạo từ một chuỗi sang thiết bị

void reboot (String reason)

Khởi động lại thiết bị ở chế độ adb với reason nhất định để tiếp tục khởi động lại.

void reboot ()

Khởi động lại thiết bị ở chế độ adb.

void rebootIntoBootloader ()

Khởi động lại thiết bị ở chế độ bộ nạp khởi động.

void rebootIntoFastbootd ()

Khởi động lại thiết bị vào chế độ fastbootd.

void rebootIntoRecovery ()

Khởi động lại thiết bị vào chế độ khôi phục adb.

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

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

void rebootUntilOnline ()

Một thay thế để reboot() chỉ chặn cho đến khi thiết bị trực tuyến tức là hiển thị cho adb.

void rebootUntilOnline (String reason)

Một thay thế để reboot() chỉ chặn cho đến khi thiết bị trực tuyến tức là hiển thị cho adb.

void rebootUserspace ()

Chỉ khởi động lại phần không gian người dùng của thiết bị.

void rebootUserspaceUntilOnline ()

Một thay thế để rebootUserspace() ()} chỉ chặn cho đến khi thiết bị trực tuyến tức là hiển thị cho adb.

boolean recoverDevice ()

Cố gắng khôi phục giao tiếp của thiết bị.

void remountSystemWritable ()

Làm cho phân vùng hệ thống trên thiết bị có thể ghi được.

void remountVendorWritable ()

Làm cho phân vùng của nhà cung cấp trên thiết bị có thể ghi được.

boolean removeAdmin (String componentName, int userId)

Xóa quản trị viên thiết bị đã cho ở người dùng nhất định và trả về true nếu thành công, ngược lại là false .

void removeOwners ()

Xóa tất cả chủ sở hữu hồ sơ thiết bị hiện có bằng nỗ lực cao nhất.

boolean removeUser (int userId)

Xóa một người dùng nhất định khỏi thiết bị.

void resetContentProviderSetup ()

Đặt lại cờ cho thiết lập nhà cung cấp nội dung để kích hoạt lại.

boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)

Phương pháp thuận tiện để thực hiện ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) với một hoặc nhiều trình nghe được truyền dưới dạng tham số.

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ị.

boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)

Tương tự như ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...) nhưng chạy thử nghiệm cho một người dùng nhất định.

boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners)

Giống như ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)) cho người dùng nhất định.

void setConfiguration ( IConfiguration configuration)

IConfiguration đang sử dụng.

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

boolean setDeviceOwner (String componentName, int userId)

Đặt thành phần quản trị thiết bị làm chủ sở hữu thiết bị trong người dùng nhất định.

void setDeviceState ( TestDeviceState deviceState)

Cập nhật trạng thái của thiết bị.

void setEmulatorOutputStream ( SizeLimitedOutputStream output)

Đối với trình giả lập, hãy đặt SizeLimitedOutputStream để ghi đầu ra

void setEmulatorProcess (Process p)

Đặt Process , khi thiết bị này là một trình giả lập.

void setFastbootEnabled (boolean fastbootEnabled)

Đặt tùy chọn fastboot cho thiết bị.

void setFastbootPath (String fastbootPath)

Đặt đường dẫn đến tệp nhị phân fastboot sẽ được sử dụng.

void setIDevice (IDevice newDevice)

Cập nhật IDevice được liên kết với ITestDevice này.

void setOptions ( TestDeviceOptions options)

Đặt TestDeviceOptions cho thiết bị

boolean setProperty (String propKey, String propValue)

Đặt giá trị thuộc tính đã cho trên thiết bị.

void setRecovery ( IDeviceRecovery recovery)

Đặt IDeviceRecovery để sử dụng cho thiết bị này.

void setRecoveryMode ( ITestDevice.RecoveryMode mode)

Đặt chế độ khôi phục hiện tại để sử dụng cho thiết bị.

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

Xem setSetting(int, String, String, String) và được thực hiện trên người dùng hệ thống.

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

Thêm giá trị cài đặt vào không gian tên của một người dùng nhất định.

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ị.

void startLogcat ()

Bắt đầu ghi lại đầu ra logcat từ thiết bị ở chế độ nền.

boolean startUser (int userId)

Bắt đầu một người dùng nhất định trong nền nếu nó hiện đang bị dừng.

boolean startUser (int userId, boolean waitFlag)

Bắt đầu một người dùng nhất định trong nền nếu nó hiện đang bị dừng.

void stopEmulatorOutput ()

Đóng và xóa đầu ra trình giả lập.

void stopLogcat ()

Dừng chụp đầu ra logcat từ thiết bị và hủy dữ liệu logcat hiện đã lưu.

boolean stopUser (int userId)

Dừng một người dùng nhất định.

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

Dừng một người dùng nhất định.

String switchToAdbTcp ()

Chuyển thiết bị sang chế độ adb-over-tcp.

boolean switchToAdbUsb ()

Chuyển thiết bị sang chế độ adb qua usb.

boolean switchUser (int userId)

Chuyển sang userId khác với thời gian chờ mặc định.

boolean switchUser (int userId, long timeout)

Chuyển sang userId khác với thời gian chờ được cung cấp làm thời hạn.

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ị.

Bugreport takeBugreport ()

Thực hiện một báo cáo lỗi và trả về bên trong một Bugreport tượng Báo cáo lỗi để xử lý nó.

String uninstallPackage (String packageName)

Gỡ cài đặt gói Android khỏi thiết bị.

String uninstallPackageForUser (String packageName, int userId)

Gỡ cài đặt gói Android khỏi thiết bị cho một người dùng nhất định.

boolean unlockDevice ()

Mở khóa thiết bị nếu thiết bị ở trạng thái được mã hóa.

boolean waitForBootComplete (long timeOut)

Chặn cho đến khi cờ hoàn thành khởi động của thiết bị được đặt.

boolean waitForDeviceAvailable ()

Chờ thiết bị phản hồi và có sẵn để thử nghiệm.

boolean waitForDeviceAvailable (long waitTime)

Chờ thiết bị phản hồi và có sẵn để thử nghiệm.

void waitForDeviceBootloader ()

Chặn cho đến khi thiết bị hiển thị qua fastboot.

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 IDeviceRecovery ).

boolean waitForDeviceInSideload (long waitTime)

Các khối để thiết bị ở trạng thái 'adb sideload'

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

void waitForDeviceOnline ()

Chặn cho đến khi thiết bị hiển thị qua adb.

void waitForDeviceOnline (long waitTime)

Chặn cho đến khi thiết bị hiển thị qua adb.

boolean waitForDeviceShell (long waitTime)

Chờ thiết bị phản hồi với lệnh adb shell cơ bản.

Các phương pháp được bảo vệ

void checkApiLevelAgainst (String feature, int strictMinLevel)
NativeDevice.RebootDeviceAction createRebootDeviceAction ( NativeDevice.RebootMode rebootMode, String reason)

Tạo RebootDeviceAction để sử dụng khi thực hiện hành động khởi động lại.

void doAdbReboot ( NativeDevice.RebootMode rebootMode, String reason)

Thực hiện khởi động lại adb.

void ensureRuntimePermissionSupported ()

phương thức trợ giúp để ném ngoại lệ nếu quyền thời gian chạy không được hỗ trợ

InputStreamSource getBugreportInternal ()
File getBugreportzInternal ()

Phương pháp Trình trợ giúp nội bộ để lấy tệp zip bugreportz dưới dạng ERROR(/File) .

IRunUtil getRunUtil ()

Lấy phiên bản RunUtil để sử dụng.

String internalGetProperty (String propName, String fastbootVar, String description)

Tìm nạp một thuộc tính thiết bị, từ bộ nhớ cache ddmlib theo mặc định và quay trở lại `adb shell getprop` hoặc` fastboot getvar` tùy thuộc vào việc thiết bị có ở trong Fastboot hay không.

boolean isNewer (File localFile, IFileEntry entry)

Trả về true nếu tệp cục bộ mới hơn tệp từ xa.

boolean performDeviceAction (String actionDescription, com.android.tradefed.device.NativeDevice.DeviceAction action, int retryAttempts)

Thực hiện một hành động trên thiết bị này.

void postAdbReboot ()

Các hành động bổ sung có thể được thực hiện sau khi khởi động lại.

void prePostBootSetup ()

Cho phép từng loại thiết bị (AndroidNativeDevice, TestDevice) ghi đè phương pháp này để thiết lập khởi động bài đăng cụ thể.

boolean pullFileInternal (String remoteFilePath, File localFile)
void setClock (Clock clock)

Đặt phiên bản Đồng hồ để sử dụng.

void setLogStartDelay (int delay)

Đặt thời gian chờ tính bằng mili giây trước khi bắt đầu chụp logcat cho thiết bị trực tuyến.

CommandResult simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd) simpleFastbootCommand (long timeout, envVarMap, String[] fullCmd)

Thực hiện một lệnh fastboot đơn giản với các biến môi trường và báo cáo trạng thái của lệnh.

CommandResult simpleFastbootCommand (long timeout, String[] fullCmd)

Thực hiện một lệnh fastboot đơn giản và báo cáo trạng thái của lệnh.

boolean waitForDeviceNotAvailable (String operationDesc, long time)

Chờ xem thiết bị không sử dụng được (ngừng báo cáo với adb).

Hằng số

ID NGƯỜI DÙNG KHÔNG HỢP LỆ

public static final int INVALID_USER_ID

Giá trị được trả về cho bất kỳ id người dùng không hợp lệ / không tìm thấy: UserHandle đã xác định giá trị -10000

Giá trị không đổi: -10000 (0xffffd8f0)

MAX_HOST_DEVICE_TIME_OFFSET

protected static final long MAX_HOST_DEVICE_TIME_OFFSET

Giá trị không đổi: 5000 (0x0000000000001388)

MAX_RETRY_ATTEMPTS

protected static final int MAX_RETRY_ATTEMPTS

số lần thử lại lệnh mặc định để thực hiện

Giá trị không đổi: 2 (0x00000002)

Lĩnh vực

THẺ SD

protected static final String SD_CARD

STORAGE_EMULATED

protected static final String STORAGE_EMULATED

mOptions

protected TestDeviceOptions mOptions

mStateMonitor

protected final IDeviceStateMonitor mStateMonitor

Các nhà xây dựng công cộng

NativeDevice

public NativeDevice (IDevice device, 
                IDeviceStateMonitor stateMonitor, 
                IDeviceMonitor allocationMonitor)

Tạo một TestDevice .

Thông số
device IDevice : IDevice được liên kết

stateMonitor IDeviceStateMonitor : cơ chế IDeviceStateMonitor để sử dụng

allocationMonitor IDeviceMonitor : IDeviceMonitor để thông báo về các thay đổi trạng thái phân bổ. Có thể là rỗng

Phương pháp công khai

checkApiLevelAgainstNextRelease

public 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

checkConnectivity

public boolean checkConnectivity ()

Kiểm tra xem thiết bị có kết nối mạng không.

Lợi nhuận
boolean true nếu thiết bị có kết nối mạng đang hoạt động, ngược lại false .

Ném
DeviceNotAvailableException

clearErrorDialogs

public boolean clearErrorDialogs ()

Cố gắng loại bỏ bất kỳ hộp thoại lỗi nào hiện được hiển thị trên giao diện người dùng của thiết bị.

Lợi nhuận
boolean true nếu không có hộp thoại nào hoặc hộp thoại đã được xóa thành công. false nếu không.

Ném
DeviceNotAvailableException

clearLastConnectedWifiNetwork

public void clearLastConnectedWifiNetwork ()

Xóa mạng wifi được kết nối gần đây nhất. Điều này sẽ được gọi khi bắt đầu một lệnh gọi mới để tránh kết nối với mạng wifi được sử dụng trong thử nghiệm trước đó sau khi thiết bị khởi động lại.

clearLogcat

public 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ảo ITestDevice#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.).

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk, 
                boolean scanSsid)

Kết nối với mạng wifi.

Bật wifi và chặn cho đến khi kết nối thành công với một trong các mạng wifi được cung cấp trong bản đồ wifiSsidToPsk. Sau khi kết nối được thực hiện, phiên bản sẽ cố gắng khôi phục kết nối sau mỗi lần khởi động lại cho đến khi ITestDevice#disconnectFromWifi() hoặc ITestDevice#clearLastConnectedWifiNetwork() .

Thông số
wifiSsidToPsk : Bản đồ các SSID wifi đến mật khẩu.

scanSsid boolean : có quét SSID ẩn cho mạng này hay không.

Lợi nhuận
boolean true nếu kết nối thành công mạng wifi. false khác

Ném
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk)

Kết nối với mạng wifi.

Bật wifi và chặn cho đến khi kết nối thành công với mạng wifi được chỉ định. Sau khi kết nối được thực hiện, phiên bản sẽ cố gắng khôi phục kết nối sau mỗi lần khởi động lại cho đến khi ITestDevice#disconnectFromWifi() hoặc ITestDevice#clearLastConnectedWifiNetwork() .

Thông số
wifiSsid String : ssid wifi để kết nối

wifiPsk String : Cụm mật khẩu PSK hoặc null nếu không được mã hóa

Lợi nhuận
boolean true nếu kết nối thành công mạng wifi. false khác

Ném
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork ( wifiSsidToPsk)

Kết nối với mạng wifi.

Bật wifi và chặn cho đến khi kết nối thành công với một trong các mạng wifi được cung cấp trong bản đồ wifiSsidToPsk. Sau khi kết nối được thực hiện, phiên bản sẽ cố gắng khôi phục kết nối sau mỗi lần khởi động lại cho đến khi ITestDevice#disconnectFromWifi() hoặc ITestDevice#clearLastConnectedWifiNetwork() .f

Thông số
wifiSsidToPsk : Bản đồ các SSID wifi đến mật khẩu.

Lợi nhuận
boolean true nếu kết nối thành công mạng wifi. false khác

Ném
DeviceNotAvailableException

connectToWifiNetwork

public boolean connectToWifiNetwork (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Kết nối với mạng wifi.

Bật wifi và chặn cho đến khi kết nối thành công với mạng wifi được chỉ định. Sau khi kết nối được thực hiện, phiên bản sẽ cố gắng khôi phục kết nối sau mỗi lần khởi động lại cho đến khi ITestDevice#disconnectFromWifi() hoặc ITestDevice#clearLastConnectedWifiNetwork() .

Thông số
wifiSsid String : ssid wifi để kết nối

wifiPsk String : Cụm mật khẩu PSK hoặc null nếu không được mã hóa

scanSsid boolean : có quét SSID ẩn cho mạng này hay không.

Lợi nhuận
boolean true nếu kết nối thành công mạng wifi. false khác

Ném
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk, 
                boolean scanSsid)

Một biến thể của connectToWifiNetwork(String, String) chỉ kết nối nếu thiết bị hiện không có kết nối mạng.

Thông số
scanSsid boolean : có quét SSID ẩn cho mạng này không

Lợi nhuận
boolean true nếu kết nối thành công mạng wifi. false khác

Ném
DeviceNotAvailableException

connectToWifiNetworkIfNeeded

public boolean connectToWifiNetworkIfNeeded (String wifiSsid, 
                String wifiPsk)

Một biến thể của connectToWifiNetwork(String, String) chỉ kết nối nếu thiết bị hiện không có kết nối mạng.

Lợi nhuận
boolean true nếu kết nối thành công mạng wifi. false khác

Ném
DeviceNotAvailableException

tạo người dùng

public int createUser (String name, 
                boolean guest, 
                boolean ephemeral)

Tạo người dùng với tên đã cho và các cờ được cung cấp

Thông số
name String : của người dùng tạo trên thiết bị

guest boolean : kích hoạt cờ người dùng - hướng dẫn trong quá trình tạo

ephemeral boolean : kích hoạt cờ người dùng --ephemeral trong quá trình tạo

Lợi nhuận
int id của người dùng đã tạo

Ném
DeviceNotAvailableException

tạo người dùng

public int createUser (String name)

Tạo người dùng với tên đã cho và các cờ mặc định 0.

Thông số
name String : của người dùng tạo trên thiết bị

Lợi nhuận
int số nguyên cho id người dùng đã tạo

Ném
DeviceNotAvailableException

createUserNoThrow

public int createUserNoThrow (String name)

Tạo người dùng với tên đã cho và các cờ mặc định 0.

Thông số
name String : của người dùng tạo trên thiết bị

Lợi nhuận
int số nguyên cho id người dùng đã tạo hoặc -1 cho lỗi.

Ném
DeviceNotAvailableException

xóa tài liệu

public 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 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
DeviceNotAvailableException

deviceSoftRestartedSince

public 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
DeviceNotAvailableException

vô hiệu hóaAdbRoot

public 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

disableKeyguard

public void disableKeyguard ()

Cố gắng tắt khóa phím.

Trước tiên, hãy đợi công văn đầu vào sẵn sàng, điều này xảy ra cùng lúc khi thiết bị báo cáo BOOT_COMPLETE, có vẻ như không đồng bộ, vì việc triển khai khung hiện tại thỉnh thoảng có điều kiện chạy đua. Sau đó, lệnh được gửi để loại bỏ keyguard (chỉ hoạt động trên những key không an toàn)

Ném
DeviceNotAvailableException

disableNetworkMonitor

public boolean disableNetworkMonitor ()

Tắt tính năng giám sát mạng trên thiết bị.

Lợi nhuận
boolean true nếu tính năng giám sát bị vô hiệu hóa thành công. false nếu nó không thành công.

Ném
DeviceNotAvailableException

ngắt kết nối

public boolean disconnectFromWifi ()

Ngắt kết nối khỏi mạng Wi-Fi.

Xóa tất cả các mạng khỏi danh sách mạng đã biết và tắt wifi.

Lợi nhuận
boolean true nếu ngắt kết nối mạng wifi thành công. false nếu ngắt kết nối không thành công.

Ném
DeviceNotAvailableException

doesFileExist

public boolean doesFileExist (String deviceFilePath, 
                int userId)

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 cho một người dùng nhất định 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

userId int : Id người dùng dùng để kiểm tra sự tồn tại của tệp

Lợi nhuận
boolean true nếu tệp tồn tại, false nếu không.

Ném
DeviceNotAvailableException

doesFileExist

public 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

dumpHeap

public File dumpHeap (String process, 
                String devicePath)

Cố gắng kết xuất đống từ system_server. Người gọi có trách nhiệm dọn dẹp tệp đã kết xuất.

Thông số
process String : tên của tiến trình thiết bị để kết xuất.

devicePath String : đường dẫn trên thiết bị nơi đặt bãi chứa. Đây phải là một vị trí mà quyền cho phép nó.

Lợi nhuận
File ERROR(/File) chứa báo cáo. Null nếu một cái gì đó không thành công.

Ném
DeviceNotAvailableException

enableAdbRoot

public 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

enableNetworkMonitor

public boolean enableNetworkMonitor ()

Cho phép giám sát mạng trên thiết bị.

Lợi nhuận
boolean true nếu kích hoạt giám sát thành công. false nếu nó không thành công.

Ném
DeviceNotAvailableException

executeAdbCommand

public String executeAdbCommand (long timeout, 
                String... cmdArgs)

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ờ

cmdArgs 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

executeAdbCommand

public String executeAdbCommand (String... cmdArgs)

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ố
cmdArgs 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

thực thiFastbootCommand

public CommandResult executeFastbootCommand (String... cmdArgs)

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ố
cmdArgs 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

thực thiFastbootCommand

public CommandResult executeFastbootCommand (long timeout, 
                String... cmdArgs)

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

cmdArgs 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

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand ( envVarMap, 
                String... cmdArgs)

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 : các biến môi trường hệ thống mà lệnh fastboot chạy với

cmdArgs 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

executeLongFastbootCommand

public CommandResult executeLongFastbootCommand (String... cmdArgs)

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ực executeFastbootCommand(String) ngoại trừ sử dụng thời gian chờ lâu hơn.

Thông số
cmdArgs 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

executeShellCommand

public 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

executeShellCommand

public 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

executeShellCommand

public 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

executeShellCommand

public 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ủa executeShellCommand(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

executeShellV2Command

public CommandResult executeShellV2Command (String cmd)

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ố
cmd String : Lệnh sẽ được chạy.

Lợi nhuận
CommandResult Kết quả trong CommandResult .

Ném
DeviceNotAvailableException

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                OutputStream pipeToOutput)

Phương thức trình trợ giúp thực hiện 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à stderr. stdout được dẫn đến luồng được chỉ định.

Thông số
cmd 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

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                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ố
cmd 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

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                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ố
cmd 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

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                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ố
cmd 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

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                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ố
cmd 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

executeShellV2Command

public CommandResult executeShellV2Command (String cmd, 
                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ố
cmd 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 will be thrown if retryAttempts are performed without success.

Lợi nhuận
CommandResult

Ném
DeviceNotAvailableException

fastbootWipePartition

public CommandResult fastbootWipePartition (String partition)

Helper method which wipes a partition for the device.

If getUseFastbootErase() is true , then fastboot erase will be used to wipe the partition. The device must then create a filesystem the next time the device boots. Otherwise, fastboot format is used which will create a new filesystem on the device.

Expected to be used when device is already in fastboot mode.

Thông số
partition String : the partition to wipe

Lợi nhuận
CommandResult the CommandResult containing output of command

Ném
DeviceNotAvailableException

getActiveApexes

public  getActiveApexes ()

Fetch the information about APEXes activated on the device.

Lợi nhuận
ERROR(/Set) of ApexInfo currently activated on the device

Ném
DeviceNotAvailableException

getAllSettings

public  getAllSettings (String namespace)

Return key value pairs of requested namespace.

Thông số
namespace String : must be one of {"system", "secure", "global"}

Lợi nhuận
the map of key value pairs. Null if namespace is not supported.

Ném
DeviceNotAvailableException

getAllocationState

public DeviceAllocationState getAllocationState ()

Trả lại trạng thái phân bổ hiện tại của thiết bị

Lợi nhuận
DeviceAllocationState

getAndroidId

public String getAndroidId (int userId)

Find and return the android-id associated to a userId, null if not found.

Thông số
userId int

Lợi nhuận
String

Ném
DeviceNotAvailableException

getAndroidIds

public  getAndroidIds ()

Create a Map of android ids found matching user ids. There is no insurance that each user id will found an android id associated in this function so some user ids may match null.

Lợi nhuận
Map of android ids found matching user ids.

Ném
DeviceNotAvailableException

getApiLevel

public int getApiLevel ()

Get the device API Level. Defaults to UNKNOWN_API_LEVEL .

Lợi nhuận
int an integer indicating the API Level of device

Ném
DeviceNotAvailableException

getAppPackageInfo

public PackageInfo getAppPackageInfo (String packageName)

Fetch information about a package installed on device.

Thông số
packageName String

Lợi nhuận
PackageInfo the PackageInfo or null if information could not be retrieved

Ném
DeviceNotAvailableException

getAppPackageInfos

public  getAppPackageInfos ()

Fetch information of packages installed on the device.

Lợi nhuận
ERROR(/List) of PackageInfo s installed on the device.

Ném
DeviceNotAvailableException

getBasebandVersion

public String getBasebandVersion ()

Convenience method to get baseband (radio) version of this device. Getting the radio version is device specific, so it might not return the correct information for all devices. This method relies on the gsm.version.baseband propery to return the correct version information. This is not accurate for some CDMA devices and the version returned here might not match the version reported from fastboot and might not return the version for the CDMA radio. TL;DR this method only reports accurate version if the gsm.version.baseband property is the same as the version returned by fastboot getvar version-baseband .

Lợi nhuận
String the String baseband version or null if it cannot be determined (device has no radio or version string cannot be read)

Ném
DeviceNotAvailableException

getBattery

public Integer getBattery ()

Returns the current battery level of a device or Null if battery level unavailable.

Lợi nhuận
Integer

getBooleanProperty

public boolean getBooleanProperty (String name, 
                boolean defaultValue)

Returns boolean value of the given property.

Thông số
name String : the property name

defaultValue boolean : default value to return if property is empty or doesn't exist.

Lợi nhuận
boolean true if the property has value "1" , "y" , "yes" , "on" , or "true" , false if the property has value of "0" , "n" , "no" , "off" , "false" , or defaultValue otherwise.

Ném
DeviceNotAvailableException

getBootHistory

public  getBootHistory ()

Helper method collects the boot history map with boot time and boot reason.

Lợi nhuận
Map of boot time (UTC time in second since Epoch) and boot reason

Ném
DeviceNotAvailableException

getBootHistorySince

public  getBootHistorySince (long utcEpochTime, 
                TimeUnit timeUnit)

Helper method collects the boot history map with boot time and boot reason since the given time since epoch from device and the time unit specified. The current device utcEpochTime in Millisecond can be obtained by method getDeviceDate() .

Thông số
utcEpochTime long : the device time since Epoch.

timeUnit TimeUnit : the time unit TimeUnit .

Lợi nhuận
Map of boot time (UTC time in second since Epoch) and boot reason

Ném
DeviceNotAvailableException

getBootloaderVersion

public String getBootloaderVersion ()

Convenience method to get the bootloader version of this device.

Will attempt to retrieve bootloader version from the device's current state. (ie if device is in fastboot mode, it will attempt to retrieve version from fastboot)

Lợi nhuận
String the String bootloader version or null if it cannot be found

Ném
DeviceNotAvailableException

getBugreport

public InputStreamSource getBugreport ()

Retrieves a bugreport from the device.

The implementation of this is guaranteed to continue to work on a device without an sdcard (or where the sdcard is not yet mounted).

Lợi nhuận
InputStreamSource An InputStreamSource which will produce the bugreport contents on demand. In case of failure, the InputStreamSource will produce an empty ERROR(/InputStream) .

getBugreportz

public InputStreamSource getBugreportz ()

Retrieves a bugreportz from the device. Zip format bugreport contains the main bugreport and other log files that are useful for debugging.

Only supported for 'adb version' > 1.0.36

Lợi nhuận
InputStreamSource a InputStreamSource of the zip file containing the bugreportz, return null in case of failure.

getBuildAlias

public String getBuildAlias ()

Retrieve the alias of the build that the device is currently running.

Build alias is usually a more readable string than build id (typically a number for Nexus builds). For example, final Android 4.2 release has build alias JDQ39, and build id 573038

Lợi nhuận
String the build alias or fall back to build id if it could not be retrieved

Ném
DeviceNotAvailableException

getBuildFlavor

public String getBuildFlavor ()

Retrieve the build flavor for the device.

Lợi nhuận
String the build flavor or null if it could not be retrieved

Ném
DeviceNotAvailableException

getBuildId

public String getBuildId ()

Retrieve the build the device is currently running.

Lợi nhuận
String the build id or IBuildInfo#UNKNOWN_BUILD_ID if it could not be retrieved

Ném
DeviceNotAvailableException

getBuildSigningKeys

public String getBuildSigningKeys ()

Returns the key type used to sign the device image

Typically Android devices may be signed with test-keys (like in AOSP) or release-keys (controlled by individual device manufacturers)

Lợi nhuận
String The signing key if found, null otherwise.

Ném
DeviceNotAvailableException

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor ()

Returns a cached DeviceDescriptor if the device is allocated, otherwise returns the current DeviceDescriptor .

Lợi nhuận
DeviceDescriptor

getCachedDeviceDescriptor

public DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)

Returns a cached DeviceDescriptor if the device is allocated, otherwise returns the current DeviceDescriptor .

Thông số
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

Lợi nhuận
DeviceDescriptor

getChildren

public String[] getChildren (String path)

Alternative to using IFileEntry that sometimes won't work because of permissions.

Thông số
path String : is the path on the device where to do the search

Lợi nhuận
String[] Array of string containing all the file in a path on the device.

Ném
DeviceNotAvailableException

getCurrentFoldableState

public DeviceFoldableState getCurrentFoldableState ()

Returns the current foldable state of the device or null if some issues occurred.

Lợi nhuận
DeviceFoldableState

Ném
DeviceNotAvailableException

getCurrentUser

public int getCurrentUser ()

Return the id of the current running user. In case of error, return -10000.

Lợi nhuận
int

Ném
DeviceNotAvailableException

getDeviceClass

public String getDeviceClass ()

Get the device class.

Lợi nhuận
String the String device class.

getDeviceDate

public long getDeviceDate ()

Return the date of the device in millisecond since epoch.

Lợi nhuận
long the date of the device in epoch format.

Ném
DeviceNotAvailableException

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor ()

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

Lợi nhuận
DeviceDescriptor

getDeviceDescriptor

public DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)

Return a DeviceDescriptor from the device information to get info on it without passing the actual device object.

Thông số
shortDescriptor boolean : Whether or not to limit descriptor to bare minimum info

Lợi nhuận
DeviceDescriptor

getDeviceState

public TestDeviceState getDeviceState ()

Get the device's state.

Lợi nhuận
TestDeviceState

getDeviceTimeOffset

public long getDeviceTimeOffset (Date date)

Helper to get the time difference between the device and a given ERROR(/Date) . Use Epoch time internally.

Thông số
date Date

Lợi nhuận
long the difference in milliseconds

Ném
DeviceNotAvailableException

getEmulatorOutput

public InputStreamSource getEmulatorOutput ()

Get the stream of emulator stdout and stderr

Lợi nhuận
InputStreamSource emulator output

getEmulatorProcess

public Process getEmulatorProcess ()

Trả lại Process tương ứng với trình giả lập này.

Lợi nhuận
Process Process hoặc null

getExecuteShellCommandLog

public final File getExecuteShellCommandLog ()

The log that contains all the executeShellCommand(String) logs.

Lợi nhuận
File

getExternalStoreFreeSpace

public long getExternalStoreFreeSpace ()

Helper method to determine amount of free space on device external storage.

Lợi nhuận
long the amount of free space in KB

Ném
DeviceNotAvailableException

getFastbootPath

public String getFastbootPath ()

Trả về đường dẫn của tệp nhị phân fastboot đang được sử dụng. Vẫn yêu cầu isFastbootEnabled() là true, để kích hoạt các chức năng fastboot.

Lợi nhuận
String

getFastbootProductType

public String getFastbootProductType ()

Convenience method to get the product type of this device when its in fastboot mode.

This method should only be used if device should be in fastboot. Its a bit safer variant than the generic getProductType() method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.

Lợi nhuận
String the String product type name or null if it cannot be determined

Ném
DeviceNotAvailableException

getFastbootProductVariant

public String getFastbootProductVariant ()

Convenience method to get the product type of this device when its in fastboot mode.

This method should only be used if device should be in fastboot. Its a bit safer variant than the generic getProductType() method in this case, because ITestDevice will know to recover device into fastboot if device is in incorrect state or is unresponsive.

Lợi nhuận
String the String product type name or null if it cannot be determined

Ném
DeviceNotAvailableException

getFastbootSerialNumber

public String getFastbootSerialNumber ()

Returns the fastboot mode serial number.

Lợi nhuận
String

getFastbootVariable

public String getFastbootVariable (String variableName)

Retrieve the given fastboot variable value from the device.

Thông số
variableName String : the variable name

Lợi nhuận
String the property value or null if it does not exist

Ném
DeviceNotAvailableException

getFastbootVersion

public String getFastbootVersion ()

Trả về chuỗi phiên bản của tệp nhị phân fastboot đang được sử dụng. Hoặc vô hiệu nếu có sự cố.

Lợi nhuận
String

getFileEntry

public IFileEntry getFileEntry (String path)

Retrieve a reference to a remote file on device.

Thông số
path String : the file path to retrieve. Can be an absolute path or path relative to '/'. (ie both "/system" and "system" syntax is supported)

Lợi nhuận
IFileEntry the IFileEntry or null if file at given path cannot be found

Ném
DeviceNotAvailableException

getFileEntry

public IFileEntry getFileEntry (FileListingService.FileEntry entry)

Unofficial helper to get a FileEntry from a non-root path. FIXME: Refactor the FileEntry system to have it available from any path. (even non root).

Thông số
entry FileListingService.FileEntry : a FileEntry not necessarily root as Ddmlib requires.

Lợi nhuận
IFileEntry a FileEntryWrapper representing the FileEntry.

Ném
DeviceNotAvailableException

getFoldableStates

public  getFoldableStates ()

Returns the list of foldable states on the device. Can be obtained with "cmd device_state print-states".

Lợi nhuận

Ném
DeviceNotAvailableException

getIDevice

public IDevice getIDevice ()

Returns a reference to the associated ddmlib IDevice .

A new IDevice may be allocated by DDMS each time the device disconnects and reconnects from adb. Thus callers should not keep a reference to the IDevice , because that reference may become stale.

Lợi nhuận
IDevice the IDevice

getInstalledPackageNames

public  getInstalledPackageNames ()

Fetch the application package names present on the device.

Lợi nhuận
ERROR(/Set) of String package names currently installed on the device.

Ném
DeviceNotAvailableException

getIntProperty

public long getIntProperty (String name, 
                long defaultValue)

Returns integer value of the given property from the device.

Thông số
name String : the property name

defaultValue long : default value to return if property is empty or doesn't exist.

Lợi nhuận
long the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value.

Ném
DeviceNotAvailableException

getIpAddress

public String getIpAddress ()

Gets the device's IP address.

Lợi nhuận
String the device's IP address, or null if device has no IP address

Ném
DeviceNotAvailableException

getKeyguardState

public KeyguardControllerState getKeyguardState ()

Return an object to get the current state of the keyguard or null if not supported.

Lợi nhuận
KeyguardControllerState a KeyguardControllerState containing a snapshot of the state of the keyguard and returns Null if the Keyguard query is not supported.

Ném
DeviceNotAvailableException

getLastExpectedRebootTimeMillis

public long getLastExpectedRebootTimeMillis ()

Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis() .

Lợi nhuận
long

getLaunchApiLevel

public int getLaunchApiLevel ()

Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL .

Lợi nhuận
int an integer indicating the first launched API Level of device

Ném
DeviceNotAvailableException

getLogcat

public InputStreamSource getLogcat ()

Grabs a snapshot stream of the logcat data.

Works in two modes:

  • If the logcat is currently being captured in the background, will return up to TestDeviceOptions.getMaxLogcatDataSize() bytes of the current contents of the background logcat capture
  • Otherwise, will return a static dump of the logcat data if device is currently responding

    Lợi nhuận
    InputStreamSource

  • getLogcat

    public InputStreamSource getLogcat (int maxBytes)

    Grabs a snapshot stream of the last maxBytes of captured logcat data.

    Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat() snapshot.

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

    getMacAddress

    public String getMacAddress ()

    Trả về địa chỉ MAC của thiết bị, null nếu nó không truy vấn được từ thiết bị.

    Lợi nhuận
    String

    getMainlineModuleInfo

    public  getMainlineModuleInfo ()

    Get the information about the mainline modules installed on the device.

    Lợi nhuận
    ERROR(/Set) of String mainline modules currently installed on the device.

    Ném
    DeviceNotAvailableException

    getMaxNumberOfRunningUsersSupported

    public int getMaxNumberOfRunningUsersSupported ()

    Get the maximum number of supported simultaneously running users. Defaults to 0.

    Lợi nhuận
    int an integer indicating the number of simultaneously running users

    Ném
    DeviceNotAvailableException

    getMaxNumberOfUsersSupported

    public int getMaxNumberOfUsersSupported ()

    Get the maximum number of supported users. Defaults to 0.

    Lợi nhuận
    int an integer indicating the number of supported users

    Ném
    DeviceNotAvailableException

    getMonitor

    public IDeviceStateMonitor getMonitor ()

    Trả lại IDeviceStateMonitor liên kết với thiết bị.

    Lợi nhuận
    IDeviceStateMonitor

    getMountPoint

    public String getMountPoint (String mountName)

    Returns a mount point.

    Queries the device directly if the cached info in IDevice 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

    getMountPointInfo

    public ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)

    Returns a MountPointInfo corresponding to the specified mountpoint path, or null if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.

    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

    getMountPointInfo

    public  getMountPointInfo ()

    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

    getOptions

    public TestDeviceOptions getOptions ()

    Fetch the test options for the device.

    Lợi nhuận
    TestDeviceOptions TestDeviceOptions related to the device under test.

    getPartitionFreeSpace

    public long getPartitionFreeSpace (String partition)

    Helper method to determine amount of free space on device partition.

    Thông số
    partition String

    Lợi nhuận
    long the amount of free space in KB

    Ném
    DeviceNotAvailableException

    getPrimaryUserId

    public Integer getPrimaryUserId ()

    Returns the primary user id.

    Lợi nhuận
    Integer the userId of the primary user if there is one, and null if there is no primary user.

    Ném
    DeviceNotAvailableException

    getProcessByName

    public ProcessInfo getProcessByName (String processName)

    Helper method runs the "pidof" and "stat" command and returns ProcessInfo object with PID and process start time of the given process.

    Thông số
    processName String : the proces name String.

    Lợi nhuận
    ProcessInfo ProcessInfo of given processName

    Ném
    DeviceNotAvailableException

    getProcessPid

    public 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 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

    getProductVariant

    public String getProductVariant ()

    Convenience method to get the product variant of this device.

    This method will work if device is in either adb or fastboot mode.

    Lợi nhuận
    String the String product variant name or null if it cannot be determined

    Ném
    DeviceNotAvailableException

    getProperty

    public 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 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.

    getScreenshot

    public InputStreamSource getScreenshot (String format)

    Grabs a screenshot from the device. Recommended to use getScreenshot(format) instead with JPEG encoding for smaller size

    Thông số
    format String : supported PNG, JPEG

    Lợi nhuận
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    Ném
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (long displayId)

    Grabs a screenshot from the device given display id. Format is PNG.

    TODO: extend the implementations above to support 'format' and 'rescale'

    Thông số
    displayId long : the display id of the screen to get screenshot from.

    Lợi nhuận
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    Ném
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot (String format, 
                    boolean rescale)

    Grabs a screenshot from the device. Recommended to use getScreenshot(String) instead with JPEG encoding for smaller size.

    Thông số
    format String : supported PNG, JPEG

    rescale boolean : if screenshot should be rescaled to reduce the size of resulting image

    Lợi nhuận
    InputStreamSource a InputStreamSource of the screenshot in format, or null if the screenshot was not successful.

    Ném
    DeviceNotAvailableException

    getScreenshot

    public InputStreamSource getScreenshot ()

    Grabs a screenshot from the device.

    Lợi nhuận
    InputStreamSource a InputStreamSource of the screenshot in png format, or null if the screenshot was not successful.

    Ném
    DeviceNotAvailableException

    getSerialNumber

    public String getSerialNumber ()

    Convenience method to get serial number of this device.

    Lợi nhuận
    String the String serial number

    getSetting

    public String getSetting (int userId, 
                    String namespace, 
                    String key)

    Return the value of the requested setting. namespace must be one of: {"system", "secure", "global"}

    Thông số
    userId int

    namespace String

    key String

    Lợi nhuận
    String the value associated with the namespace:key of a user. Null if not found.

    Ném
    DeviceNotAvailableException

    getSetting

    public String getSetting (String namespace, 
                    String key)

    See getSetting(int, String, String) and performed on system user.

    Thông số
    namespace String

    key String

    Lợi nhuận
    String

    Ném
    DeviceNotAvailableException

    getSimOperator

    public String getSimOperator ()

    Trả lại nhà khai thác thẻ SIM hoặc null nếu không có sẵn hoặc nếu thiết bị không khả dụng.

    Lợi nhuận
    String

    getSimState

    public String getSimState ()

    Trả lại trạng thái thẻ SIM hoặc trống nếu không có hoặc thiết bị không khả dụng.

    Lợi nhuận
    String

    getTombstones

    public  getTombstones ()

    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

    getTotalMemory

    public long getTotalMemory ()

    Returns total physical memory size in bytes or -1 in case of internal error

    Lợi nhuận
    long

    getUninstallablePackageNames

    public  getUninstallablePackageNames ()

    Fetch the application package names that can be uninstalled. This is presently defined as non-system packages, and updated system packages.

    Lợi nhuận
    ERROR(/Set) of uninstallable String package names currently installed on the device.

    Ném
    DeviceNotAvailableException

    getUseFastbootErase

    public 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.

    getUserFlags

    public int getUserFlags (int userId)

    Find and return the flags of a given user. Flags are defined in "android.content.pm.UserInfo" class in Android Open Source Project.

    Thông số
    userId int

    Lợi nhuận
    int the flags associated with the userId provided if found, -10000 in any other cases.

    Ném
    DeviceNotAvailableException

    getUserInfos

    public  getUserInfos ()

    Gets the Map of useId to UserInfo on the device. Will throw DeviceRuntimeException if output from device is not as expected.

    Lợi nhuận
    the list of UserInfo objects.

    Ném
    DeviceNotAvailableException

    getUserSerialNumber

    public int getUserSerialNumber (int userId)

    Return the serial number associated to the userId if found, -10000 in any other cases.

    Thông số
    userId int

    Lợi nhuận
    int

    Ném
    DeviceNotAvailableException

    handleAllocationEvent

    public IManagedTestDevice.DeviceEventResponse handleAllocationEvent (DeviceEvent event)

    Xử lý DeviceEvent cho. Có thể chuyển thiết bị sang trạng thái mới. Sẽ thông báo cho IDeviceMonitor về bất kỳ chuyển đổi trạng thái nào.

    Process the DeviceEvent, which may or may not transition this device to a new allocation state.

    Thông số
    event DeviceEvent

    Lợi nhuận
    IManagedTestDevice.DeviceEventResponse

    hasFeature

    public boolean hasFeature (String feature)

    Check if a feature is available on a device.

    Thông số
    feature String : which format should be "feature: " or " " directly.

    Lợi nhuận
    boolean True if feature is found, false otherwise.

    Ném
    DeviceNotAvailableException

    installPackage

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

    Install an Android package on device.

    Thông số
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    Lợi nhuận
    String a String with an error code, or null if success.

    Ném
    DeviceNotAvailableException

    installPackage

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

    Install an Android package on device.

    Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.

    Thông số
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    grantPermissions boolean : if all runtime permissions should be granted at install time

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    Lợi nhuận
    String a String with an error code, or null if success.

    Ném
    DeviceNotAvailableException

    installPackageForUser

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

    Install an Android package on device for a given user.

    Thông số
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    userId int : the integer user id to install for.

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    Lợi nhuận
    String a String with an error code, or null if success.

    Ném
    DeviceNotAvailableException

    installPackageForUser

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

    Install an Android package on device for a given user.

    Note: Only use cases that requires explicit control of granting runtime permission at install time should call this function.

    Thông số
    packageFile File : the apk file to install

    reinstall boolean : true if a reinstall should be performed

    grantPermissions boolean : if all runtime permissions should be granted at install time

    userId int : the integer user id to install for.

    extraArgs String : optional extra arguments to pass. See 'adb shell pm -h' for available options.

    Lợi nhuận
    String a String with an error code, or null if success.

    Ném
    DeviceNotAvailableException

    isAdbRoot

    public boolean isAdbRoot ()

    Lợi nhuận
    boolean

    Ném
    DeviceNotAvailableException

    isAdbTcp

    public boolean isAdbTcp ()

    Lợi nhuận
    boolean

    isAppEnumerationSupported

    public 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 boolean isDeviceEncrypted ()

    Returns if the device is encrypted.

    Lợi nhuận
    boolean true if the device is encrypted.

    Ném
    DeviceNotAvailableException

    isDirectory

    public boolean isDirectory (String path)

    Return True if the path on the device is a directory, false otherwise.

    Thông số
    path String

    Lợi nhuận
    boolean

    Ném
    DeviceNotAvailableException

    isEnableAdbRoot

    public boolean isEnableAdbRoot ()

    Lợi nhuận
    boolean true if adb root should be enabled on device

    isEncryptionSupported

    public 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 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

    isFastbootEnabled

    public boolean isFastbootEnabled ()

    Quay lại nếu fastboot có sẵn cho thiết bị.

    Lợi nhuận
    boolean

    isHeadless

    public boolean isHeadless ()

    Return true if the device is headless (no screen), false otherwise.

    Lợi nhuận
    boolean

    Ném
    DeviceNotAvailableException

    isMultiUserSupported

    public boolean isMultiUserSupported ()

    Determines if multi user is supported.

    Lợi nhuận
    boolean true if multi user is supported, false otherwise

    Ném
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName, 
                    String userId)

    Query the device for a given package name and given user id to check if it's currently installed or not for that user.

    Thông số
    packageName String : the package we are checking if it's installed.

    userId String : The user id we are checking the package is installed for. If null, primary user zero will be used.

    Lợi nhuận
    boolean True if the package is reported as installed. Sai khác.

    Ném
    DeviceNotAvailableException

    isPackageInstalled

    public boolean isPackageInstalled (String packageName)

    Query the device for a given package name to check if it's currently installed or not.

    Thông số
    packageName String

    Lợi nhuận
    boolean True if the package is reported as installed. Sai khác.

    Ném
    DeviceNotAvailableException

    isRuntimePermissionSupported

    public 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 boolean isStateBootloaderOrFastbootd ()

    Returns true if device is in TestDeviceState#FASTBOOT or TestDeviceState.FASTBOOTD .

    Lợi nhuận
    boolean

    isUserRunning

    public boolean isUserRunning (int userId)

    Check if a given user is running.

    Thông số
    userId int

    Lợi nhuận
    boolean True if the user is running, false in every other cases.

    Ném
    DeviceNotAvailableException

    isUserSecondary

    public boolean isUserSecondary (int userId)

    Return whether the specified user is a secondary user according to it's flags.

    Thông số
    userId int

    Lợi nhuận
    boolean true if the user is secondary, false otherwise.

    Ném
    DeviceNotAvailableException

    isWifiEnabled

    public boolean isWifiEnabled ()

    Test if wifi is enabled.

    Checks if wifi is enabled on device. Useful for asserting wifi status before tests that shouldn't run with wifi, eg mobile data tests.

    Lợi nhuận
    boolean true if wifi is enabled. false if disabled

    Ném
    DeviceNotAvailableException

    listDisplayIds

    public  listDisplayIds ()

    Collect the list of available displays id on the device as reported by "dumpsys SurfaceFlinger".

    Lợi nhuận
    The list of displays. Default always returns the default display 0.

    Ném
    DeviceNotAvailableException

    listUsers

    public  listUsers ()

    Gets the list of users on the device. Will throw DeviceRuntimeException if output from device is not as expected.

    Lợi nhuận
    the list of user ids.

    Ném
    DeviceNotAvailableException

    logAnrs

    public 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 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 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 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

    postAdbRootAction

    public void postAdbRootAction ()

    Override if the device needs some specific actions to be taken after adb root and before the device is back online. Default implementation doesn't include any addition actions. adb root is not guaranteed to be enabled at this stage.

    Ném
    DeviceNotAvailableException

    postAdbUnrootAction

    public void postAdbUnrootAction ()

    Override if the device needs some specific actions to be taken after adb unroot and before the device is back online. Default implementation doesn't include any additional actions. adb root is not guaranteed to be disabled at this stage.

    Ném
    DeviceNotAvailableException

    postBootSetup

    public void postBootSetup ()

    Perform instructions to configure device for testing that after every boot.

    Should be called after device is fully booted/available

    In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot.

    Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)

    Ném
    DeviceNotAvailableException

    postInvocationTearDown

    public void postInvocationTearDown (Throwable exception)

    Extra steps for device specific required clean up that will be executed after the invocation is done.

    Thông số
    exception Throwable : if any, the final exception raised by the invocation failure.

    preInvocationSetup

    public void preInvocationSetup (IBuildInfo info, 
                    MultiMap<String, String> attributes)

    Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.

    Thông số
    info IBuildInfo : The IBuildInfo of the device.

    attributes MultiMap : The attributes stored in the invocation context

    Ném
    DeviceNotAvailableException
    TargetSetupError

    pullDir

    public 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

    pullFile

    public 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

    pullFile

    public File pullFile (String remoteFilePath, 
                    int userId)

    Retrieves a file off device, stores it in a local temporary ERROR(/File) , and returns that File .

    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

    pullFile

    public 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

    pullFile

    public 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

    pullFileContents

    public 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 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

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath, 
                     excludedDirectories)

    Recursively push directory contents to device while excluding some directories that are filtered.

    Thông số
    localFileDir File : the local directory to push

    deviceFilePath String : the absolute file path of the remote destination

    excludedDirectories : Set of excluded directories names that shouldn't be pushed.

    Lợi nhuận
    boolean true if file was pushed successfully. false otherwise.

    Ném
    DeviceNotAvailableException

    pushDir

    public boolean pushDir (File localFileDir, 
                    String deviceFilePath)

    Recursively push directory contents to device.

    Thông số
    localFileDir 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

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath, 
                    boolean evaluateContentProviderNeeded)

    Variant of pushFile(File, String) which can optionally consider evaluating the need for the content provider.

    Thông số
    localFile File : the local file to push

    remoteFilePath String : the remote destination absolute file path

    evaluateContentProviderNeeded boolean : whether to check if we need the content provider

    Lợi nhuận
    boolean true if file was pushed successfully. false otherwise.

    Ném
    DeviceNotAvailableException

    pushFile

    public boolean pushFile (File localFile, 
                    String remoteFilePath)

    Push a file to device. By default using a content provider.

    Thông số
    localFile File : the local file to push

    remoteFilePath String : the remote destination absolute file path

    Lợi nhuận
    boolean true if file was pushed successfully. false otherwise.

    Ném
    DeviceNotAvailableException

    pushString

    public boolean pushString (String contents, 
                    String remoteFilePath)

    Push file created from a string to device

    Thông số
    contents String : the contents of the file to push

    remoteFilePath String : the remote destination absolute file path

    Lợi nhuận
    boolean true if string was pushed successfully. false otherwise.

    Ném
    DeviceNotAvailableException

    reboot

    public void reboot (String reason)

    Reboots the device into adb mode with given reason to be persisted across reboot.

    Blocks until device becomes available.

    Last reboot reason can be obtained by querying sys.boot.reason propety.

    Thông số
    reason String : a reason for this reboot, or null if no reason is specified.

    Ném
    DeviceNotAvailableException

    reboot

    public void reboot ()

    Reboots the device into adb mode.

    Blocks until device becomes available.

    Ném
    DeviceNotAvailableException

    rebootIntoBootloader

    public void rebootIntoBootloader ()

    Reboots the device into bootloader mode.

    Blocks until device is in bootloader mode.

    Ném
    DeviceNotAvailableException

    rebootIntoFastbootd

    public void rebootIntoFastbootd ()

    Reboots the device into fastbootd mode.

    Blocks until device is in fastbootd mode.

    Ném
    DeviceNotAvailableException

    rebootIntoRecovery

    public void rebootIntoRecovery ()

    Reboots the device into adb recovery mode.

    Blocks until device enters recovery

    Ném
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload ()

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    Ném
    DeviceNotAvailableException

    rebootIntoSideload

    public void rebootIntoSideload (boolean autoReboot)

    Reboots the device into adb sideload mode (note that this is a special mode under recovery)

    Blocks until device enters sideload mode

    Thông số
    autoReboot boolean : whether to automatically reboot the device after sideload

    Ném
    DeviceNotAvailableException

    rebootUntilOnline

    public void rebootUntilOnline ()

    An alternate to reboot() that only blocks until device is online ie visible to adb.

    Ném
    DeviceNotAvailableException

    rebootUntilOnline

    public 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

    rebootUserspace

    public void rebootUserspace ()

    Reboots only userspace part of device.

    Blocks until device becomes available.

    WARNING. Userspace reboot is currently under active development, use it on your own risk.

    Ném
    DeviceNotAvailableException

    rebootUserspaceUntilOnline

    public void rebootUserspaceUntilOnline ()

    An alternate to rebootUserspace() ()} that only blocks until device is online ie visible to adb.

    Ném
    DeviceNotAvailableException

    recoveryDevice

    public boolean recoverDevice ()

    Attempts to recover device communication.

    Lợi nhuận
    boolean Đúng nếu quá trình khôi phục đã cố gắng và thành công, trả về Sai nếu quá trình khôi phục bị bỏ qua

    Ném
    DeviceNotAvailableException if device is no longer available

    remountSystemWritable

    public void remountSystemWritable ()

    Make the system partition on the device writable. May reboot the device.

    Ném
    DeviceNotAvailableException

    remountVendorWritable

    public void remountVendorWritable ()

    Make the vendor partition on the device writable. May reboot the device.

    Ném
    DeviceNotAvailableException

    removeAdmin

    public boolean removeAdmin (String componentName, 
                    int userId)

    Remove given device admin in given user and return true if it is successful, false otherwise.

    Thông số
    componentName String : of device admin to be removed.

    userId int : of user that the device admin lives in.

    Lợi nhuận
    boolean True if it is successful, false otherwise.

    Ném
    DeviceNotAvailableException

    removeOwners

    public void removeOwners ()

    Remove all existing device profile owners with the best effort.

    Ném
    DeviceNotAvailableException

    removeUser

    public boolean removeUser (int userId)

    Remove a given user from the device.

    Thông số
    userId int : of the user to remove

    Lợi nhuận
    boolean true if we were successful in removing the user, false otherwise.

    Ném
    DeviceNotAvailableException

    resetContentProviderSetup

    public void resetContentProviderSetup ()

    Reset the flag for content provider setup in order to trigger it again.

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                    ITestLifeCycleReceiver... listeners)

    Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection)) with one or more listeners passed as parameters.

    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

    runInstrumentationTests

    public boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, 
                     listeners)

    Runs instrumentation tests, and provides device recovery.

    If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.

    If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.

    Thông số
    runner IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests

    listeners : the test result 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

    runInstrumentationTestsAsUser

    public 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 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

    setConfiguration

    public void setConfiguration (IConfiguration configuration)

    IConfiguration đang sử dụng.

    Thông số
    configuration IConfiguration

    setDate

    public 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

    setDeviceOwner

    public boolean setDeviceOwner (String componentName, 
                    int userId)

    Set a device admin component as device owner in given user.

    Thông số
    componentName String : of device admin to be device owner.

    userId int : of the user that the device owner lives in.

    Lợi nhuận
    boolean True if it is successful, false otherwise.

    Ném
    DeviceNotAvailableException

    setDeviceState

    public void setDeviceState (TestDeviceState deviceState)

    Cập nhật trạng thái của thiết bị.

    Thông số
    deviceState TestDeviceState : TestDeviceState

    setEmulatorOutputStream

    public void setEmulatorOutputStream (SizeLimitedOutputStream output)

    For emulator set SizeLimitedOutputStream to log output

    Thông số
    output SizeLimitedOutputStream : to log the output

    setEmulatorProcess

    public void setEmulatorProcess (Process p)

    Đặt Process , khi thiết bị này là một trình giả lập.

    Thông số
    p Process

    setFastbootEnabled

    public void setFastbootEnabled (boolean fastbootEnabled)

    Đặt tùy chọn fastboot cho thiết bị. Nên được đặt khi thiết bị được cấp phát lần đầu.

    Thông số
    fastbootEnabled boolean : liệu fastboot có khả dụng cho thiết bị hay không

    setFastbootPath

    public void setFastbootPath (String fastbootPath)

    Đặt đường dẫn đến tệp nhị phân fastboot sẽ được sử dụng. Vẫn yêu cầu isFastbootEnabled() là true, để kích hoạt các chức năng fastboot.

    Thông số
    fastbootPath String

    setIDevice

    public void setIDevice (IDevice newDevice)

    Cập nhật IDevice được liên kết với ITestDevice này.

    IDevice mới phải tham chiếu cùng một thiết bị vật lý với tham chiếu hiện tại. Phương thức này sẽ được gọi nếu DDMS đã cấp phát một IDevice mới

    Thông số
    newDevice IDevice : IDevice

    setOptions

    public void setOptions (TestDeviceOptions options)

    Set the TestDeviceOptions for the device

    Thông số
    options TestDeviceOptions

    setProperty

    public 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 void setRecovery (IDeviceRecovery recovery)

    Set the IDeviceRecovery to use for this device. Nên được đặt khi thiết bị được cấp phát lần đầu.

    Thông số
    recovery IDeviceRecovery : the IDeviceRecovery

    setRecoveryMode

    public void setRecoveryMode (ITestDevice.RecoveryMode mode)

    Set the current recovery mode to use for the device.

    Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etc

    Thông số
    mode ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not.

    setSetting

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

    See setSetting(int, String, String, String) and performed on system user.

    Thông số
    namespace String

    key String

    value String

    Ném
    DeviceNotAvailableException

    setSetting

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

    Add a setting value to the namespace of a given user. Some settings will only be available after a reboot. namespace must be one of: {"system", "secure", "global"}

    Thông số
    userId int

    namespace String

    key String

    value String

    Ném
    DeviceNotAvailableException

    setUseFastbootErase

    public 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.

    startLogcat

    public void startLogcat ()

    Start capturing logcat output from device in the background.

    Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat.

    When the device is no longer in use, stopLogcat() must be called.

    startLogcat() and stopLogcat() do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.

    startUser

    public boolean startUser (int userId)

    Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP.

    Thông số
    userId int : of the user to start in the background

    Lợi nhuận
    boolean true if the user was successfully started in the background.

    Ném
    DeviceNotAvailableException

    startUser

    public boolean startUser (int userId, 
                    boolean waitFlag)

    Starts a given user in the background if it is currently stopped. If the user is already running in the background, this method is a NOOP. Possible to provide extra flag to wait for the operation to have effect.

    Thông số
    userId int : of the user to start in the background

    waitFlag boolean : will make the command wait until user is started and unlocked.

    Lợi nhuận
    boolean true if the user was successfully started in the background.

    Ném
    DeviceNotAvailableException

    stopEmulatorOutput

    public void stopEmulatorOutput ()

    Close and delete the emulator output.

    stopLogcat

    public void stopLogcat ()

    Stop capturing logcat output from device, and discard currently saved logcat data.

    Will have no effect if logcat output is not being captured.

    stopUser

    public boolean stopUser (int userId)

    Stops a given user. If the user is already stopped, this method is a NOOP. Cannot stop current and system user.

    Thông số
    userId int : of the user to stop.

    Lợi nhuận
    boolean true if the user was successfully stopped.

    Ném
    DeviceNotAvailableException

    stopUser

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

    Stop a given user. Possible to provide extra flags to wait for the operation to have effect, and force terminate the user. Cannot stop current and system user.

    Thông số
    userId int : of the user to stop.

    waitFlag boolean : will make the command wait until user is stopped.

    forceFlag boolean : will force stop the user.

    Lợi nhuận
    boolean true if the user was successfully stopped.

    Ném
    DeviceNotAvailableException

    switchToAdbTcp

    public 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 boolean switchToAdbUsb ()

    Switch device to adb over usb mode.

    Lợi nhuận
    boolean true if switch was successful, false otherwise.

    Ném
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId)

    Switch to another userId with a default timeout. switchUser(int, long) .

    Thông số
    userId int

    Lợi nhuận
    boolean True if the new userId matches the userId provider. Sai khác.

    Ném
    DeviceNotAvailableException

    switchUser

    public boolean switchUser (int userId, 
                    long timeout)

    Switch to another userId with the provided timeout as deadline. Attempt to disable keyguard after user change is successful.

    Thông số
    userId int

    timeout long : to wait before returning false for switch-user failed.

    Lợi nhuận
    boolean True if the new userId matches the userId provider. Sai khác.

    Ném
    DeviceNotAvailableException

    syncFiles

    public boolean syncFiles (File localFileDir, 
                    String deviceFilePath)

    Incrementally syncs the contents of a local file directory to device.

    Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date.

    Hidden files (with names starting with ".") will be ignored.

    Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.

    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

    takeBugreport

    public Bugreport takeBugreport ()

    Take a bugreport and returns it inside a Bugreport object to handle it. Return null in case of issue.

    File referenced in the Bugreport object need to be cleaned via Bugreport#close() .

    Lợi nhuận
    Bugreport

    uninstallPackage

    public String uninstallPackage (String packageName)

    Uninstall an Android package from device.

    Thông số
    packageName String : the Android package to uninstall

    Lợi nhuận
    String a String with an error code, or null if success.

    Ném
    DeviceNotAvailableException

    uninstallPackageForUser

    public String uninstallPackageForUser (String packageName, 
                    int userId)

    Uninstall an Android package from device for a given user.

    Thông số
    packageName String : the Android package to uninstall

    userId int : the integer user id to uninstall for.

    Lợi nhuận
    String a String with an error code, or null if success.

    Ném
    DeviceNotAvailableException

    unlockDevice

    public boolean unlockDevice ()

    Unlocks the device if the device is in an encrypted state.

    This method may restart the framework but will not call postBootSetup() . 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

    waitForBootComplete

    public 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 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

    waitForDeviceAvailable

    public 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

    waitForDeviceBootloader

    public void waitForDeviceBootloader ()

    Blocks until device is visible via fastboot. Use default timeout.

    Ném
    DeviceNotAvailableException

    waitForDeviceInRecovery

    public 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 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 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 void waitForDeviceOnline ()

    Blocks until device is visible via adb. Uses default timeout

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    Ném
    DeviceNotAvailableException

    waitForDeviceOnline

    public void waitForDeviceOnline (long waitTime)

    Blocks until device is visible via adb.

    Note the device may not necessarily be responsive to commands on completion. Use waitForDeviceAvailable() instead.

    Thông số
    waitTime long : the time in ms to wait

    Ném
    DeviceNotAvailableException

    waitForDeviceShell

    public 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.

    Các phương pháp được bảo vệ

    checkApiLevelAgainst

    protected void checkApiLevelAgainst (String feature, 
                    int strictMinLevel)

    Thông số
    feature String

    strictMinLevel int

    createRebootDeviceAction

    protected NativeDevice.RebootDeviceAction createRebootDeviceAction (NativeDevice.RebootMode rebootMode, 
                    String reason)

    Create a RebootDeviceAction to be used when performing a reboot action.

    Thông số
    rebootMode NativeDevice.RebootMode : a mode of this reboot.

    reason String : for this reboot.

    Lợi nhuận
    NativeDevice.RebootDeviceAction the created RebootDeviceAction .

    doAdbReboot

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

    Perform a adb reboot.

    Thông số
    rebootMode NativeDevice.RebootMode : a mode of this reboot.

    reason String : for this reboot.

    Ném
    DeviceNotAvailableException

    ensureRuntimePermissionSupported

    protected void ensureRuntimePermissionSupported ()

    helper method to throw exception if runtime permission isn't supported

    Ném
    DeviceNotAvailableException

    getBugreportInternal

    protected InputStreamSource getBugreportInternal ()

    Lợi nhuận
    InputStreamSource

    getBugreportzInternal

    protected File getBugreportzInternal ()

    Internal Helper method to get the bugreportz zip file as a ERROR(/File) .

    Lợi nhuận
    File

    getRunUtil

    protected IRunUtil getRunUtil ()

    Get the RunUtil instance to use.

    Lợi nhuận
    IRunUtil

    internalGetProperty

    protected String internalGetProperty (String propName, 
                    String fastbootVar, 
                    String description)

    Fetch a device property, from the ddmlib cache by default, and falling back to either `adb shell getprop` or `fastboot getvar` depending on whether the device is in Fastboot or not.

    Thông số
    propName String : The name of the device property as returned by `adb shell getprop`

    fastbootVar String : The name of the equivalent fastboot variable to query. if null , fastboot query will not be attempted

    description String : A simple description of the variable. First letter should be capitalized.

    Lợi nhuận
    String A string, possibly null or empty, containing the value of the given property

    Ném
    DeviceNotAvailableException

    isNewer

    protected boolean isNewer (File localFile, 
                    IFileEntry entry)

    Return true if local file is newer than remote file. IFileEntry being accurate to the minute, in case of equal times, the file will be considered newer.

    Thông số
    localFile File

    entry IFileEntry

    Lợi nhuận
    boolean

    performDeviceAction

    protected boolean performDeviceAction (String actionDescription, 
                    com.android.tradefed.device.NativeDevice.DeviceAction action, 
                    int retryAttempts)

    Performs an action on this device. Attempts to recover device and optionally retry command if action fails.

    Thông số
    actionDescription String : a short description of action to be performed. Used for logging purposes only.

    action com.android.tradefed.device.NativeDevice.DeviceAction : the action to be performed

    retryAttempts int : the retry attempts to make for action if it fails but recovery succeeds

    Lợi nhuận
    boolean true if action was performed successfully

    Ném
    DeviceNotAvailableException if recovery attempt fails or max attempts done without success

    postAdbReboot

    protected void postAdbReboot ()

    Possible extra actions that can be taken after a reboot.

    Ném
    DeviceNotAvailableException

    prePostBootSetup

    protected void prePostBootSetup ()

    Allows each device type (AndroidNativeDevice, TestDevice) to override this method for specific post boot setup.

    Ném
    DeviceNotAvailableException

    pullFileInternal

    protected boolean pullFileInternal (String remoteFilePath, 
                    File localFile)

    Thông số
    remoteFilePath String

    localFile File

    Lợi nhuận
    boolean

    Ném
    DeviceNotAvailableException

    setClock

    protected void setClock (Clock clock)

    Set the Clock instance to use.

    Thông số
    clock Clock

    setLogStartDelay

    protected void setLogStartDelay (int delay)

    Sets the time in ms to wait before starting logcat capture for a online device.

    Thông số
    delay int : the delay in ms

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                     envVarMap, 
                    String[] fullCmd)

    Executes a simple fastboot command with environment variables and report the status of the command.

    Thông số
    timeout long

    envVarMap

    fullCmd String

    Lợi nhuận
    CommandResult

    simpleFastbootCommand

    protected CommandResult simpleFastbootCommand (long timeout, 
                    String[] fullCmd)

    Executes a simple fastboot command and report the status of the command.

    Thông số
    timeout long

    fullCmd String

    Lợi nhuận
    CommandResult

    waitForDeviceNotAvailable

    protected boolean waitForDeviceNotAvailable (String operationDesc, 
                    long time)

    Wait to see the device going unavailable (stop reporting to adb).

    Thông số
    operationDesc String : The name of the operation that is waiting for unavailable.

    time long : The time to wait for unavailable to occur.

    Lợi nhuận
    boolean True if device did become unavailable.