From 7c5dc578b3b683c3fc02c32b76562f7f2fcb6dbd Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 14 Jun 2016 17:48:11 -0700 Subject: [PATCH] Support wiping userdata for A/B OTA packages. update_engine now accepts POWERWASH=1 to schedule a factory reset in the post-install phase. Hook up with the --wipe_user_data flag in the OTA script. Bug: 28700985 Change-Id: Ie73876a61db90d124d2af588d674757376e9aabc (cherry picked from commit 38ca0be399df26514f0412c7b7fca8050d36e9e2) --- tools/releasetools/ota_from_target_files.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 546c2511b3..a13bed877e 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -1271,6 +1271,11 @@ def WriteABOTAPackageWithBrilloScript(target_file, output_file, p1.communicate() assert p1.returncode == 0, "brillo_update_payload properties failed" + if OPTIONS.wipe_user_data: + with open(properties_file, "a") as f: + f.write("POWERWASH=1\n") + metadata["ota-wipe"] = "yes" + # Add the signed payload file and properties into the zip. common.ZipWrite(output_zip, properties_file, arcname="payload_properties.txt") common.ZipWrite(output_zip, signed_payload_file, arcname="payload.bin",