fastbootd: Add getvar max-fetch-size.
Test: run it Test: see follow up CL on fuzzy_fastboot Bug: 173654501 Change-Id: I5ed110c5569d83cbe791d04b4abea3a2af2765a9
This commit is contained in:
parent
c90fce4387
commit
b299cb7217
6 changed files with 29 additions and 1 deletions
|
|
@ -138,6 +138,12 @@ cc_binary {
|
|||
|
||||
recovery: true,
|
||||
|
||||
product_variables: {
|
||||
debuggable: {
|
||||
cppflags: ["-DFB_ENABLE_FETCH"],
|
||||
},
|
||||
},
|
||||
|
||||
srcs: [
|
||||
"device/commands.cpp",
|
||||
"device/fastboot_device.cpp",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
#include <vector>
|
||||
|
||||
constexpr unsigned int kMaxDownloadSizeDefault = 0x10000000;
|
||||
constexpr unsigned int kMaxFetchSizeDefault = 0x10000000;
|
||||
|
||||
class FastbootDevice;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,6 +80,8 @@ bool GetSecurityPatchLevel(FastbootDevice* device, const std::vector<std::string
|
|||
std::string* message);
|
||||
bool GetTrebleEnabled(FastbootDevice* device, const std::vector<std::string>& args,
|
||||
std::string* message);
|
||||
bool GetMaxFetchSize(FastbootDevice* /* device */, const std::vector<std::string>& /* args */,
|
||||
std::string* message);
|
||||
|
||||
// Helpers for getvar all.
|
||||
std::vector<std::vector<std::string>> GetAllPartitionArgsWithSlot(FastbootDevice* device);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue