INativeDevice
public interface INativeDevice
com.android.tradefed.device.INativeDevice |
Menyediakan API tingkat yang andal dan sedikit lebih tinggi ke ddmlib IDevice
.
Ringkasan
Konstanta | |
---|---|
int | UNKNOWN_API_LEVEL Nilai default saat API Level tidak dapat dideteksi |
Metode publik | |
---|---|
abstract boolean | checkApiLevelAgainstNextRelease (int strictMinLevel) Periksa apakah suatu fitur saat ini didukung dengan tingkat dukungan minimal. |
abstract void | clearLogcat () Menghapus semua data logcat yang terakumulasi. |
abstract void | deleteFile (String deviceFilePath) Metode pembantu untuk menghapus file atau direktori di perangkat. |
abstract boolean | deviceSoftRestarted ( ProcessInfo prevSystemServerProcess) Metode pembantu untuk memeriksa apakah perangkat soft-restart dengan membandingkan system_server saat ini dengan system_server |
abstract boolean | deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit) Metode helper untuk memeriksa apakah perangkat soft-restart sejak waktu UTC sejak zaman dari perangkat dan |
abstract boolean | disableAdbRoot () Mematikan adb root. |
abstract boolean | doesFileExist (String deviceFilePath) Metode pembantu untuk menentukan apakah ada file di perangkat. |
abstract boolean | enableAdbRoot () Mengaktifkan adb root. |
abstract String | executeAdbCommand (long timeout, String... commandArgs) Metode pembantu yang menjalankan perintah adb sebagai perintah sistem dengan waktu tunggu yang ditentukan. |
abstract String | executeAdbCommand (String... commandArgs) Metode pembantu yang menjalankan perintah adb sebagai perintah sistem. |
abstract String | executeAdbCommand (long timeout, envMap, String... commandArgs) executeAdbCommand (long timeout, envMap, String... commandArgs) Metode pembantu yang menjalankan perintah adb sebagai perintah sistem dengan waktu tunggu yang ditentukan. |
abstract CommandResult | executeFastbootCommand (long timeout, String... commandArgs) Metode pembantu yang menjalankan perintah fastboot sebagai perintah sistem. |
abstract CommandResult | executeFastbootCommand (String... commandArgs) Metode pembantu yang menjalankan perintah fastboot sebagai perintah sistem dengan batas waktu default 2 menit. |
abstract CommandResult | executeLongFastbootCommand (String... commandArgs) Metode pembantu yang menjalankan perintah fastboot yang berjalan lama sebagai perintah sistem. |
abstract CommandResult | executeLongFastbootCommand ( envVarMap, String... commandArgs) executeLongFastbootCommand ( envVarMap, String... commandArgs) Metode pembantu yang menjalankan perintah fastboot yang berjalan lama sebagai perintah sistem dengan variabel lingkungan sistem. |
abstract String | executeShellCommand (String command) Metode helper yang menjalankan perintah adb shell dan menampilkan output sebagai |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts) Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah. |
abstract void | executeShellCommand (String command, IShellOutputReceiver receiver) Mengeksekusi perintah adb shell yang diberikan, mencoba lagi beberapa kali jika perintah gagal. |
abstract CommandResult | executeShellV2Command (String command) Metode helper yang mengeksekusi perintah adb shell dan mengembalikan hasilnya sebagai |
abstract CommandResult | executeShellV2Command (String command, OutputStream pipeToOutput) Metode helper yang mengeksekusi perintah adb shell dan mengembalikan hasilnya sebagai |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput) Metode helper yang mengeksekusi perintah adb shell dan mengembalikan hasilnya sebagai |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah. |
abstract CommandResult | executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit) Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah. |
abstract CommandResult | executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts) Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah. |
abstract CommandResult | fastbootWipePartition (String partition) Metode pembantu yang menghapus partisi untuk perangkat. |
abstract int | getApiLevel () Dapatkan Tingkat API perangkat. |
abstract String | getBasebandVersion () Metode kemudahan untuk mendapatkan versi baseband (radio) perangkat ini. |
abstract Integer | getBattery () Mengembalikan level baterai perangkat saat ini atau Null jika level baterai tidak tersedia. |
abstract boolean | getBooleanProperty (String name, boolean defaultValue) Mengembalikan nilai boolean dari properti yang diberikan. |
abstract | getBootHistory () Metode pembantu mengumpulkan peta riwayat boot dengan waktu boot dan alasan boot. |
abstract | getBootHistorySince (long utcEpochTime, TimeUnit timeUnit) Metode pembantu mengumpulkan peta riwayat boot dengan waktu boot dan alasan boot sejak waktu yang diberikan sejak zaman dari perangkat dan satuan waktu yang ditentukan. |
abstract String | getBootloaderVersion () Metode kenyamanan untuk mendapatkan versi bootloader perangkat ini. |
abstract String | getBuildAlias () Ambil alias build yang sedang dijalankan perangkat. |
abstract String | getBuildFlavor () Ambil ragam build untuk perangkat. |
abstract String | getBuildId () Ambil build perangkat yang sedang berjalan. |
abstract String | getBuildSigningKeys () Mengembalikan jenis kunci yang digunakan untuk menandatangani gambar perangkat Biasanya perangkat Android dapat ditandatangani dengan kunci uji (seperti di AOSP) atau kunci rilis (dikendalikan oleh masing-masing produsen perangkat) |
abstract DeviceDescriptor | getCachedDeviceDescriptor () Mengembalikan |
abstract DeviceDescriptor | getCachedDeviceDescriptor (boolean shortDescriptor) Mengembalikan |
abstract String[] | getChildren (String deviceFilePath) Alternatif untuk menggunakan |
abstract AbstractConnection | getConnection () Mengembalikan koneksi yang terkait dengan perangkat. |
abstract String | getDeviceClass () Dapatkan kelas perangkat. |
abstract long | getDeviceDate () Kembalikan tanggal perangkat dalam milidetik sejak Zaman. |
abstract DeviceDescriptor | getDeviceDescriptor () Kembalikan |
abstract DeviceDescriptor | getDeviceDescriptor (boolean shortDescriptor) Kembalikan |
abstract TestDeviceState | getDeviceState () Dapatkan status perangkat. |
abstract long | getDeviceTimeOffset (Date date) Helper untuk mendapatkan perbedaan waktu antara perangkat dan |
abstract InputStreamSource | getEmulatorOutput () Dapatkan aliran emulator stdout dan stderr |
abstract long | getExternalStoreFreeSpace () Metode pembantu untuk menentukan jumlah ruang kosong pada penyimpanan eksternal perangkat. |
abstract String | getFastbootProductType () Metode kemudahan untuk mendapatkan jenis produk perangkat ini saat dalam mode fastboot. |
abstract String | getFastbootProductVariant () Metode kemudahan untuk mendapatkan jenis produk perangkat ini saat dalam mode fastboot. |
abstract String | getFastbootSerialNumber () Mengembalikan nomor seri mode fastboot. |
abstract String | getFastbootVariable (String variableName) Ambil nilai variabel fastboot yang diberikan dari perangkat. |
abstract IFileEntry | getFileEntry (String path) Ambil referensi ke file jarak jauh di perangkat. |
abstract IDevice | getIDevice () Mengembalikan referensi ke ddmlib |
abstract long | getIntProperty (String name, long defaultValue) Mengembalikan nilai bilangan bulat dari properti yang diberikan dari perangkat. |
abstract long | getLastExpectedRebootTimeMillis () Mengembalikan saat terakhir Tradefed API memicu reboot dalam milidetik sejak EPOCH sebagaimana dikembalikan oleh |
abstract int | getLaunchApiLevel () Dapatkan API Level pertama yang diluncurkan perangkat. |
abstract InputStreamSource | getLogcat () Mengambil aliran snapshot dari data logcat. |
abstract InputStreamSource | getLogcat (int maxBytes) Mengambil aliran snapshot dari |
abstract InputStreamSource | getLogcatDump () Dapatkan dump logcat saat ini untuk perangkat. |
abstract InputStreamSource | getLogcatSince (long date) Mengambil aliran snapshot dari data logcat yang diambil mulai dari tanggal yang diberikan. |
abstract String | getMountPoint (String mountName) Mengembalikan titik pemasangan. |
abstract ITestDevice.MountPointInfo | getMountPointInfo (String mountpoint) Mengembalikan |
abstract | getMountPointInfo () Mengembalikan versi informasi yang diurai di /proc/mounts pada perangkat |
abstract long | getPartitionFreeSpace (String partition) Metode pembantu untuk menentukan jumlah ruang kosong pada partisi perangkat. |
abstract ProcessInfo | getProcessByName (String processName) Metode pembantu menjalankan perintah "pidof" dan "stat" dan mengembalikan objek |
abstract String | getProcessPid (String process) Mengembalikan pid layanan atau nol jika terjadi kesalahan. |
abstract String | getProductType () Metode kemudahan untuk mendapatkan jenis produk perangkat ini. |
abstract String | getProductVariant () Metode kemudahan untuk mendapatkan varian produk perangkat ini. |
abstract String | getProperty (String name) Ambil nilai properti yang diberikan dari perangkat. |
abstract ITestDevice.RecoveryMode | getRecoveryMode () Dapatkan mode pemulihan saat ini yang digunakan untuk perangkat. |
abstract String | getSerialNumber () Metode kemudahan untuk mendapatkan nomor seri perangkat ini. |
abstract | getTombstones () Ambil dan kembalikan daftar batu nisan dari perangkat. |
abstract long | getTotalMemory () Mengembalikan total ukuran memori fisik dalam byte atau -1 jika terjadi kesalahan internal |
abstract boolean | getUseFastbootErase () Dapatkan apakah akan menggunakan fastboot erase atau format fastboot untuk menghapus partisi pada perangkat. |
abstract boolean | isAdbRoot () |
abstract boolean | isAdbTcp () |
abstract boolean | isAppEnumerationSupported () Periksa apakah platform pada perangkat mendukung pencacahan aplikasi |
abstract boolean | isBypassLowTargetSdkBlockSupported () Periksa apakah platform pada perangkat mendukung melewati blok sdk target rendah pada penginstalan aplikasi |
abstract boolean | isDeviceEncrypted () Mengembalikan jika perangkat dienkripsi. |
abstract boolean | isDirectory (String deviceFilePath) Kembalikan True jika jalur pada perangkat adalah direktori, salah jika sebaliknya. |
abstract boolean | isEncryptionSupported () Mengembalikan jika enkripsi didukung pada perangkat. |
abstract boolean | isExecutable (String fullPath) Mengembalikan True jika jalur file pada perangkat adalah file yang dapat dieksekusi, salah jika sebaliknya. |
abstract boolean | isHeadless () Kembalikan benar jika perangkat tanpa kepala (tanpa layar), salah jika sebaliknya. |
abstract boolean | isRuntimePermissionSupported () Periksa apakah platform pada perangkat mendukung pemberian izin runtime |
abstract boolean | isStateBootloaderOrFastbootd () Mengembalikan nilai true jika perangkat dalam |
abstract boolean | logAnrs ( ITestLogger logger) Mengumpulkan dan mencatat ANR dari perangkat. |
abstract void | logOnDevice (String tag, Log.LogLevel level, String format, Object... args) Catat pesan di logcat perangkat. |
abstract void | nonBlockingReboot () Mengeluarkan perintah untuk mem-boot ulang perangkat dan mengembalikan perintah selesai dan saat perangkat tidak lagi terlihat oleh adb. |
abstract void | postBootSetup () Lakukan instruksi untuk mengonfigurasi perangkat untuk mengujinya setelah setiap boot. |
default void | postInvocationTearDown () Metode ini sudah usang. Gunakan |
abstract void | postInvocationTearDown (Throwable invocationException) Langkah ekstra untuk pembersihan khusus perangkat yang diperlukan yang akan dijalankan setelah pemanggilan dilakukan. |
default void | preInvocationSetup ( IBuildInfo info, MultiMap <String, String> attributes) Langkah ekstra untuk penyiapan khusus perangkat yang diperlukan yang akan dijalankan pada perangkat sebelum aliran permintaan. |
abstract boolean | pullDir (String deviceFilePath, File localDir) Tarik konten direktori secara rekursif dari perangkat. |
abstract File | pullFile (String remoteFilePath, int userId) Mengambil file dari perangkat, menyimpannya di |
abstract File | pullFile (String remoteFilePath) Mengambil file dari perangkat, menyimpannya di |
abstract boolean | pullFile (String remoteFilePath, File localFile) Mengambil file dari perangkat. |
abstract boolean | pullFile (String remoteFilePath, File localFile, int userId) Mengambil file dari perangkat. |
abstract String | pullFileContents (String remoteFilePath) Mengambil file dari perangkat, dan mengembalikan isinya. |
abstract File | pullFileFromExternal (String remoteFilePath) Metode praktis untuk mengambil file dari penyimpanan eksternal perangkat, menyimpannya di |
abstract boolean | pushDir (File localDir, String deviceFilePath, excludedDirectories) pushDir (File localDir, String deviceFilePath, excludedDirectories) Dorong konten direktori secara rekursif ke perangkat sambil mengecualikan beberapa direktori yang difilter. |
abstract boolean | pushDir (File localDir, String deviceFilePath) Mendorong konten direktori secara rekursif ke perangkat. |
abstract boolean | pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded) Varian dari |
abstract boolean | pushFile (File localFile, String deviceFilePath) Dorong file ke perangkat. |
abstract boolean | pushString (String contents, String deviceFilePath) Dorong file yang dibuat dari string ke perangkat |
abstract void | reboot () Reboot perangkat ke mode adb. |
abstract void | reboot (String reason) Reboot perangkat ke mode adb dengan |
abstract void | rebootIntoBootloader () Reboot perangkat ke mode bootloader. |
abstract void | rebootIntoFastbootd () Nyalakan ulang perangkat ke mode fastbootd. |
abstract void | rebootIntoRecovery () Nyalakan ulang perangkat ke mode pemulihan adb. |
abstract void | rebootIntoSideload (boolean autoReboot) Nyalakan ulang perangkat ke mode adb sideload (perhatikan bahwa ini adalah mode khusus dalam pemulihan) Memblokir hingga perangkat memasuki mode sideload |
abstract void | rebootIntoSideload () Nyalakan ulang perangkat ke mode adb sideload (perhatikan bahwa ini adalah mode khusus dalam pemulihan) Memblokir hingga perangkat memasuki mode sideload |
abstract void | rebootUntilOnline () Alternatif untuk |
abstract void | rebootUntilOnline (String reason) Alternatif untuk |
abstract void | rebootUserspace () Reboot hanya bagian ruang pengguna dari perangkat. |
abstract void | rebootUserspaceUntilOnline () Alternatif untuk |
abstract void | remountSystemReadOnly () Jadikan partisi sistem pada perangkat hanya-baca. |
abstract void | remountSystemWritable () Jadikan partisi sistem pada perangkat dapat ditulisi. |
abstract void | remountVendorReadOnly () Jadikan partisi vendor pada perangkat hanya-baca. |
abstract void | remountVendorWritable () Jadikan partisi vendor pada perangkat dapat ditulisi. |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners) Metode praktis untuk melakukan |
abstract boolean | runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) runInstrumentationTests (IRemoteAndroidTestRunner runner, listeners) Menjalankan uji instrumentasi, dan menyediakan pemulihan perangkat. |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, listeners) Sama seperti |
abstract boolean | runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners) Sama seperti |
abstract void | setDate (Date date) Mengatur tanggal pada perangkat Catatan: pengaturan tanggal pada perangkat memerlukan root |
abstract void | setOptions ( TestDeviceOptions options) Setel |
abstract boolean | setProperty (String propKey, String propValue) Menetapkan nilai properti yang diberikan pada perangkat. |
abstract void | setRecovery ( IDeviceRecovery recovery) Setel |
abstract void | setRecoveryMode ( ITestDevice.RecoveryMode mode) Atur mode pemulihan saat ini untuk digunakan pada perangkat. |
abstract void | setUseFastbootErase (boolean useFastbootErase) Setel apakah akan menggunakan penghapusan fastboot atau format fastboot untuk menghapus partisi pada perangkat. |
abstract void | startLogcat () Mulai merekam keluaran logcat dari perangkat di latar belakang. |
abstract void | stopEmulatorOutput () Tutup dan hapus keluaran emulator. |
abstract void | stopLogcat () Berhenti menangkap keluaran logcat dari perangkat, dan buang data logcat yang saat ini disimpan. |
abstract String | switchToAdbTcp () Alihkan perangkat ke mode adb-over-tcp. |
abstract boolean | switchToAdbUsb () Alihkan perangkat ke adb melalui mode usb. |
abstract boolean | syncFiles (File localFileDir, String deviceFilePath) Menyinkronkan konten direktori file lokal ke perangkat secara bertahap. |
abstract boolean | unlockDevice () Buka kunci perangkat jika perangkat dalam keadaan terenkripsi. |
abstract boolean | waitForBootComplete (long timeOut) Memblokir hingga bendera selesai booting perangkat disetel. |
abstract boolean | waitForDeviceAvailable () Menunggu perangkat menjadi responsif dan tersedia untuk pengujian. |
abstract boolean | waitForDeviceAvailable (long waitTime) Menunggu perangkat menjadi responsif dan tersedia untuk pengujian. |
abstract boolean | waitForDeviceAvailableInRecoverPath (long waitTime) Menunggu perangkat menjadi responsif dan tersedia tanpa mempertimbangkan jalur pemulihan. |
abstract void | waitForDeviceBootloader () Memblokir hingga perangkat terlihat melalui fastboot. |
abstract boolean | waitForDeviceInRecovery (long waitTime) Memblokir agar perangkat berada dalam status 'adb recovery' (perhatikan bahwa ini berbeda dari |
abstract boolean | waitForDeviceInSideload (long waitTime) Memblokir agar perangkat berada dalam status 'adb sideload' |
abstract boolean | waitForDeviceNotAvailable (long waitTime) Blokir agar perangkat tidak tersedia yaitu hilang dari adb |
abstract void | waitForDeviceOnline () Memblokir hingga perangkat terlihat melalui adb. |
abstract void | waitForDeviceOnline (long waitTime) Memblokir hingga perangkat terlihat melalui adb. |
abstract boolean | waitForDeviceShell (long waitTime) Menunggu perangkat responsif terhadap perintah dasar adb shell. |
Konstanta
UNKNOWN_API_LEVEL
public static final int UNKNOWN_API_LEVEL
Nilai default saat API Level tidak dapat dideteksi
Nilai Konstan: -1 (0xffffffff)
Metode publik
checkApiLevelAgainstNextRilis
public abstract boolean checkApiLevelAgainstNextRelease (int strictMinLevel)
Periksa apakah suatu fitur saat ini didukung dengan tingkat dukungan minimal. Metode ini memperhitungkan fitur yang belum dirilis, sebelum level API dinaikkan.
Parameter | |
---|---|
strictMinLevel | int : Tingkat kemungkinan min yang ketat yang mendukung fitur ini. |
Pengembalian | |
---|---|
boolean | Benar jika level didukung. Salah sebaliknya. |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
clearLogcat
public abstract void clearLogcat ()
Menghapus semua data logcat yang terakumulasi.
Ini berguna untuk kasus ketika Anda ingin memastikanITestDevice#getLogcat()
hanya mengembalikan data log yang dihasilkan setelah titik tertentu (seperti setelah mem-flash build perangkat baru, dll). menghapus berkas
public abstract void deleteFile (String deviceFilePath)
Metode pembantu untuk menghapus file atau direktori di perangkat.
Parameter | |
---|---|
deviceFilePath | String : Jalur absolut file di perangkat. |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestarted
public abstract boolean deviceSoftRestarted (ProcessInfo prevSystemServerProcess)
Metode pembantu untuk memeriksa apakah perangkat soft-restart dengan membandingkan system_server saat ini dengan system_server ProcessInfo
sebelumnya. Gunakan getProcessByName(String)
untuk mendapatkan ProcessInfo
.
Parameter | |
---|---|
prevSystemServerProcess | ProcessInfo : proses system_server ProcessInfo sebelumnya. |
Pengembalian | |
---|---|
boolean | true jika perangkat di-restart dengan lembut |
Melempar | |
---|---|
RuntimeException | jika perangkat memiliki alasan boot yang tidak normal |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
deviceSoftRestartedSince
public abstract boolean deviceSoftRestartedSince (long utcEpochTime, TimeUnit timeUnit)
Metode helper untuk memeriksa apakah perangkat soft-restart sejak waktu UTC sejak zaman dari perangkat dan ERROR(/TimeUnit)
nya. Soft-Restart mengacu pada system_server yang dimulai ulang di luar hard reboot perangkat (misalnya: meminta reboot). Perangkat saat ini utcEpochTime dalam Milidetik dapat diperoleh dengan metode getDeviceDate()
.
Parameter | |
---|---|
utcEpochTime | long : waktu perangkat dalam detik sejak zaman. |
timeUnit | TimeUnit : satuan waktu TimeUnit untuk utcEpochTime yang diberikan. |
Pengembalian | |
---|---|
boolean | true jika perangkat di-restart dengan lembut |
Melempar | |
---|---|
RuntimeException | jika perangkat memiliki alasan boot yang tidak normal |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
nonaktifkan AdbRoot
public abstract boolean disableAdbRoot ()
Mematikan adb root.
Menonaktifkan root adb dapat menyebabkan perangkat terputus dari adb. Metode ini akan memblokir hingga perangkat tersedia.Pengembalian | |
---|---|
boolean | true jika berhasil. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
doesFileExist
public abstract boolean doesFileExist (String deviceFilePath)
Metode pembantu untuk menentukan apakah ada file di perangkat.
Parameter | |
---|---|
deviceFilePath | String : jalur absolut file pada perangkat untuk diperiksa |
Pengembalian | |
---|---|
boolean | true jika file ada, false jika tidak. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
aktifkanAdbRoot
public abstract boolean enableAdbRoot ()
Mengaktifkan adb root. Jika pengaturan "aktifkan-root" adalah "false", akan mencatat pesan dan kembali tanpa mengaktifkan root.
Mengaktifkan root adb dapat menyebabkan perangkat terputus dari adb. Metode ini akan memblokir hingga perangkat tersedia.Pengembalian | |
---|---|
boolean | true jika berhasil. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
mengeksekusiAdbCommand
public abstract String executeAdbCommand (long timeout, String... commandArgs)
Metode pembantu yang menjalankan perintah adb sebagai perintah sistem dengan waktu tunggu yang ditentukan.
executeShellCommand(String)
harus digunakan sebagai gantinya sedapat mungkin, karena metode itu memberikan deteksi dan kinerja kegagalan yang lebih baik.
Parameter | |
---|---|
timeout | long : waktu dalam milidetik sebelum perangkat dianggap tidak responsif, 0L tanpa batas waktu |
commandArgs | String : perintah dan argumen adb untuk dijalankan |
Pengembalian | |
---|---|
String | stdout dari perintah. null jika perintah gagal dijalankan. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
mengeksekusiAdbCommand
public abstract String executeAdbCommand (String... commandArgs)
Metode pembantu yang menjalankan perintah adb sebagai perintah sistem.
executeShellCommand(String)
harus digunakan sebagai gantinya sedapat mungkin, karena metode itu memberikan deteksi dan kinerja kegagalan yang lebih baik.Parameter | |
---|---|
commandArgs | String : perintah dan argumen adb untuk dijalankan |
Pengembalian | |
---|---|
String | stdout dari perintah. null jika perintah gagal dijalankan. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
mengeksekusiAdbCommand
public abstract String executeAdbCommand (long timeout,envMap, String... commandArgs)
Metode pembantu yang menjalankan perintah adb sebagai perintah sistem dengan waktu tunggu yang ditentukan.
executeShellCommand(String)
harus digunakan sebagai gantinya sedapat mungkin, karena metode itu memberikan deteksi dan kinerja kegagalan yang lebih baik.
Parameter | |
---|---|
timeout | long : waktu dalam milidetik sebelum perangkat dianggap tidak responsif, 0L tanpa batas waktu |
envMap | |
commandArgs | String : perintah dan argumen adb untuk dijalankan |
Pengembalian | |
---|---|
String | stdout dari perintah. null jika perintah gagal dijalankan. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah Fastboot
public abstract CommandResult executeFastbootCommand (long timeout, String... commandArgs)
Metode pembantu yang menjalankan perintah fastboot sebagai perintah sistem.
Diharapkan untuk digunakan saat perangkat sudah dalam mode fastboot.Parameter | |
---|---|
timeout | long : waktu dalam milidetik sebelum perintah berakhir |
commandArgs | String : perintah fastboot dan argumen untuk dijalankan |
Pengembalian | |
---|---|
CommandResult | CommandResult berisi output dari perintah |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah Fastboot
public abstract CommandResult executeFastbootCommand (String... commandArgs)
Metode pembantu yang menjalankan perintah fastboot sebagai perintah sistem dengan batas waktu default 2 menit.
Diharapkan untuk digunakan saat perangkat sudah dalam mode fastboot.
Parameter | |
---|---|
commandArgs | String : perintah fastboot dan argumen untuk dijalankan |
Pengembalian | |
---|---|
CommandResult | CommandResult berisi output dari perintah |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
mengeksekusiLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (String... commandArgs)
Metode pembantu yang menjalankan perintah fastboot yang berjalan lama sebagai perintah sistem.
Identik denganexecuteFastbootCommand(String)
kecuali menggunakan batas waktu yang lebih lama.Parameter | |
---|---|
commandArgs | String : perintah fastboot dan argumen untuk dijalankan |
Pengembalian | |
---|---|
CommandResult | CommandResult berisi output dari perintah |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
mengeksekusiLongFastbootCommand
public abstract CommandResult executeLongFastbootCommand (envVarMap, String... commandArgs)
Metode pembantu yang menjalankan perintah fastboot yang berjalan lama sebagai perintah sistem dengan variabel lingkungan sistem.
Identik dengan executeFastbootCommand(String)
kecuali menggunakan batas waktu yang lebih lama.
Parameter | |
---|---|
envVarMap | |
commandArgs | String : perintah fastboot dan argumen untuk dijalankan |
Pengembalian | |
---|---|
CommandResult | CommandResult berisi output dari perintah |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah Shell
public abstract String executeShellCommand (String command)
Metode helper yang menjalankan perintah adb shell dan menampilkan output sebagai String
.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
Pengembalian | |
---|---|
String | keluaran cangkang |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah Shell
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
receiver | IShellOutputReceiver : IShellOutputReceiver untuk mengarahkan keluaran shell. |
maxTimeToOutputShellResponse | long : jumlah waktu maksimum selama perintah diizinkan untuk tidak menampilkan respons apa pun; unit seperti yang ditentukan dalam timeUnit |
timeUnit | TimeUnit : unit untuk maxTimeToOutputShellResponse |
retryAttempts | int : jumlah maksimum untuk mencoba kembali perintah jika gagal karena pengecualian. DeviceNotResponsiveException akan dilempar jika retryAttempts dilakukan tanpa hasil. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah Shell
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver, long maxTimeoutForCommand, long maxTimeToOutputShellResponse, TimeUnit timeUnit, int retryAttempts)
Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
receiver | IShellOutputReceiver : IShellOutputReceiver untuk mengarahkan keluaran shell. |
maxTimeoutForCommand | long : batas waktu maksimum untuk menyelesaikan perintah; unit seperti yang ditentukan dalam timeUnit |
maxTimeToOutputShellResponse | long : jumlah waktu maksimum selama perintah diizinkan untuk tidak menampilkan respons apa pun; unit seperti yang ditentukan dalam timeUnit |
timeUnit | TimeUnit : unit untuk maxTimeToOutputShellResponse |
retryAttempts | int : jumlah maksimum untuk mencoba kembali perintah jika gagal karena pengecualian. DeviceNotResponsiveException akan dilempar jika retryAttempts dilakukan tanpa hasil. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah Shell
public abstract void executeShellCommand (String command, IShellOutputReceiver receiver)
Mengeksekusi perintah adb shell yang diberikan, mencoba lagi beberapa kali jika perintah gagal.
Bentuk yang lebih sederhana dariexecuteShellCommand(String, com.android.ddmlib.IShellOutputReceiver, long, TimeUnit, int)
dengan nilai default.Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
receiver | IShellOutputReceiver : IShellOutputReceiver untuk mengarahkan keluaran shell. |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command)
Metode helper yang mengeksekusi perintah adb shell dan mengembalikan hasilnya sebagai CommandResult
diisi dengan benar dengan output status perintah, stdout dan stderr.
Parameter | |
---|---|
command | String : Perintah yang harus dijalankan. |
Pengembalian | |
---|---|
CommandResult | Hasilnya di CommandResult . |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command, OutputStream pipeToOutput)
Metode helper yang mengeksekusi perintah adb shell dan mengembalikan hasilnya sebagai CommandResult
yang diisi dengan benar dengan output status perintah dan stderr. stdout diarahkan ke aliran yang ditentukan.
Parameter | |
---|---|
command | String : Perintah yang harus dijalankan. |
pipeToOutput | OutputStream : ERROR(/OutputStream) di mana output std akan dialihkan, atau nol. |
Pengembalian | |
---|---|
CommandResult | Hasilnya di CommandResult . |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput)
Metode helper yang mengeksekusi perintah adb shell dan mengembalikan hasilnya sebagai CommandResult
yang diisi dengan benar dengan output status perintah, stdout, dan stderr.
Parameter | |
---|---|
command | String : Perintah yang harus dijalankan. |
pipeAsInput | File : ERROR(/File) yang akan disalurkan sebagai input ke perintah, atau null. |
Pengembalian | |
---|---|
CommandResult | Hasilnya di CommandResult . |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
maxTimeoutForCommand | long : batas waktu maksimum untuk menyelesaikan perintah; unit seperti yang ditentukan dalam timeUnit |
timeUnit | TimeUnit : unit untuk maxTimeToOutputShellResponse |
retryAttempts | int : jumlah maksimum untuk mencoba kembali perintah jika gagal karena pengecualian. DeviceNotResponsiveException akan dilempar jika retryAttempts dilakukan tanpa hasil. |
Pengembalian | |
---|---|
CommandResult |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
Lihat juga:
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command, long maxTimeoutForCommand, TimeUnit timeUnit)
Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
maxTimeoutForCommand | long : batas waktu maksimum untuk menyelesaikan perintah; unit seperti yang ditentukan dalam timeUnit |
timeUnit | TimeUnit : unit untuk maxTimeToOutputShellResponse |
Pengembalian | |
---|---|
CommandResult |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
Lihat juga:
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
pipeAsInput | File : ERROR(/File) yang akan disalurkan sebagai input ke perintah, atau null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) di mana output std akan dialihkan, atau nol. |
maxTimeoutForCommand | long : batas waktu maksimum untuk menyelesaikan perintah; unit seperti yang ditentukan dalam timeUnit |
timeUnit | TimeUnit : unit untuk maxTimeToOutputShellResponse |
retryAttempts | int : jumlah maksimum untuk mencoba kembali perintah jika gagal karena pengecualian. DeviceNotResponsiveException akan dilempar jika retryAttempts dilakukan tanpa hasil. |
Pengembalian | |
---|---|
CommandResult |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
Lihat juga:
jalankan Perintah ShellV2
public abstract CommandResult executeShellV2Command (String command, File pipeAsInput, OutputStream pipeToOutput, OutputStream pipeToError, long maxTimeoutForCommand, TimeUnit timeUnit, int retryAttempts)
Menjalankan perintah shell adb, dengan lebih banyak parameter untuk mengontrol perilaku perintah.
Parameter | |
---|---|
command | String : perintah adb shell untuk dijalankan |
pipeAsInput | File : ERROR(/File) yang akan disalurkan sebagai input ke perintah, atau null. |
pipeToOutput | OutputStream : ERROR(/OutputStream) di mana output std akan dialihkan, atau nol. |
pipeToError | OutputStream : ERROR(/OutputStream) di mana kesalahan std akan dialihkan, atau nol. |
maxTimeoutForCommand | long : batas waktu maksimum untuk menyelesaikan perintah; unit seperti yang ditentukan dalam timeUnit |
timeUnit | TimeUnit : unit untuk maxTimeToOutputShellResponse |
retryAttempts | int : jumlah maksimum untuk mencoba kembali perintah jika gagal karena pengecualian. DeviceNotResponsiveException akan dilempar jika retryAttempts dilakukan tanpa hasil. |
Pengembalian | |
---|---|
CommandResult |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
Lihat juga:
fastbootWipePartition
public abstract CommandResult fastbootWipePartition (String partition)
Metode pembantu yang menghapus partisi untuk perangkat.
JikagetUseFastbootErase()
true
, maka fastboot erase akan digunakan untuk menghapus partisi. Perangkat kemudian harus membuat sistem file saat berikutnya perangkat melakukan booting. Jika tidak, format fastboot digunakan yang akan membuat sistem file baru di perangkat. Diharapkan untuk digunakan saat perangkat sudah dalam mode fastboot.Parameter | |
---|---|
partition | String : partisi yang akan dihapus |
Pengembalian | |
---|---|
CommandResult | CommandResult berisi output dari perintah |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
getApiLevel
public abstract int getApiLevel ()
Dapatkan Tingkat API perangkat. Bawaan ke UNKNOWN_API_LEVEL
.
Pengembalian | |
---|---|
int | bilangan bulat yang menunjukkan API Level perangkat |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBasebandVersion
public abstract String getBasebandVersion ()
Metode kemudahan untuk mendapatkan versi baseband (radio) perangkat ini. Mendapatkan versi radio adalah khusus perangkat, sehingga mungkin tidak mengembalikan informasi yang benar untuk semua perangkat. Metode ini mengandalkan properti gsm.version.baseband untuk mengembalikan informasi versi yang benar. Ini tidak akurat untuk beberapa perangkat CDMA dan versi yang dikembalikan di sini mungkin tidak cocok dengan versi yang dilaporkan dari fastboot dan mungkin tidak mengembalikan versi untuk radio CDMA. TL; DR metode ini hanya melaporkan versi yang akurat jika properti gsm.version.baseband sama dengan versi yang dikembalikan oleh fastboot getvar version-baseband
.
Pengembalian | |
---|---|
String | versi String baseband atau null jika tidak dapat ditentukan (perangkat tidak memiliki radio atau string versi tidak dapat dibaca) |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
getBattery
public abstract Integer getBattery ()
Mengembalikan level baterai perangkat saat ini atau Null jika level baterai tidak tersedia.
Pengembalian | |
---|---|
Integer |
getBooleanProperty
public abstract boolean getBooleanProperty (String name, boolean defaultValue)
Mengembalikan nilai boolean dari properti yang diberikan.
Parameter | |
---|---|
name | String : nama properti |
defaultValue | boolean : nilai default untuk dikembalikan jika properti kosong atau tidak ada. |
Pengembalian | |
---|---|
boolean | true jika properti bernilai "1" , "y" , "yes" , "on" , atau "true" , false jika properti bernilai "0" , "n" , "no" , "off" , "false" , atau defaultValue sebaliknya. |
Melempar | |
---|---|
DeviceNotAvailableException |
getBootHistory
public abstractgetBootHistory ()
Metode pembantu mengumpulkan peta riwayat boot dengan waktu boot dan alasan boot.
Pengembalian | |
---|---|
Peta waktu boot (waktu UTC dalam detik sejak Epoch) dan alasan boot |
Melempar | |
---|---|
DeviceNotAvailableException |
getBootHistorySince
public abstractgetBootHistorySince (long utcEpochTime, TimeUnit timeUnit)
Metode pembantu mengumpulkan peta riwayat boot dengan waktu boot dan alasan boot sejak waktu yang diberikan sejak zaman dari perangkat dan satuan waktu yang ditentukan. Perangkat saat ini utcEpochTime dalam Milidetik dapat diperoleh dengan metode getDeviceDate()
.
Parameter | |
---|---|
utcEpochTime | long : waktu perangkat sejak Epoch. |
timeUnit | TimeUnit : satuan waktu TimeUnit . |
Pengembalian | |
---|---|
Peta waktu boot (waktu UTC dalam detik sejak Epoch) dan alasan boot |
Melempar | |
---|---|
DeviceNotAvailableException |
getBootloaderVersion
public abstract String getBootloaderVersion ()
Metode kenyamanan untuk mendapatkan versi bootloader perangkat ini.
Akan mencoba mengambil versi bootloader dari status perangkat saat ini. (yaitu jika perangkat dalam mode fastboot, itu akan mencoba untuk mengambil versi dari fastboot)Pengembalian | |
---|---|
String | versi String bootloader atau null jika tidak dapat ditemukan |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
getBuildAlias
public abstract String getBuildAlias ()
Ambil alias build yang sedang dijalankan perangkat.
Build alias biasanya berupa string yang lebih mudah dibaca daripada build id (biasanya angka untuk build Nexus). Misalnya, rilis final Android 4.2 memiliki build alias JDQ39, dan build id 573038
Pengembalian | |
---|---|
String | alias build atau mundur ke build id jika tidak dapat diambil |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildFlavour
public abstract String getBuildFlavor ()
Ambil ragam build untuk perangkat.
Pengembalian | |
---|---|
String | build flavor atau null jika tidak dapat diambil |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildId
public abstract String getBuildId ()
Ambil build perangkat yang sedang berjalan.
Pengembalian | |
---|---|
String | build id atau IBuildInfo#UNKNOWN_BUILD_ID jika tidak dapat diambil |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getBuildSigningKeys
public abstract String getBuildSigningKeys ()
Mengembalikan jenis kunci yang digunakan untuk menandatangani gambar perangkat
Biasanya perangkat Android dapat ditandatangani dengan kunci uji (seperti di AOSP) atau kunci rilis (dikendalikan oleh masing-masing produsen perangkat)
Pengembalian | |
---|---|
String | Kunci penandatanganan jika ditemukan, null jika tidak. |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor ()
Mengembalikan DeviceDescriptor
yang di-cache jika perangkat dialokasikan, jika tidak mengembalikan DeviceDescriptor
saat ini.
Pengembalian | |
---|---|
DeviceDescriptor |
getCachedDeviceDescriptor
public abstract DeviceDescriptor getCachedDeviceDescriptor (boolean shortDescriptor)
Mengembalikan DeviceDescriptor
yang di-cache jika perangkat dialokasikan, jika tidak mengembalikan DeviceDescriptor
saat ini.
Parameter | |
---|---|
shortDescriptor | boolean : Apakah membatasi deskriptor untuk info minimum atau tidak |
Pengembalian | |
---|---|
DeviceDescriptor |
getChildren
public abstract String[] getChildren (String deviceFilePath)
Alternatif untuk menggunakan IFileEntry
yang terkadang tidak berfungsi karena izin.
Parameter | |
---|---|
deviceFilePath | String : adalah jalur pada perangkat tempat melakukan pencarian |
Pengembalian | |
---|---|
String[] | Larik string yang berisi semua file di jalur pada perangkat. |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getConnection
public abstract AbstractConnection getConnection ()
Mengembalikan koneksi yang terkait dengan perangkat.
Pengembalian | |
---|---|
AbstractConnection |
getDeviceClass
public abstract String getDeviceClass ()
Dapatkan kelas perangkat.
Pengembalian | |
---|---|
String | kelas perangkat String . |
getDeviceDate
public abstract long getDeviceDate ()
Kembalikan tanggal perangkat dalam milidetik sejak Zaman.
Pengembalian | |
---|---|
long | tanggal perangkat dalam format zaman. |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor ()
Kembalikan DeviceDescriptor
dari informasi perangkat untuk mendapatkan info tentangnya tanpa meneruskan objek perangkat yang sebenarnya.
Pengembalian | |
---|---|
DeviceDescriptor |
getDeviceDescriptor
public abstract DeviceDescriptor getDeviceDescriptor (boolean shortDescriptor)
Kembalikan DeviceDescriptor
dari informasi perangkat untuk mendapatkan info tentangnya tanpa meneruskan objek perangkat yang sebenarnya.
Parameter | |
---|---|
shortDescriptor | boolean : Apakah membatasi deskriptor untuk info minimum atau tidak |
Pengembalian | |
---|---|
DeviceDescriptor |
getDeviceState
public abstract TestDeviceState getDeviceState ()
Dapatkan status perangkat.
Pengembalian | |
---|---|
TestDeviceState |
getDeviceTimeOffset
public abstract long getDeviceTimeOffset (Date date)
Helper untuk mendapatkan perbedaan waktu antara perangkat dan ERROR(/Date)
yang diberikan. Gunakan waktu Epoch secara internal.
Parameter | |
---|---|
date | Date |
Pengembalian | |
---|---|
long | perbedaan dalam milidetik |
Melempar | |
---|---|
DeviceNotAvailableException |
getEmulatorOutput
public abstract InputStreamSource getEmulatorOutput ()
Dapatkan aliran emulator stdout dan stderr
Pengembalian | |
---|---|
InputStreamSource | keluaran emulator |
getExternalStoreFreeSpace
public abstract long getExternalStoreFreeSpace ()
Metode pembantu untuk menentukan jumlah ruang kosong pada penyimpanan eksternal perangkat.
Pengembalian | |
---|---|
long | jumlah ruang kosong di KB |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
getFastbootProductType
public abstract String getFastbootProductType ()
Metode kemudahan untuk mendapatkan jenis produk perangkat ini saat dalam mode fastboot.
Metode ini hanya boleh digunakan jika perangkat harus dalam fastboot. Variannya sedikit lebih aman daripada metode generikgetProductType()
dalam kasus ini, karena ITestDevice akan mengetahui cara memulihkan perangkat ke fastboot jika perangkat dalam keadaan salah atau tidak responsif.Pengembalian | |
---|---|
String | nama jenis produk String atau null jika tidak dapat ditentukan |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
getFastbootProductVariant
public abstract String getFastbootProductVariant ()
Metode kemudahan untuk mendapatkan jenis produk perangkat ini saat dalam mode fastboot.
Metode ini hanya boleh digunakan jika perangkat harus dalam fastboot. Variannya sedikit lebih aman daripada metode generikgetProductType()
dalam kasus ini, karena ITestDevice akan mengetahui cara memulihkan perangkat ke fastboot jika perangkat dalam keadaan salah atau tidak responsif.Pengembalian | |
---|---|
String | nama jenis produk String atau null jika tidak dapat ditentukan |
Melempar | |
---|---|
DeviceNotAvailableException | jika koneksi dengan perangkat terputus dan tidak dapat dipulihkan. |
getFastbootSerialNumber
public abstract String getFastbootSerialNumber ()
Mengembalikan nomor seri mode fastboot.
Pengembalian | |
---|---|
String |
getFastbootVariable
public abstract String getFastbootVariable (String variableName)
Ambil nilai variabel fastboot yang diberikan dari perangkat.
Parameter | |
---|---|
variableName | String : nama variabel |
Pengembalian | |
---|---|
String | nilai properti atau null jika tidak ada |
Melempar | |
---|---|
| UnsupportedOperationException |
DeviceNotAvailableException |
getFileEntry
public abstract IFileEntry getFileEntry (String path)
Ambil referensi ke file jarak jauh di perangkat.
Parameter | |
---|---|
path | String : jalur file untuk diambil. Bisa berupa jalur absolut atau jalur relatif ke '/'. (yaitu sintaks "/system" dan "system" didukung) |
Pengembalian | |
---|---|
IFileEntry | IFileEntry atau null jika file di path yang diberikan tidak dapat ditemukan |
Melempar | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getIDevice
public abstract IDevice getIDevice ()
Mengembalikan referensi ke ddmlib IDevice
terkait.
IDevice
baru dapat dialokasikan oleh DDMS setiap kali perangkat terputus dan terhubung kembali dari adb. Oleh karena itu penelepon tidak boleh menyimpan referensi ke IDevice
, karena referensi tersebut dapat menjadi basi.Pengembalian | |
---|---|
IDevice | IDevice |
getIntProperty
public abstract long getIntProperty (String name, long defaultValue)
Mengembalikan nilai bilangan bulat dari properti yang diberikan dari perangkat.
Parameter | |
---|---|
name | String : nama properti |
defaultValue | long : default value to return if property is empty or doesn't exist. |
Pengembalian | |
---|---|
long | the property value or defaultValue if the property is empty, doesn't exist, or doesn't have an integer value. |
Throws | |
---|---|
DeviceNotAvailableException |
getLastExpectedRebootTimeMillis
public abstract long getLastExpectedRebootTimeMillis ()
Returns the last time Tradefed APIs triggered a reboot in milliseconds since EPOCH as returned by System.currentTimeMillis()
.
Pengembalian | |
---|---|
long |
getLaunchApiLevel
public abstract int getLaunchApiLevel ()
Get the device's first launched API Level. Defaults to UNKNOWN_API_LEVEL
.
Pengembalian | |
---|---|
int | an integer indicating the first launched API Level of device |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getLogcat
public abstract InputStreamSource getLogcat ()
Grabs a snapshot stream of the logcat data.
Works in two modes:
TestDeviceOptions.getMaxLogcatDataSize()
bytes of the current contents of the background logcat capturePengembalian | |
---|---|
InputStreamSource |
getLogcat
public abstract InputStreamSource getLogcat (int maxBytes)
Grabs a snapshot stream of the last maxBytes
of captured logcat data.
Useful for cases when you want to capture frequent snapshots of the captured logcat data without incurring the potentially big disk space penalty of getting the entire getLogcat()
snapshot.
Parameter | |
---|---|
maxBytes | int : the maximum amount of data to return. Should be an amount that can comfortably fit in memory |
Pengembalian | |
---|---|
InputStreamSource |
getLogcatDump
public abstract InputStreamSource getLogcatDump ()
Get a dump of the current logcat for device. Unlike getLogcat()
, this method will always return a static dump of the logcat.
Has the disadvantage that nothing will be returned if device is not reachable.
Pengembalian | |
---|---|
InputStreamSource | a InputStreamSource of the logcat data. An empty stream is returned if fail to capture logcat data. |
getLogcatSince
public abstract InputStreamSource getLogcatSince (long date)
Grabs a snapshot stream of captured logcat data starting the date provided. The time on the device should be used getDeviceDate()
.
Parameter | |
---|---|
date | long : in millisecond since epoch format of when to start the snapshot until present. (can be be obtained using 'date +%s') |
Pengembalian | |
---|---|
InputStreamSource |
getMountPoint
public abstract String getMountPoint (String mountName)
Returns a mount point.
Queries the device directly if the cached info inIDevice
is not available. TODO: move this behavior to IDevice#getMountPoint(String)
Parameter | |
---|---|
mountName | String : the name of the mount point |
Pengembalian | |
---|---|
String | the mount point or null |
See also:
getMountPointInfo
public abstract ITestDevice.MountPointInfo getMountPointInfo (String mountpoint)
Returns a MountPointInfo
corresponding to the specified mountpoint path, or null
if that path has nothing mounted or otherwise does not appear in /proc/mounts as a mountpoint.
Parameter | |
---|---|
mountpoint | String |
Pengembalian | |
---|---|
ITestDevice.MountPointInfo | A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Throws | |
---|---|
DeviceNotAvailableException |
See also:
getMountPointInfo
public abstractgetMountPointInfo ()
Returns a parsed version of the information in /proc/mounts on the device
Pengembalian | |
---|---|
A ERROR(/List) of MountPointInfo containing the information in "/proc/mounts" |
Throws | |
---|---|
DeviceNotAvailableException |
getPartitionFreeSpace
public abstract long getPartitionFreeSpace (String partition)
Helper method to determine amount of free space on device partition.
Parameter | |
---|---|
partition | String |
Pengembalian | |
---|---|
long | the amount of free space in KB |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProcessByName
public abstract ProcessInfo getProcessByName (String processName)
Helper method runs the "pidof" and "stat" command and returns ProcessInfo
object with PID and process start time of the given process.
Parameter | |
---|---|
processName | String : the proces name String. |
Pengembalian | |
---|---|
ProcessInfo | ProcessInfo of given processName |
Throws | |
---|---|
DeviceNotAvailableException |
getProcessPid
public abstract String getProcessPid (String process)
Returns the pid of the service or null if something went wrong.
Parameter | |
---|---|
process | String : The proces name String. |
Pengembalian | |
---|---|
String |
Throws | |
---|---|
DeviceNotAvailableException |
getProductType
public abstract String getProductType ()
Convenience method to get the product type of this device.
This method will work if device is in either adb or fastboot mode.Pengembalian | |
---|---|
String | the String product type name. Will not be null |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered, or if product type can not be determined |
getProductVariant
public abstract String getProductVariant ()
Convenience method to get the product variant of this device.
This method will work if device is in either adb or fastboot mode.Pengembalian | |
---|---|
String | the String product variant name or null if it cannot be determined |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
getProperty
public abstract String getProperty (String name)
Retrieve the given property value from the device.
Parameter | |
---|---|
name | String : the property name |
Pengembalian | |
---|---|
String | the property value or null if it does not exist |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
getRecoveryMode
public abstract ITestDevice.RecoveryMode getRecoveryMode ()
Get the current recovery mode used for the device.
Pengembalian | |
---|---|
ITestDevice.RecoveryMode | the current recovery mode used for the device. |
getSerialNumber
public abstract String getSerialNumber ()
Convenience method to get serial number of this device.
Pengembalian | |
---|---|
String | the String serial number |
getTombstones
public abstractgetTombstones ()
Fetch and return the list of tombstones from the devices. Requires root.
method is best-effort so if one tombstone fails to be pulled for any reason it will be missing from the list. Only a DeviceNotAvailableException
will terminate the method early.
Pengembalian | |
---|---|
A list of tombstone files, empty if no tombstone. |
Throws | |
---|---|
DeviceNotAvailableException |
See also:
getTotalMemory
public abstract long getTotalMemory ()
Returns total physical memory size in bytes or -1 in case of internal error
Pengembalian | |
---|---|
long |
getUseFastbootErase
public abstract boolean getUseFastbootErase ()
Get whether to use fastboot erase or fastboot format to wipe a partition on the device.
Pengembalian | |
---|---|
boolean | true if fastboot erase will be used or false if fastboot format will be used. |
See also:
isAdbRoot
public abstract boolean isAdbRoot ()
Pengembalian | |
---|---|
boolean | true if device currently has adb root, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isAdbTcp
public abstract boolean isAdbTcp ()
Pengembalian | |
---|---|
boolean | true if device is connected to adb-over-tcp, false otherwise. |
isAppEnumerationSupported
public abstract boolean isAppEnumerationSupported ()
Check whether platform on device supports app enumeration
Pengembalian | |
---|---|
boolean | True if app enumeration is supported, false otherwise |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isBypassLowTargetSdkBlockSupported
public abstract boolean isBypassLowTargetSdkBlockSupported ()
Check whether platform on device supports bypassing low target sdk block on app installs
Pengembalian | |
---|---|
boolean | True if bypass low target sdk block is supported, false otherwise |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isDeviceEncrypted
public abstract boolean isDeviceEncrypted ()
Returns if the device is encrypted.
Pengembalian | |
---|---|
boolean | true if the device is encrypted. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
isDirectory
public abstract boolean isDirectory (String deviceFilePath)
Return True if the path on the device is a directory, false otherwise.
Parameter | |
---|---|
deviceFilePath | String |
Pengembalian | |
---|---|
boolean |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isEncryptionSupported
public abstract boolean isEncryptionSupported ()
Returns if encryption is supported on the device.
Pengembalian | |
---|---|
boolean | true if the device supports encryption. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isExecutable
public abstract boolean isExecutable (String fullPath)
Returns True if the file path on the device is an executable file, false otherwise.
Parameter | |
---|---|
fullPath | String |
Pengembalian | |
---|---|
boolean |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isHeadless
public abstract boolean isHeadless ()
Return true if the device is headless (no screen), false otherwise.
Pengembalian | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
isRuntimePermissionSupported
public abstract boolean isRuntimePermissionSupported ()
Check whether platform on device supports runtime permission granting
Pengembalian | |
---|---|
boolean | True if runtime permission are supported, false otherwise. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
isStateBootloaderOrFastbootd
public abstract boolean isStateBootloaderOrFastbootd ()
Returns true if device is in TestDeviceState#FASTBOOT
or TestDeviceState.FASTBOOTD
.
Pengembalian | |
---|---|
boolean |
logAnrs
public abstract boolean logAnrs (ITestLogger logger)
Collects and log ANRs from the device.
Parameter | |
---|---|
logger | ITestLogger : an ITestLogger to log the ANRs. |
Pengembalian | |
---|---|
boolean | True if the logging was successful, false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException |
logOnDevice
public abstract void logOnDevice (String tag, Log.LogLevel level, String format, Object... args)
Log a message in the logcat of the device. This is a safe call that will not throw even if the logging fails.
Parameter | |
---|---|
tag | String : The tag under which we log our message in the logcat. |
level | Log.LogLevel : The debug level of the message in the logcat. |
format | String : The message format. |
args | Object : the args to be replaced via String.format(). |
nonBlockingReboot
public abstract void nonBlockingReboot ()
Issues a command to reboot device and returns on command complete and when device is no longer visible to adb.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
postBootSetup
public abstract void postBootSetup ()
Perform instructions to configure device for testing that after every boot.
Should be called after device is fully booted/available In normal circumstances this method doesn't need to be called explicitly, as implementations should perform these steps automatically when performing a reboot. Where it may need to be called is when device reboots due to other events (eg when a fastboot update command has completed)Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
postInvocationTearDown
public void postInvocationTearDown ()
This method is deprecated.
Use postInvocationTearDown(Throwable)
instead.
Extra steps for device specific required clean up that will be executed after the invocation is done.
postInvocationTearDown
public abstract void postInvocationTearDown (Throwable invocationException)
Extra steps for device specific required clean up that will be executed after the invocation is done.
Parameter | |
---|---|
invocationException | Throwable : if any, the final exception raised by the invocation failure. |
preInvocationSetup
public void preInvocationSetup (IBuildInfo info, MultiMap<String, String> attributes)
Extra steps for device specific required setup that will be executed on the device prior to the invocation flow.
Parameter | |
---|---|
info | IBuildInfo : The IBuildInfo of the device. |
attributes | MultiMap : The attributes stored in the invocation context |
Throws | |
---|---|
| com.android.tradefed.targetprep.TargetSetupError |
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException | |
TargetSetupError |
pullDir
public abstract boolean pullDir (String deviceFilePath, File localDir)
Recursively pull directory contents from device.
Parameter | |
---|---|
deviceFilePath | String : the absolute file path of the remote source |
localDir | File : the local directory to pull files into |
Pengembalian | |
---|---|
boolean | true if file was pulled successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath, int userId)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
userId | int : The user id to pull from |
Pengembalian | |
---|---|
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) |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract File pullFile (String remoteFilePath)
Retrieves a file off device, stores it in a local temporary ERROR(/File)
, and returns that File
.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Pengembalian | |
---|---|
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) |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile)
Retrieves a file off device.
Parameter | |
---|---|
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. |
Pengembalian | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFile
public abstract boolean pullFile (String remoteFilePath, File localFile, int userId)
Retrieves a file off device.
Parameter | |
---|---|
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 |
Pengembalian | |
---|---|
boolean | true if file was retrieved successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pullFileContents
public abstract String pullFileContents (String remoteFilePath)
Retrieves a file off device, and returns the contents.
Parameter | |
---|---|
remoteFilePath | String : the absolute path to file on device. |
Pengembalian | |
---|---|
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) |
Throws | |
---|---|
DeviceNotAvailableException |
pullFileFromExternal
public abstract File pullFileFromExternal (String remoteFilePath)
A convenience method to retrieve a file from the device's external storage, stores it in a local temporary ERROR(/File)
, and return a reference to that File
.
Parameter | |
---|---|
remoteFilePath | String : the path to file on device, relative to the device's external storage mountpoint |
Pengembalian | |
---|---|
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) |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath,excludedDirectories)
Recursively push directory contents to device while excluding some directories that are filtered.
Parameter | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
excludedDirectories |
Pengembalian | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushDir
public abstract boolean pushDir (File localDir, String deviceFilePath)
Recursively push directory contents to device.
Parameter | |
---|---|
localDir | File : the local directory to push |
deviceFilePath | String : the absolute file path of the remote destination |
Pengembalian | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath, boolean evaluateContentProviderNeeded)
Variant of pushFile(File, String)
which can optionally consider evaluating the need for the content provider.
Parameter | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
evaluateContentProviderNeeded | boolean : whether to check if we need the content provider |
Pengembalian | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushFile
public abstract boolean pushFile (File localFile, String deviceFilePath)
Push a file to device. By default using a content provider.
Parameter | |
---|---|
localFile | File : the local file to push |
deviceFilePath | String : the remote destination absolute file path |
Pengembalian | |
---|---|
boolean | true if file was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
pushString
public abstract boolean pushString (String contents, String deviceFilePath)
Push file created from a string to device
Parameter | |
---|---|
contents | String : the contents of the file to push |
deviceFilePath | String : the remote destination absolute file path |
Pengembalian | |
---|---|
boolean | true if string was pushed successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
reboot
public abstract void reboot ()
Reboots the device into adb mode.
Blocks until device becomes available.Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
reboot
public abstract void reboot (String reason)
Reboots the device into adb mode with given reason
to be persisted across reboot.
Blocks until device becomes available.
Last reboot reason can be obtained by querying sys.boot.reason
propety.
Parameter | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoBootloader
public abstract void rebootIntoBootloader ()
Reboots the device into bootloader mode.
Blocks until device is in bootloader mode.Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoFastbootd
public abstract void rebootIntoFastbootd ()
Reboots the device into fastbootd mode.
Blocks until device is in fastbootd mode.
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
rebootIntoRecovery
public abstract void rebootIntoRecovery ()
Reboots the device into adb recovery mode.
Blocks until device enters recoveryThrows | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootIntoSideload
public abstract void rebootIntoSideload (boolean autoReboot)
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
Parameter | |
---|---|
autoReboot | boolean : whether to automatically reboot the device after sideload |
Throws | |
---|---|
DeviceNotAvailableException | if device is not in sideload after reboot |
rebootIntoSideload
public abstract void rebootIntoSideload ()
Reboots the device into adb sideload mode (note that this is a special mode under recovery)
Blocks until device enters sideload mode
Throws | |
---|---|
DeviceNotAvailableException | if device is not in sideload after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline ()
An alternate to reboot()
that only blocks until device is online ie visible to adb.
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUntilOnline
public abstract void rebootUntilOnline (String reason)
An alternate to reboot()
that only blocks until device is online ie visible to adb.
Parameter | |
---|---|
reason | String : a reason for this reboot, or null if no reason is specified. |
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
See also:
rebootUserspace
public abstract void rebootUserspace ()
Reboots only userspace part of device.
Blocks until device becomes available.
WARNING. Userspace reboot is currently under active development, use it on your own risk.
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
rebootUserspaceUntilOnline
public abstract void rebootUserspaceUntilOnline ()
An alternate to rebootUserspace()
()} that only blocks until device is online ie visible to adb.
Throws | |
---|---|
DeviceNotAvailableException | if device is not available after reboot |
remountSystemReadOnly
public abstract void remountSystemReadOnly ()
Make the system partition on the device read-only. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountSystemWritable
public abstract void remountSystemWritable ()
Make the system partition on the device writable. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorReadOnly
public abstract void remountVendorReadOnly ()
Make the vendor partition on the device read-only. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
remountVendorWritable
public abstract void remountVendorWritable ()
Make the vendor partition on the device writable. May reboot the device.
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
runInstrumentationTests
public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner, ITestLifeCycleReceiver... listeners)
Convenience method for performing ERROR(/#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection))
with one or more listeners passed as parameters.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners | ITestLifeCycleReceiver : the test result listener(s) |
Pengembalian | |
---|---|
boolean | true if test command completed. false if it failed to complete, but recovery succeeded |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTests
public abstract boolean runInstrumentationTests (IRemoteAndroidTestRunner runner,listeners)
Runs instrumentation tests, and provides device recovery.
If connection with device is lost before test run completes, and recovery succeeds, all listeners will be informed of testRunFailed and "false" will be returned. The test command will not be rerun. It is left to callers to retry if necessary.
If connection with device is lost before test run completes, and recovery fails, all listeners will be informed of testRunFailed and DeviceNotAvailableException will be thrown.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner : the IRemoteAndroidTestRunner which runs the tests |
listeners |
Pengembalian | |
---|---|
boolean | true if test command completed. false if it failed to complete due to device communication exception, but recovery succeeded |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. ie test command failed to complete and recovery failed. |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId,listeners)
Same as ERROR(ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection)/com.android.tradefed.device.ITestDevice#runInstrumentationTests(com.android.ddmlib.testrunner.IRemoteAndroidTestRunner,Collection) ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, Collection))
but runs the test for the given user.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners |
Pengembalian | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
runInstrumentationTestsAsUser
public abstract boolean runInstrumentationTestsAsUser (IRemoteAndroidTestRunner runner, int userId, ITestLifeCycleReceiver... listeners)
Same as ITestDevice#runInstrumentationTests(IRemoteAndroidTestRunner, ITestLifeCycleReceiver...)
but runs the test for a given user.
Parameter | |
---|---|
runner | IRemoteAndroidTestRunner |
userId | int |
listeners | ITestLifeCycleReceiver |
Pengembalian | |
---|---|
boolean |
Throws | |
---|---|
DeviceNotAvailableException |
setDate
public abstract void setDate (Date date)
Sets the date on device
Note: setting date on device requires root
Parameter | |
---|---|
date | Date : specify a particular date; will use host date if null |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setOptions
public abstract void setOptions (TestDeviceOptions options)
Set the TestDeviceOptions
for the device
Parameter | |
---|---|
options | TestDeviceOptions |
setProperty
public abstract boolean setProperty (String propKey, String propValue)
Sets the given property value on the device. Requires adb root is true.
Parameter | |
---|---|
propKey | String : The key targeted to be set. |
propValue | String : The property value to be set. |
Pengembalian | |
---|---|
boolean | returns True if the setprop command was successful, False otherwise. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
setRecovery
public abstract void setRecovery (IDeviceRecovery recovery)
Set the IDeviceRecovery
to use for this device. Should be set when device is first allocated.
Parameter | |
---|---|
recovery | IDeviceRecovery : the IDeviceRecovery |
setRecoveryMode
public abstract void setRecoveryMode (ITestDevice.RecoveryMode mode)
Set the current recovery mode to use for the device.
Used to control what recovery method to use when a device communication problem is encountered. Its recommended to only use this method sparingly when needed (for example, when framework is down, etcParameter | |
---|---|
mode | ITestDevice.RecoveryMode : whether 'recover till online only' mode should be on or not. |
setUseFastbootErase
public abstract void setUseFastbootErase (boolean useFastbootErase)
Set whether to use fastboot erase or fastboot format to wipe a partition on the device.
Parameter | |
---|---|
useFastbootErase | boolean : true if fastboot erase should be used or false if fastboot format should be used. |
See also:
startLogcat
public abstract void startLogcat ()
Start capturing logcat output from device in the background.
Will have no effect if logcat output is already being captured. Data can be later retrieved via getLogcat. When the device is no longer in use,stopLogcat()
must be called. startLogcat()
and stopLogcat()
do not normally need to be called when within a TF invocation context, as the TF framework will start and stop logcat.stopEmulatorOutput
public abstract void stopEmulatorOutput ()
Close and delete the emulator output.
stopLogcat
public abstract void stopLogcat ()
Stop capturing logcat output from device, and discard currently saved logcat data.
Will have no effect if logcat output is not being captured.switchToAdbTcp
public abstract String switchToAdbTcp ()
Switch device to adb-over-tcp mode.
Pengembalian | |
---|---|
String | the tcp serial number or null if device could not be switched |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
switchToAdbUsb
public abstract boolean switchToAdbUsb ()
Switch device to adb over usb mode.
Pengembalian | |
---|---|
boolean | true if switch was successful, false otherwise. |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
syncFiles
public abstract boolean syncFiles (File localFileDir, String deviceFilePath)
Incrementally syncs the contents of a local file directory to device.
Decides which files to push by comparing timestamps of local files with their remote equivalents. Only 'newer' or non-existent files will be pushed to device. Thus overhead should be relatively small if file set on device is already up to date. Hidden files (with names starting with ".") will be ignored. Example usage: syncFiles("/tmp/files", "/sdcard") will created a /sdcard/files directory if it doesn't already exist, and recursively push the /tmp/files contents to /sdcard/files.Parameter | |
---|---|
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 |
Pengembalian | |
---|---|
boolean | true if files were synced successfully. false otherwise. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
unlockDevice
public abstract boolean unlockDevice ()
Unlocks the device if the device is in an encrypted state.
This method may restart the framework but will not callpostBootSetup()
. Therefore, the device might not be fully ready to be tested when this method returns.Pengembalian | |
---|---|
boolean | true if successful or if the device is unencrypted. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
UnsupportedOperationException | if encryption is not supported on the device. |
waitForBootComplete
public abstract boolean waitForBootComplete (long timeOut)
Blocks until the device's boot complete flag is set.
Parameter | |
---|---|
timeOut | long : time in msecs to wait for the flag to be set |
Pengembalian | |
---|---|
boolean | true if device's boot complete flag is set within the timeout |
Throws | |
---|---|
| com.android.tradefed.device.DeviceNotAvailableException |
DeviceNotAvailableException |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable ()
Waits for the device to be responsive and available for testing. Uses default timeout.
Pengembalian | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceAvailable
public abstract boolean waitForDeviceAvailable (long waitTime)
Waits for the device to be responsive and available for testing.
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Pengembalian | |
---|---|
boolean | True if device is available, False if recovery is disabled and unavailable. |
Throws | |
---|---|
DeviceNotAvailableException | if device is still unresponsive after waitTime expires. |
waitForDeviceAvailableInRecoverPath
public abstract boolean waitForDeviceAvailableInRecoverPath (long waitTime)
Waits for the device to be responsive and available without considering recovery path.
Parameter | |
---|---|
waitTime | long |
Pengembalian | |
---|---|
boolean | True if device is available, False if unavailable. |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceBootloader
public abstract void waitForDeviceBootloader ()
Blocks until device is visible via fastboot. Use default timeout.
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceInRecovery
public abstract boolean waitForDeviceInRecovery (long waitTime)
Blocks for the device to be in the 'adb recovery' state (note this is distinct from IDeviceRecovery
).
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Pengembalian | |
---|---|
boolean | true if device boots into recovery before time expires. false otherwise |
waitForDeviceInSideload
public abstract boolean waitForDeviceInSideload (long waitTime)
Blocks for the device to be in the 'adb sideload' state
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Pengembalian | |
---|---|
boolean | true if device boots into sideload before time expires. false otherwise |
waitForDeviceNotAvailable
public abstract boolean waitForDeviceNotAvailable (long waitTime)
Blocks for the device to be not available ie missing from adb
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Pengembalian | |
---|---|
boolean | true if device becomes not available before time expires. false otherwise |
waitForDeviceOnline
public abstract void waitForDeviceOnline ()
Blocks until device is visible via adb. Uses default timeout
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceOnline
public abstract void waitForDeviceOnline (long waitTime)
Blocks until device is visible via adb.
Note the device may not necessarily be responsive to commands on completion. UsewaitForDeviceAvailable()
instead.Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Throws | |
---|---|
DeviceNotAvailableException | if connection with device is lost and cannot be recovered. |
waitForDeviceShell
public abstract boolean waitForDeviceShell (long waitTime)
Waits for device to be responsive to a basic adb shell command.
Parameter | |
---|---|
waitTime | long : the time in ms to wait |
Pengembalian | |
---|---|
boolean | true if device becomes responsive before waitTime elapses. |