lpdump: Add --json option
am: 7ea1a93cbf
Change-Id: Idedff158c574e949826231bbf3d146665d75f645
diff --git a/cppreopts/cppreopts.rc b/cppreopts/cppreopts.rc
index 4ce04c5..812b4ce 100644
--- a/cppreopts/cppreopts.rc
+++ b/cppreopts/cppreopts.rc
@@ -18,8 +18,17 @@
user root
capabilities
-on property:sys.cppreopt=requested
+# Post install is above Treble VINTF, because it runs some utilities from
+# /system. Therefore, the fstab can only be in either /system or /product.
+on property:sys.cppreopt=requested && property:ro.postinstall.fstab.prefix=/system
mount_all /system/etc/fstab.postinstall
+ setprop sys.cppreopt mounted
+
+on property:sys.cppreopt=requested && property:ro.postinstall.fstab.prefix=/product
+ mount_all /product/etc/fstab.postinstall
+ setprop sys.cppreopt mounted
+
+on property:sys.cppreopt=mounted
exec_start cppreopts
# Optional script to copy additional preloaded content to data directory
exec - system system -- /system/bin/preloads_copy.sh /postinstall
diff --git a/libfscrypt/fscrypt_init_extensions.cpp b/libfscrypt/fscrypt_init_extensions.cpp
index 2291c14..9781267 100644
--- a/libfscrypt/fscrypt_init_extensions.cpp
+++ b/libfscrypt/fscrypt_init_extensions.cpp
@@ -87,7 +87,7 @@
"vendor_ce", "vendor_de",
"media",
"data", "user", "user_de",
- "apex", "preloads", "pkg_staging",
+ "apex", "preloads", "app-staging",
"gsi",
};
std::string prefix = "/data/";
diff --git a/libjsonpb/verify/include/jsonpb/json_schema_test.h b/libjsonpb/verify/include/jsonpb/json_schema_test.h
index 9a62ea9..3db1931 100644
--- a/libjsonpb/verify/include/jsonpb/json_schema_test.h
+++ b/libjsonpb/verify/include/jsonpb/json_schema_test.h
@@ -17,6 +17,8 @@
#pragma once
+#include <unistd.h>
+
#include <memory>
#include <string>
@@ -41,12 +43,11 @@
virtual ~JsonSchemaTestConfig() = default;
virtual std::unique_ptr<google::protobuf::Message> CreateMessage() const = 0;
virtual std::string file_path() const = 0;
- virtual std::string GetFileContent() const {
- std::string content;
- if (!android::base::ReadFileToString(file_path(), &content)) {
- return "";
- }
- return content;
+ /**
+ * If it returns true, tests are skipped when the file is not found.
+ */
+ virtual bool optional() const {
+ return false;
}
};
using JsonSchemaTestConfigFactory =
@@ -79,11 +80,19 @@
auto&& config =
::testing::TestWithParam<JsonSchemaTestConfigFactory>::GetParam()();
file_path_ = config->file_path();
- json_ = config->GetFileContent();
- ASSERT_FALSE(json_.empty()) << "Cannot read " << config->file_path();
+
+ if (access(file_path_.c_str(), F_OK) == -1) {
+ ASSERT_EQ(ENOENT, errno) << "File '" << file_path_ << "' is not accessible: "
+ << strerror(errno);
+ ASSERT_TRUE(config->optional()) << "Missing mandatory file " << file_path_;
+ GTEST_SKIP();
+ }
+ ASSERT_TRUE(android::base::ReadFileToString(file_path_, &json_));
+ ASSERT_FALSE(json_.empty()) << "File '" << file_path_ << "' exists but is empty";
+
object_ = config->CreateMessage();
auto res = internal::JsonStringToMessage(json_, object_.get());
- ASSERT_TRUE(res.ok()) << "Invalid format of file " << config->file_path()
+ ASSERT_TRUE(res.ok()) << "Invalid format of file " << file_path_
<< ": " << res.error();
}
google::protobuf::Message* message() const {
diff --git a/simpleperf/Android.bp b/simpleperf/Android.bp
index 2f7ec7d..f7fbc2d 100644
--- a/simpleperf/Android.bp
+++ b/simpleperf/Android.bp
@@ -468,9 +468,6 @@
linux: {
ldflags: ["-Wl,--exclude-libs,ALL"],
},
- windows: {
- ldflags: ["-Wl,--exclude-libs,ALL"],
- },
darwin: {
dist: {
dir: "simpleperf/darwin/x86",
diff --git a/simpleperf/OfflineUnwinder.cpp b/simpleperf/OfflineUnwinder.cpp
index 55b46e2..b6b7d91 100644
--- a/simpleperf/OfflineUnwinder.cpp
+++ b/simpleperf/OfflineUnwinder.cpp
@@ -150,28 +150,26 @@
} else if (i == old_size || entry->start_addr <= entries_[i]->start_addr) {
// Add an entry.
entries_.push_back(entry);
- maps_.push_back(CreateMapInfo(entry));
+ maps_.emplace_back(CreateMapInfo(entry));
++it;
} else {
// Remove an entry.
entries_[i] = nullptr;
- delete maps_[i];
maps_[i++] = nullptr;
}
}
while (i < old_size) {
entries_[i] = nullptr;
- delete maps_[i];
maps_[i++] = nullptr;
}
- std::sort(entries_.begin(), entries_.end(), [](const MapEntry* e1, const MapEntry* e2) {
+ std::sort(entries_.begin(), entries_.end(), [](const auto& e1, const auto& e2) {
if (e1 == nullptr || e2 == nullptr) {
return e1 != nullptr;
}
return e1->start_addr < e2->start_addr;
});
std::sort(maps_.begin(), maps_.end(),
- [](const unwindstack::MapInfo* m1, const unwindstack::MapInfo* m2) {
+ [](const auto& m1, const auto& m2) {
if (m1 == nullptr || m2 == nullptr) {
return m1 != nullptr;
}