自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
DeviceImageZipFlashingTargetPreparer
public
class
DeviceImageZipFlashingTargetPreparer
extends DeviceUpdateTargetPreparer
一种目标准备器,用于使用通过特定格式提供的设备映像刷写设备。
设备映像格式的概要要求:
- 设备映像文件必须为 zip 文件
- zip 文件的根目录中必须包含 flash-all.sh 脚本
- 脚本必须假定设备位于对
adb devices
可见的用户空间
- zip 文件的其余部分将解压缩到与脚本相同的位置,并采用相同的目录布局,脚本可以通过相对路径引用 zip 中打包的任何文件
- 刷写后,脚本必须将设备恢复为相同的状态
- 环境变量
ANDROID_SERIAL
将作为执行环境的一部分设置为设备序列号
- 该脚本可能会假定它在 PATH 上有
adb
和 fastboot
此目标准备程序将在上述要求中概述的假设下解压缩设备映像 ZIP 文件并执行封闭的
flash-
all.sh
。
摘要
公共构造函数
DeviceImageZipFlashingTargetPreparer
public DeviceImageZipFlashingTargetPreparer ()
受保护的方法
getDeviceUpdateImage
protected File getDeviceUpdateImage ()
提供一个 ERROR(/File)
实例,表示要用于更新的设备映像文件
protected void performDeviceUpdate (File deviceUpdateImage,
ITestDevice device)
展开设备映像更新 ZIP 文件并调用封闭的刷写脚本
抛出 |
DeviceNotAvailableException |
|
TargetSetupError |
|
postUpdateActions
protected void postUpdateActions (File deviceUpdateImage,
ITestDevice device)
无操作
抛出 |
DeviceNotAvailableException |
|
TargetSetupError |
|
preUpdateActions
protected void preUpdateActions (File deviceUpdateImage,
ITestDevice device)
无操作
抛出 |
DeviceNotAvailableException |
|
TargetSetupError |
|
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-27。"],[],[],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` | |"]]