Merge "Remove usage of base/string/* in libfs_avb" into main am: 752112003d
Original change: https://android-review.googlesource.com/c/platform/system/core/+/3265051 Change-Id: Iceb8689b1643eb1cdc2d4b6d118988bf1364da2c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
5a8a1d704a
5 changed files with 11 additions and 13 deletions
|
|
@ -16,10 +16,10 @@
|
|||
|
||||
#include <endian.h>
|
||||
|
||||
#include <android-base/strings.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <base/files/file_util.h>
|
||||
#include <base/rand_util.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <libavb/libavb.h>
|
||||
|
||||
#include "avb_util.h"
|
||||
|
|
@ -70,7 +70,7 @@ void AvbUtilTest::SetVBMetaFlags(const base::FilePath& image_path, uint32_t flag
|
|||
|
||||
std::string image_file_name = image_path.RemoveExtension().BaseName().value();
|
||||
bool is_vbmeta_partition =
|
||||
base::StartsWith(image_file_name, "vbmeta", base::CompareCase::INSENSITIVE_ASCII);
|
||||
android::base::StartsWithIgnoreCase(image_file_name, "vbmeta");
|
||||
|
||||
android::base::unique_fd fd(open(image_path.value().c_str(), O_RDWR | O_CLOEXEC));
|
||||
EXPECT_TRUE(fd > 0);
|
||||
|
|
@ -603,7 +603,7 @@ bool AvbUtilTest::CompareVBMeta(const base::FilePath& avb_image_path,
|
|||
std::string image_file_name = avb_image_path.RemoveExtension().BaseName().value();
|
||||
|
||||
base::FilePath extracted_vbmeta_path;
|
||||
if (base::StartsWith(image_file_name, "vbmeta", base::CompareCase::INSENSITIVE_ASCII)) {
|
||||
if (android::base::StartsWithIgnoreCase(image_file_name, "vbmeta")) {
|
||||
extracted_vbmeta_path = avb_image_path; // no need to extract if it's a vbmeta image.
|
||||
} else {
|
||||
extracted_vbmeta_path = ExtractVBMetaImage(avb_image_path, image_file_name + "-vbmeta.img");
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <android-base/file.h>
|
||||
#include <base/files/file_util.h>
|
||||
#include <base/strings/string_util.h>
|
||||
|
||||
namespace fs_avb_host_test {
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <base/files/file_util.h>
|
||||
#include <base/strings/string_util.h>
|
||||
#include <fs_avb/fs_avb.h>
|
||||
#include <libavb/libavb.h>
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ void PublicFsAvbTest::ModifyVBMetaHeaderFlags(const base::FilePath& vbmeta_image
|
|||
|
||||
// Only support modifying the flags in vbmeta*.img.
|
||||
std::string image_file_name = vbmeta_image_path.RemoveExtension().BaseName().value();
|
||||
ASSERT_TRUE(base::StartsWith(image_file_name, "vbmeta", base::CompareCase::INSENSITIVE_ASCII));
|
||||
ASSERT_TRUE(android::base::StartsWithIgnoreCase(image_file_name, "vbmeta"));
|
||||
|
||||
android::base::unique_fd fd(open(vbmeta_image_path.value().c_str(), O_RDWR | O_CLOEXEC));
|
||||
EXPECT_TRUE(fd > 0);
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <android-base/strings.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <base/files/file_util.h>
|
||||
#include <base/strings/string_util.h>
|
||||
|
||||
namespace fs_avb_host_test {
|
||||
|
||||
|
|
@ -64,9 +65,7 @@ std::string BaseFsAvbTest::CalcVBMetaDigest(const std::string& file_name,
|
|||
std::string vbmeta_digest_data;
|
||||
EXPECT_TRUE(base::ReadFileToString(vbmeta_digest_path, &vbmeta_digest_data));
|
||||
// Returns the trimmed digest.
|
||||
std::string trimmed_digest_data;
|
||||
base::TrimString(vbmeta_digest_data, " \t\n", &trimmed_digest_data);
|
||||
return trimmed_digest_data;
|
||||
return android::base::Trim(vbmeta_digest_data);
|
||||
}
|
||||
|
||||
base::FilePath BaseFsAvbTest::GenerateVBMetaImage(
|
||||
|
|
@ -91,7 +90,7 @@ base::FilePath BaseFsAvbTest::GenerateVBMetaImage(
|
|||
// --chain_partitions
|
||||
std::string chain_partition_options;
|
||||
for (const auto& partition : chain_partitions) {
|
||||
chain_partition_options += base::StringPrintf(
|
||||
chain_partition_options += android::base::StringPrintf(
|
||||
" --chain_partition %s:%u:%s", partition.partition_name.c_str(),
|
||||
partition.rollback_index_location, partition.key_blob_path.value().c_str());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,9 +26,9 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <android-base/unique_fd.h>
|
||||
#include <base/files/file_path.h>
|
||||
#include <base/strings/stringprintf.h>
|
||||
#include <fs_avb/types.h>
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
// the command exits normally with exit status |expected_exit_status|.
|
||||
#define EXPECT_COMMAND(expected_exit_status, command_format, ...) \
|
||||
do { \
|
||||
int rc = system(base::StringPrintf(command_format, ##__VA_ARGS__).c_str()); \
|
||||
int rc = system(android::base::StringPrintf(command_format, ##__VA_ARGS__).c_str()); \
|
||||
EXPECT_TRUE(WIFEXITED(rc)); \
|
||||
EXPECT_EQ(WEXITSTATUS(rc), expected_exit_status); \
|
||||
} while (0);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue