Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a9ce9c85 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 10783763 from bcbc93f8 to udc-qpr1-release

Change-Id: Ibb634e6c1b0414c7a28faed9e99645f9c8cf856e
parents 538c5f0d bcbc93f8
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -639,6 +639,12 @@ bool UpdateSuperHandler(FastbootDevice* device, const std::vector<std::string>&
    return UpdateSuper(device, args[1], wipe);
}

static bool IsLockedDsu() {
    std::string active_dsu;
    android::gsi::GetActiveDsu(&active_dsu);
    return android::base::EndsWith(active_dsu, ".lock");
}

bool GsiHandler(FastbootDevice* device, const std::vector<std::string>& args) {
    if (args.size() != 2) {
        return device->WriteFail("Invalid arguments");
@@ -653,6 +659,11 @@ bool GsiHandler(FastbootDevice* device, const std::vector<std::string>& args) {
        return device->WriteStatus(FastbootResult::FAIL, "No GSI is installed");
    }

    if ((args[1] == "wipe" || args[1] == "disable") && GetDeviceLockStatus() && IsLockedDsu()) {
        // Block commands that modify the states of locked DSU
        return device->WriteFail("Command not available on locked DSU/devices");
    }

    if (args[1] == "wipe") {
        if (!android::gsi::UninstallGsi()) {
            return device->WriteStatus(FastbootResult::FAIL, strerror(errno));