Cancel snapshots on devices which are always capable of doing so

This commit is contained in:
flawedworld 2023-01-09 21:33:31 +00:00 committed by Daniel Micay
parent f95fd6bc2d
commit c248a841b9

View File

@ -148,6 +148,8 @@ const legacyQualcommDevices = ["sunfish", "coral", "flame", "bonito", "sargo", "
const tensorDevices = ["cheetah", "panther", "bluejay", "raven", "oriole"];
const day1SnapshotCancelDevices = ["cheetah", "panther", "bluejay", "raven", "oriole", "barbet", "redfin", "bramble"];
async function getLatestRelease() {
let product = await device.getVariable("product");
if (!supportedDevices.includes(product)) {
@ -213,6 +215,15 @@ async function flashRelease(setProgress) {
throw new Error("You need to download a release first!");
}
setProgress("Cancelling any pending OTAs...");
// Cancel snapshot update if in progress on devices which support it on all bootloader versions
if (day1SnapshotCancelDevices.includes(product)) {
let snapshotStatus = await device.getVariable("snapshot-update-status");
if (snapshotStatus !== null && snapshotStatus !== "none") {
await device.runCommand("snapshot-update:cancel");
}
}
setProgress("Flashing release...");
safeToLeave = false;
try {