Add support for calling setShouldSwitchSlot from host
Test: th
Change-Id: Ibd32b0d77dd5e1a7b39d301b625b670f703472c6
diff --git a/scripts/update_device.py b/scripts/update_device.py
index 165bc97..db653dc 100755
--- a/scripts/update_device.py
+++ b/scripts/update_device.py
@@ -438,6 +438,10 @@
help='Verify metadata then exit, instead of applying the OTA.')
parser.add_argument('--no-care-map', action='store_true',
help='Do not push care_map.pb to device.')
+ parser.add_argument('--perform-slot-switch', action='store_true',
+ help='Perform slot switch for this OTA package')
+ parser.add_argument('--perform-reset-slot-switch', action='store_true',
+ help='Perform reset slot switch for this OTA package')
args = parser.parse_args()
logging.basicConfig(
level=logging.WARNING if args.no_verbose else logging.INFO)
@@ -474,6 +478,16 @@
# Return 0, as we are executing ADB commands here, no work needed after
# this point
return 0
+ if args.perform_slot_switch:
+ assert PushMetadata(dut, args.otafile, metadata_path)
+ dut.adb(["shell", "update_engine_client",
+ "--switch_slot=true", "--metadata={}".format(metadata_path), "--follow"])
+ return 0
+ if args.perform_reset_slot_switch:
+ assert PushMetadata(dut, args.otafile, metadata_path)
+ dut.adb(["shell", "update_engine_client",
+ "--switch_slot=false", "--metadata={}".format(metadata_path)])
+ return 0
if args.no_slot_switch:
args.extra_headers += "\nSWITCH_SLOT_ON_REBOOT=0"