Mulai 27 Maret 2025, sebaiknya gunakan android-latest-release
, bukan aosp-main
, untuk mem-build dan berkontribusi pada AOSP. Untuk mengetahui informasi selengkapnya, lihat Perubahan pada AOSP.
Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
DeviceImageZipFlashingTargetPreparer
public
class
DeviceImageZipFlashingTargetPreparer
extends DeviceUpdateTargetPreparer
Penyedia target yang mem-flash perangkat dengan image perangkat yang disediakan melalui format tertentu.
Persyaratan tingkat tinggi untuk format image perangkat:
- File image perangkat harus berupa file zip
- File zip harus menyertakan skrip flash-all.sh di root
- Skrip harus mengasumsikan bahwa perangkat berada di ruang pengguna yang terlihat oleh
adb devices
- File zip lainnya akan diekstrak ke lokasi yang sama dengan skrip dengan
tata letak direktori yang sama, dan skrip dapat membuat referensi ke file apa pun yang dipaketkan dalam zip melalui
jalur relatif
- Setelah flashing, skrip harus mengembalikan perangkat ke status yang sama
- Variabel lingkungan
ANDROID_SERIAL
akan ditetapkan ke nomor seri perangkat sebagai
bagian dari lingkungan eksekusi
- Skrip mungkin mengasumsikan bahwa skrip memiliki
adb
dan fastboot
di PATH
Penyiapan target ini akan mengekstrak file zip image perangkat dan menjalankan
flash-
all.sh
yang disertakan berdasarkan garis besar asumsi dalam persyaratan di atas.
Ringkasan
Metode yang dilindungi |
File
|
getDeviceUpdateImage()
Memberikan instance ERROR(/File) yang mewakili file image perangkat yang akan digunakan untuk update
|
void
|
performDeviceUpdate(File deviceUpdateImage, ITestDevice device)
Memperluas zip update image perangkat dan memanggil skrip flashing yang disertakan
|
void
|
postUpdateActions(File deviceUpdateImage, ITestDevice device)
Tanpa pengoperasian
|
void
|
preUpdateActions(File deviceUpdateImage, ITestDevice device)
Tanpa pengoperasian
|
Konstruktor publik
DeviceImageZipFlashingTargetPreparer
public DeviceImageZipFlashingTargetPreparer ()
Metode yang dilindungi
getDeviceUpdateImage
protected File getDeviceUpdateImage ()
Memberikan instance ERROR(/File)
yang mewakili file image perangkat yang akan digunakan untuk update
protected void performDeviceUpdate (File deviceUpdateImage,
ITestDevice device)
Memperluas zip update image perangkat dan memanggil skrip flashing yang disertakan
Menampilkan |
DeviceNotAvailableException |
|
TargetSetupError |
|
postUpdateActions
protected void postUpdateActions (File deviceUpdateImage,
ITestDevice device)
Tanpa pengoperasian
Menampilkan |
DeviceNotAvailableException |
|
TargetSetupError |
|
preUpdateActions
protected void preUpdateActions (File deviceUpdateImage,
ITestDevice device)
Tanpa pengoperasian
Menampilkan |
DeviceNotAvailableException |
|
TargetSetupError |
|
Konten dan contoh kode di halaman ini tunduk kepada lisensi yang dijelaskan dalam Lisensi Konten. Java dan OpenJDK adalah merek dagang atau merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-27 UTC.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Informasi yang saya butuhkan tidak ada","missingTheInformationINeed","thumb-down"],["Terlalu rumit/langkahnya terlalu banyak","tooComplicatedTooManySteps","thumb-down"],["Sudah usang","outOfDate","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Masalah kode / contoh","samplesCodeIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-07-27 UTC."],[],[],null,["# DeviceImageZipFlashingTargetPreparer\n====================================\n\n\n`\npublic\n\n\nclass\nDeviceImageZipFlashingTargetPreparer\n`\n\n\n`\n\n\n`\n\n`\n\n\n`\n\n`\n\n\n`\n\n`\n\nextends `[DeviceUpdateTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceUpdateTargetPreparer.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|---|---|---|----------------------------------------------------------------------|\n| java.lang.Object |||||\n| ↳ | [com.android.tradefed.targetprep.BaseTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BaseTargetPreparer.html) ||||\n| | ↳ | [com.android.tradefed.targetprep.DeviceBuildInfoBootStrapper](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceBuildInfoBootStrapper.html) |||\n| | | ↳ | [com.android.tradefed.targetprep.DeviceUpdateTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceUpdateTargetPreparer.html) ||\n| | | | ↳ | com.android.tradefed.targetprep.DeviceImageZipFlashingTargetPreparer |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nA target preparer that flashes the device with device images provided via a specific format.\n\nHigh level requirements for the device image format:\n\n- Device image file must be a zip file\n- The zip file must include a flash-all.sh script at the root\n- The script must assume that the device is in userspace visible to `adb devices`\n- The rest of the zip file will be extracted into the same location as script with the same directory layout, and the script may make reference to any files packaged in the zip via relative path\n- After flashing, the script must return the device to the same state\n- An environment variable `ANDROID_SERIAL` will be set to device serial number as part of the execution environment\n- The script may assume that it has `adb` and `fastboot` on PATH\n\nThis target preparer will unpack the device image zip file and execute the enclosed `flash-\nall.sh` under the assumptions outline in requirements above.\n\n\u003cbr /\u003e\n\nSummary\n-------\n\n| ### Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[DeviceImageZipFlashingTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceImageZipFlashingTargetPreparer.html#DeviceImageZipFlashingTargetPreparer())`() ` |\n\n| ### Protected methods ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` File` | ` `[getDeviceUpdateImage](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceImageZipFlashingTargetPreparer.html#getDeviceUpdateImage())`() ` Provides a [ERROR(/File)](../../../../../../) instance representing the device image file to be used for updating |\n| ` void` | ` `[performDeviceUpdate](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceImageZipFlashingTargetPreparer.html#performDeviceUpdate(File,%20com.android.tradefed.device.ITestDevice))`(File deviceUpdateImage, ITestDevice device) ` Expands the device image update zip and calls the enclosed flashing script |\n| ` void` | ` `[postUpdateActions](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceImageZipFlashingTargetPreparer.html#postUpdateActions(File,%20com.android.tradefed.device.ITestDevice))`(File deviceUpdateImage, ITestDevice device) ` No-op |\n| ` void` | ` `[preUpdateActions](../../../../../../reference/tradefed/com/android/tradefed/targetprep/DeviceImageZipFlashingTargetPreparer.html#preUpdateActions(File,%20com.android.tradefed.device.ITestDevice))`(File deviceUpdateImage, ITestDevice device) ` No-op |\n\nPublic constructors\n-------------------\n\n### DeviceImageZipFlashingTargetPreparer\n\n```\npublic DeviceImageZipFlashingTargetPreparer ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nProtected methods\n-----------------\n\n### getDeviceUpdateImage\n\n```\nprotected File getDeviceUpdateImage ()\n```\n\nProvides a [ERROR(/File)](../../../../../../) instance representing the device image file to be used for updating\n\n\u003cbr /\u003e\n\n| Returns ||\n|--------|--------|\n| `File` | \u003cbr /\u003e |\n\n### performDeviceUpdate\n\n```\nprotected void performDeviceUpdate (File deviceUpdateImage, \n ITestDevice device)\n```\n\nExpands the device image update zip and calls the enclosed flashing script\n\n\u003cbr /\u003e\n\n| Throws ||\n|-------------------------------|---|\n| `DeviceNotAvailableException` | |\n| `TargetSetupError` | |\n\n### postUpdateActions\n\n```\nprotected void postUpdateActions (File deviceUpdateImage, \n ITestDevice device)\n```\n\nNo-op\n\n\u003cbr /\u003e\n\n| Throws ||\n|-------------------------------|---|\n| `DeviceNotAvailableException` | |\n| `TargetSetupError` | |\n\n### preUpdateActions\n\n```\nprotected void preUpdateActions (File deviceUpdateImage, \n ITestDevice device)\n```\n\nNo-op\n\n\u003cbr /\u003e\n\n| Throws ||\n|-------------------------------|---|\n| `DeviceNotAvailableException` | |\n| `TargetSetupError` | |"]]