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

Commit b299cb72 authored by Yifan Hong's avatar Yifan Hong
Browse files

fastbootd: Add getvar max-fetch-size.

Test: run it
Test: see follow up CL on fuzzy_fastboot

Bug: 173654501

Change-Id: I5ed110c5569d83cbe791d04b4abea3a2af2765a9
parent c90fce43
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -138,6 +138,12 @@ cc_binary {

    recovery: true,

    product_variables: {
        debuggable: {
            cppflags: ["-DFB_ENABLE_FETCH"],
        },
    },

    srcs: [
        "device/commands.cpp",
        "device/fastboot_device.cpp",
+1 −0
Original line number Diff line number Diff line
@@ -77,3 +77,4 @@
#define FB_VAR_FIRST_API_LEVEL "first-api-level"
#define FB_VAR_SECURITY_PATCH_LEVEL "security-patch-level"
#define FB_VAR_TREBLE_ENABLED "treble-enabled"
#define FB_VAR_MAX_FETCH_SIZE "max-fetch-size"
+3 −1
Original line number Diff line number Diff line
@@ -136,7 +136,9 @@ bool GetVarHandler(FastbootDevice* device, const std::vector<std::string>& args)
            {FB_VAR_DYNAMIC_PARTITION, {GetDynamicPartition, nullptr}},
            {FB_VAR_FIRST_API_LEVEL, {GetFirstApiLevel, nullptr}},
            {FB_VAR_SECURITY_PATCH_LEVEL, {GetSecurityPatchLevel, nullptr}},
            {FB_VAR_TREBLE_ENABLED, {GetTrebleEnabled, nullptr}}};
            {FB_VAR_TREBLE_ENABLED, {GetTrebleEnabled, nullptr}},
            {FB_VAR_MAX_FETCH_SIZE, {GetMaxFetchSize, nullptr}},
    };

    if (args.size() < 2) {
        return device->WriteFail("Missing argument");
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <vector>

constexpr unsigned int kMaxDownloadSizeDefault = 0x10000000;
constexpr unsigned int kMaxFetchSizeDefault = 0x10000000;

class FastbootDevice;

+16 −0
Original line number Diff line number Diff line
@@ -33,6 +33,12 @@
#include "flashing.h"
#include "utility.h"

#ifdef FB_ENABLE_FETCH
static constexpr bool kEnableFetch = true;
#else
static constexpr bool kEnableFetch = false;
#endif

using ::android::hardware::boot::V1_0::BoolResult;
using ::android::hardware::boot::V1_0::Slot;
using ::android::hardware::boot::V1_1::MergeStatus;
@@ -509,3 +515,13 @@ bool GetTrebleEnabled(FastbootDevice* /* device */, const std::vector<std::strin
    *message = android::base::GetProperty("ro.treble.enabled", "");
    return true;
}

bool GetMaxFetchSize(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
                     std::string* message) {
    if (!kEnableFetch) {
        *message = "fetch not supported on user builds";
        return false;
    }
    *message = android::base::StringPrintf("0x%X", kMaxFetchSizeDefault);
    return true;
}
Loading