Disable std::filesystem from dumpstate HAL in trout
We are trying to get a non-std:: copy of filesystem working, and
trout depending on it is currently causing the Gerrit presubmit
to fail
Workaround this by disabling the std::filesystem dependency out of trout,
and be ready to enable it back in its new home outside of std::
Bug: 152067309
Test: build
Change-Id: Id3de1a4c0e23b3df3e0e649f8784e1a98efe81e4
diff --git a/hal/dumpstate/1.1/Android.bp b/hal/dumpstate/1.1/Android.bp
index 6d48c9b..07b7175 100644
--- a/hal/dumpstate/1.1/Android.bp
+++ b/hal/dumpstate/1.1/Android.bp
@@ -20,9 +20,6 @@
"DumpstateDevice.cpp",
"service.cpp",
],
- static_libs: [
- "android.hardware.automotive@libc++fs",
- ],
shared_libs: [
"android.hardware.dumpstate@1.0",
"android.hardware.dumpstate@1.1",
diff --git a/hal/dumpstate/1.1/DumpstateDevice.cpp b/hal/dumpstate/1.1/DumpstateDevice.cpp
index 69b928d..36bb05e 100644
--- a/hal/dumpstate/1.1/DumpstateDevice.cpp
+++ b/hal/dumpstate/1.1/DumpstateDevice.cpp
@@ -21,7 +21,6 @@
#include <android-base/logging.h>
#include <android-base/properties.h>
-#include <filesystem>
#include <string>
using android::os::dumpstate::CommandOptions;
@@ -38,58 +37,7 @@
namespace android::hardware::dumpstate::V1_1::implementation {
-static void dumpDirAsText(int textFd, const std::filesystem::path& dirToDump) {
- for (const auto& fileEntry : std::filesystem::recursive_directory_iterator(dirToDump)) {
- if (!fileEntry.is_regular_file()) {
- continue;
- }
-
- DumpFileToFd(textFd, "Helper System Log", fileEntry.path());
- }
-}
-
-static void tryDumpDirAsTar(int textFd, int binFd, const std::filesystem::path& dirToDump) {
- if (!std::filesystem::is_directory(dirToDump)) {
- LOG(ERROR) << "'" << dirToDump << "'"
- << " is not a valid directory to dump";
- return;
- }
-
- if (binFd < 0) {
- LOG(WARNING) << "No binary dumped file, fallback to text mode";
- return dumpDirAsText(textFd, dirToDump);
- }
-
- TemporaryFile tempTarFile;
- constexpr auto kTarTimeout = 20s;
-
- RunCommandToFd(
- textFd, "TAR LOG", {"/vendor/bin/tar", "cvf", tempTarFile.path, dirToDump.c_str()},
- CommandOptions::WithTimeout(duration_cast<seconds>(kTarTimeout).count()).Build());
-
- std::vector<uint8_t> buffer(65536);
- while (true) {
- ssize_t bytes_read = TEMP_FAILURE_RETRY(read(tempTarFile.fd, buffer.data(), buffer.size()));
-
- if (bytes_read == 0) {
- break;
- } else if (bytes_read < 0) {
- LOG(DEBUG) << "read temporary tar file(" << tempTarFile.path
- << "): " << strerror(errno);
- break;
- }
-
- ssize_t result = TEMP_FAILURE_RETRY(write(binFd, buffer.data(), bytes_read));
-
- if (result != bytes_read) {
- LOG(DEBUG) << "Failed to write " << bytes_read
- << " bytes, actually written: " << result;
- break;
- }
- }
-}
-
-static void dumpHelperSystem(int textFd, int binFd) {
+static void dumpHelperSystem(int /*textFd*/, int /*binFd*/) {
std::string helperSystemLogDir =
android::base::GetProperty(VENDOR_HELPER_SYSTEM_LOG_LOC_PROPERTY, "");
if (helperSystemLogDir.empty()) {
@@ -98,7 +46,7 @@
return;
}
- tryDumpDirAsTar(textFd, binFd, helperSystemLogDir);
+ LOG(ERROR) << "this build does not support actually getting any work done, sorry!";
}
// Methods from ::android::hardware::dumpstate::V1_0::IDumpstateDevice follow.