Merge "init: ro.boottime.init.first_stage"
diff --git a/libcutils/fs_config.cpp b/libcutils/fs_config.cpp
index 9d8fa95..494a06f 100644
--- a/libcutils/fs_config.cpp
+++ b/libcutils/fs_config.cpp
@@ -214,6 +214,7 @@
{ 00755, AID_ROOT, AID_ROOT, 0, "bin/*" },
{ 00640, AID_ROOT, AID_SHELL, 0, "fstab.*" },
{ 00750, AID_ROOT, AID_SHELL, 0, "init*" },
+ { 00755, AID_ROOT, AID_SHELL, 0, "odm/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "product/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/bin/*" },
{ 00755, AID_ROOT, AID_SHELL, 0, "system/xbin/*" },
@@ -292,20 +293,21 @@
const int fnm_flags = FNM_NOESCAPE;
if (fnmatch(pattern.c_str(), input.c_str(), fnm_flags) == 0) return true;
- static constexpr const char* kSystem = "system/";
- if (StartsWith(input, kSystem)) {
- input.erase(0, strlen(kSystem));
- } else if (input.size() <= strlen(kSystem)) {
- return false;
- } else if (StartsWith(pattern, kSystem)) {
- pattern.erase(0, strlen(kSystem));
- } else {
- return false;
+ // Check match between logical partition's files and patterns.
+ static constexpr const char* kLogicalPartitions[] = {"system/product/",
+ "system/product_services/",
+ "system/vendor/",
+ "vendor/odm/"};
+ for (auto& logical_partition : kLogicalPartitions) {
+ if (StartsWith(input, logical_partition)) {
+ std::string input_in_partition = input.substr(input.find('/') + 1);
+ if (!is_partition(input_in_partition)) continue;
+ if (fnmatch(pattern.c_str(), input_in_partition.c_str(), fnm_flags) == 0) {
+ return true;
+ }
+ }
}
-
- if (!is_partition(pattern)) return false;
- if (!is_partition(input)) return false;
- return fnmatch(pattern.c_str(), input.c_str(), fnm_flags) == 0;
+ return false;
}
#ifndef __ANDROID_VNDK__
auto __for_testing_only__fs_config_cmp = fs_config_cmp;
diff --git a/libziparchive/include/ziparchive/zip_archive.h b/libziparchive/include/ziparchive/zip_archive.h
index 32c6ea8..6e837a4 100644
--- a/libziparchive/include/ziparchive/zip_archive.h
+++ b/libziparchive/include/ziparchive/zip_archive.h
@@ -163,8 +163,6 @@
* can be called concurrently.
*/
int32_t FindEntry(const ZipArchiveHandle archive, const std::string_view entryName, ZipEntry* data);
-// TODO: remove this internally, where there is a new user.
-int32_t FindEntry(const ZipArchiveHandle archive, const ZipString& entryName, ZipEntry* data);
/*
* Start iterating over all entries of a zip file. The order of iteration
diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc
index bc7103b..2bd8fb9 100644
--- a/libziparchive/zip_archive.cc
+++ b/libziparchive/zip_archive.cc
@@ -741,23 +741,6 @@
delete reinterpret_cast<IterationHandle*>(cookie);
}
-// TODO: remove this internally.
-int32_t FindEntry(const ZipArchiveHandle archive, const ZipString& entryName, ZipEntry* data) {
- if (entryName.name_length == 0) {
- ALOGW("Zip: Invalid filename %.*s", entryName.name_length, entryName.name);
- return kInvalidEntryName;
- }
-
- const int64_t ent = EntryToIndex(archive->hash_table, archive->hash_table_size, entryName,
- archive->central_directory.GetBasePtr());
- if (ent < 0) {
- ALOGV("Zip: Could not find entry %.*s", entryName.name_length, entryName.name);
- return static_cast<int32_t>(ent); // kEntryNotFound is safe to truncate.
- }
- // We know there are at most hast_table_size entries, safe to truncate.
- return FindEntry(archive, static_cast<uint32_t>(ent), data);
-}
-
int32_t FindEntry(const ZipArchiveHandle archive, const std::string_view entryName,
ZipEntry* data) {
if (entryName.empty() || entryName.size() > static_cast<size_t>(UINT16_MAX)) {
@@ -771,7 +754,7 @@
ALOGV("Zip: Could not find entry %.*s", static_cast<int>(entryName.size()), entryName.data());
return static_cast<int32_t>(ent); // kEntryNotFound is safe to truncate.
}
- // We know there are at most hast_table_size entries, safe to truncate.
+ // We know there are at most hash_table_size entries, safe to truncate.
return FindEntry(archive, static_cast<uint32_t>(ent), data);
}