dump_modemlog: move all files to subdirectory

Since radioext has already moved to this folder, it doesn't make sense
for the base folder to be dump_modemlog. This change moves it to its
own subfolder so that we can also add more in the future.

Test: build and flash, trigger bugreport and check modem logs are there
Bug: 302435001
Change-Id: Ia83378074068526023f591d63b1e5ac4700b8103
This commit is contained in:
kierancyphus 2023-11-10 14:40:18 +08:00 committed by Kieran Cyphus
parent 057e9b0f74
commit 3ed60cec02
17 changed files with 42 additions and 51 deletions

View File

@ -11,9 +11,9 @@ sh_binary {
cc_defaults {
name: "dump_modemlog_defaults",
srcs: ["modem_log_dumper.cpp"],
local_include_dirs: ["include"],
shared_libs: ["liblog"],
srcs: [ "modem_log_dumper.cpp" ],
local_include_dirs: [ "include" ],
shared_libs: [ "liblog" ],
}
cc_binary {
@ -29,16 +29,16 @@ cc_binary {
"libdump",
"liblog",
],
defaults: ["dump_modemlog_defaults"],
defaults: [ "dump_modemlog_defaults" ],
vendor: true,
relative_install_path: "dump",
}
cc_test {
name: "dump_modemlog_test",
srcs: ["test/*.cpp"],
defaults: ["dump_modemlog_defaults"],
local_include_dirs: ["test/include"],
static_libs: ["libgmock"],
srcs: [ "*_test.cpp" ],
defaults: [ "dump_modemlog_defaults" ],
local_include_dirs: [ "test/include" ],
static_libs: [ "libgmock" ],
vendor: true,
}

View File

@ -19,8 +19,7 @@
#include "dumper.h"
#include "modem_log_dumper.h"
namespace modem {
namespace logging {
namespace pixel_modem::logging {
/**
* @brief Implementation of AndroidPropertyManager that directly forwards to
@ -59,13 +58,13 @@ class DumperImpl : public Dumper {
}
};
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging
int main() {
modem::logging::DumperImpl dumper_impl;
modem::logging::AndroidPropertyManagerImpl android_property_manager_impl;
modem::logging::ModemLogDumper modem_log_dumper(
pixel_modem::logging::DumperImpl dumper_impl;
pixel_modem::logging::AndroidPropertyManagerImpl
android_property_manager_impl;
pixel_modem::logging::ModemLogDumper modem_log_dumper(
dumper_impl, android_property_manager_impl);
modem_log_dumper.DumpModemLogs();

View File

@ -0,0 +1,5 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/modem/dump_modemlog/sepolicy
PRODUCT_PACKAGES += dump_modem.sh
PRODUCT_PACKAGES += dump_modemlog

View File

@ -2,8 +2,7 @@
#include <string>
namespace modem {
namespace logging {
namespace pixel_modem::logging {
/**
* @brief Interface for interacting with Android System Properties.
@ -17,5 +16,5 @@ class AndroidPropertyManager {
virtual int GetIntProperty(const std::string& key, int default_value);
virtual void SetProperty(const std::string& key, const std::string& value);
};
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -3,8 +3,7 @@
#include <ostream>
#include <string_view>
namespace modem {
namespace logging {
namespace pixel_modem::logging {
/**
* @brief Data object for information about dumpings logs.
@ -67,5 +66,5 @@ class Dumper {
virtual void DumpLogs(const LogDumpInfo& log_dump_info);
virtual void CopyFile(const FileCopyInfo& file_copy_info);
};
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -3,8 +3,7 @@
#include "dumper.h"
namespace modem {
namespace logging {
namespace pixel_modem::logging {
// Modem related Android System Properties
@ -52,5 +51,5 @@ constexpr static FileCopyInfo kFileCopyInfo[] = {
{.src_dir = "/mnt/vendor/efs/nv_protected.bin",
.dest_dir =
"/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"}};
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -3,8 +3,7 @@
#include "android_property_manager.h"
#include "dumper.h"
namespace modem {
namespace logging {
namespace pixel_modem::logging {
/**
* @brief Responsible for dumping all relevant modem logs.
@ -77,5 +76,4 @@ class ModemLogDumper {
AndroidPropertyManager& android_property_manager_;
};
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -5,8 +5,7 @@
#include "dumper.h"
#include "modem_log_constants.h"
namespace modem {
namespace logging {
namespace pixel_modem::logging {
void ModemLogDumper::DumpModemLogs() {
bool shouldRestartModemLogging =
@ -76,5 +75,5 @@ void ModemLogDumper::startModemLogging() {
android_property_manager_.SetProperty(kModemLoggingEnabledProperty.data(),
"true");
}
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -7,8 +7,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
namespace modem {
namespace logging {
namespace pixel_modem::logging {
namespace {
using ::testing::Eq;
@ -101,6 +100,6 @@ TEST_F(ModemLogDumperTest,
EXPECT_FALSE(fake_android_property_manager.ModemLoggingHasRestarted());
}
} // namespace
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -7,8 +7,7 @@
#include "android_property_manager.h"
#include "modem_log_constants.h"
namespace modem {
namespace logging {
namespace pixel_modem::logging {
/**
* @brief Fake Implementation of AndroidPropertyManager that mocks some of the
@ -20,9 +19,8 @@ class FakeAndroidPropertyManager : public AndroidPropertyManager {
inline constexpr static std::string_view kFalseString = "false";
bool GetBoolProperty(const std::string& key, bool default_value) override {
return MapContainsKey(key)
? GetPropertyInternal(key) == kTruthString
: default_value;
return MapContainsKey(key) ? GetPropertyInternal(key) == kTruthString
: default_value;
};
std::string GetProperty(const std::string& key,
@ -73,5 +71,5 @@ class FakeAndroidPropertyManager : public AndroidPropertyManager {
bool modem_logging_has_been_off_ = false;
bool modem_logging_has_restarted_ = false;
};
} // namespace logging
} // namespace modem
} // namespace pixel_modem::logging

View File

@ -1,5 +1 @@
BOARD_VENDOR_SEPOLICY_DIRS += device/google/gs-common/modem/sepolicy
PRODUCT_PACKAGES += dump_modem.sh
PRODUCT_PACKAGES += dump_modemlog
include device/google/gs-common/modem/dump_modemlog/dump_modemlog.mk