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

Commit e97756b4 authored by Hridya Valsaraju's avatar Hridya Valsaraju Committed by android-build-merger
Browse files

Merge "Support fastboot variable 'variant'." am: 007e52ef

am: f9568659

Change-Id: I38fd8e6d4e8685cac7a16e14bcda98f4f7cb4148
parents e80c90f0 f9568659
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -60,3 +60,4 @@
#define FB_VAR_IS_LOGICAL "is-logical"
#define FB_VAR_IS_USERSPACE "is-userspace"
#define FB_VAR_HW_REVISION "hw-revision"
#define FB_VAR_VARIANT "variant"
+1 −0
Original line number Diff line number Diff line
@@ -82,6 +82,7 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args)
            {FB_VAR_VERSION_BASEBAND, {GetBasebandVersion, nullptr}},
            {FB_VAR_PRODUCT, {GetProduct, nullptr}},
            {FB_VAR_SERIALNO, {GetSerial, nullptr}},
            {FB_VAR_VARIANT, {GetVariant, nullptr}},
            {FB_VAR_SECURE, {GetSecure, nullptr}},
            {FB_VAR_UNLOCKED, {GetUnlocked, nullptr}},
            {FB_VAR_MAX_DOWNLOAD_SIZE, {GetMaxDownloadSize, nullptr}},
+21 −0
Original line number Diff line number Diff line
@@ -74,6 +74,27 @@ bool GetSecure(FastbootDevice* /* device */, const std::vector<std::string>& /*
    return true;
}

bool GetVariant(FastbootDevice* device, const std::vector<std::string>& /* args */,
                std::string* message) {
    auto fastboot_hal = device->fastboot_hal();
    if (!fastboot_hal) {
        *message = "Fastboot HAL not found";
        return false;
    }

    Result ret;
    auto ret_val = fastboot_hal->getVariant([&](std::string device_variant, Result result) {
        *message = device_variant;
        ret = result;
    });
    if (!ret_val.isOk() || ret.status != Status::SUCCESS) {
        *message = "Unable to get device variant";
        return false;
    }

    return true;
}

bool GetCurrentSlot(FastbootDevice* device, const std::vector<std::string>& /* args */,
                    std::string* message) {
    std::string suffix = device->GetCurrentSlot();
+1 −0
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ bool GetIsUserspace(FastbootDevice* device, const std::vector<std::string>& args
                    std::string* message);
bool GetHardwareRevision(FastbootDevice* device, const std::vector<std::string>& args,
                         std::string* message);
bool GetVariant(FastbootDevice* device, const std::vector<std::string>& args, std::string* message);

// Helpers for getvar all.
std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device);