modem/modem_log_constants: create common folder
A lot of different modem related processes require reading / writing to the same android system properties. This CL solifies them all into one place to avoid duplication. Test: build Bug: 302435001 Change-Id: I113f43bb68833224f45ad91668cd327587e1649b
This commit is contained in:
parent
0944a8db52
commit
93c22b6672
@ -24,6 +24,7 @@ cc_defaults {
|
||||
"libbase",
|
||||
// liblog is not directly used by us, but it's a transitive dependency of libbase
|
||||
"liblog",
|
||||
"modem_log_constants",
|
||||
],
|
||||
}
|
||||
|
||||
@ -65,8 +66,10 @@ cc_test {
|
||||
"modem_android_property_manager_fake_defaults",
|
||||
],
|
||||
static_libs: [
|
||||
"modem_log_dumper",
|
||||
"modem_android_property_manager",
|
||||
"modem_android_property_manager_fake",
|
||||
"modem_log_constants",
|
||||
"modem_log_dumper",
|
||||
"libgmock",
|
||||
],
|
||||
vendor: true,
|
||||
|
33
modem/dump_modemlog/include/bugreport_constants.h
Normal file
33
modem/dump_modemlog/include/bugreport_constants.h
Normal file
@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "dumper.h"
|
||||
|
||||
namespace pixel_modem::logging {
|
||||
|
||||
inline constexpr std::string_view kBugreportPackingDirectory =
|
||||
"/data/vendor/radio/logs/always-on/all_logs";
|
||||
|
||||
inline constexpr LogDumpInfo kLogDumpInfo[] = {
|
||||
{.src_dir = "/data/vendor/radio/extended_logs",
|
||||
.dest_dir = kBugreportPackingDirectory,
|
||||
.limit = 20,
|
||||
.prefix = "extended_log_"},
|
||||
{.src_dir = "/data/vendor/radio/sim/",
|
||||
.dest_dir = kBugreportPackingDirectory,
|
||||
.limit = 1,
|
||||
.prefix = "sim_poweron_log_"},
|
||||
{.src_dir = "data/vendor/radio/logs/history",
|
||||
.dest_dir = kBugreportPackingDirectory,
|
||||
.limit = 2,
|
||||
.prefix = "Logging"}};
|
||||
|
||||
constexpr FileCopyInfo kFileCopyInfo[] = {
|
||||
{.src_dir = "/mnt/vendor/efs/nv_normal.bin",
|
||||
.dest_dir = "/data/vendor/radio/logs/always-on/all_logs/nv_normal.bin"},
|
||||
{.src_dir = "/mnt/vendor/efs/nv_protected.bin",
|
||||
.dest_dir =
|
||||
"/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"}};
|
||||
|
||||
} // namespace pixel_modem::logging
|
@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
#include <string>
|
||||
|
||||
#include "dumper.h"
|
||||
|
||||
namespace pixel_modem::logging {
|
||||
|
||||
// Modem related Android System Properties
|
||||
|
||||
// Controls triggering `modem_logging_start` and `modem_logging_stop`.
|
||||
inline constexpr static std::string_view kModemLoggingEnabledProperty =
|
||||
"vendor.sys.modem.logging.enable";
|
||||
// Signals the current modem logging state. This will be set to
|
||||
// `vendor.sys.modem.logging.enable` when `modem_log_start` or `modem_log_stop`
|
||||
// terminates.
|
||||
inline constexpr static std::string_view kModemLoggingStatusProperty =
|
||||
"vendor.sys.modem.logging.status";
|
||||
// Int which specifies how many files to include in the bugreport.
|
||||
inline constexpr static std::string_view kModemLoggingNumberBugreportProperty =
|
||||
"persist.vendor.sys.modem.logging.br_num";
|
||||
// Signals the current location that is being logged to. This can be used to
|
||||
// determine the logging type.
|
||||
inline constexpr static std::string_view kModemLoggingPathProperty =
|
||||
"vendor.sys.modem.logging.log_path";
|
||||
|
||||
// Bugreport constants
|
||||
inline constexpr static int kDefaultBugreportNumberFiles = 100;
|
||||
inline constexpr static std::string_view kModemAlwaysOnLogDirectory =
|
||||
"/data/vendor/radio/logs/always-on";
|
||||
inline constexpr static std::string_view kModemLogPrefix = "sbuff_";
|
||||
inline constexpr static std::string_view kBugreportPackingDirectory =
|
||||
"/data/vendor/radio/logs/always-on/all_logs";
|
||||
|
||||
inline constexpr static LogDumpInfo kLogDumpInfo[] = {
|
||||
{.src_dir = "/data/vendor/radio/extended_logs",
|
||||
.dest_dir = kBugreportPackingDirectory,
|
||||
.limit = 20,
|
||||
.prefix = "extended_log_"},
|
||||
{.src_dir = "/data/vendor/radio/sim/",
|
||||
.dest_dir = kBugreportPackingDirectory,
|
||||
.limit = 1,
|
||||
.prefix = "sim_poweron_log_"},
|
||||
{.src_dir = "data/vendor/radio/logs/history",
|
||||
.dest_dir = kBugreportPackingDirectory,
|
||||
.limit = 2,
|
||||
.prefix = "Logging"}};
|
||||
|
||||
constexpr static FileCopyInfo kFileCopyInfo[] = {
|
||||
{.src_dir = "/mnt/vendor/efs/nv_normal.bin",
|
||||
.dest_dir = "/data/vendor/radio/logs/always-on/all_logs/nv_normal.bin"},
|
||||
{.src_dir = "/mnt/vendor/efs/nv_protected.bin",
|
||||
.dest_dir =
|
||||
"/data/vendor/radio/logs/always-on/all_logs/nv_protected.bin"}};
|
||||
|
||||
} // namespace pixel_modem::logging
|
@ -2,6 +2,7 @@
|
||||
|
||||
#include <log/log.h>
|
||||
|
||||
#include "bugreport_constants.h"
|
||||
#include "dumper.h"
|
||||
#include "modem_log_constants.h"
|
||||
|
||||
|
@ -2,10 +2,13 @@
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "android_property_manager.h"
|
||||
#include "bugreport_constants.h"
|
||||
#include "dumper.h"
|
||||
#include "fake_android_property_manager.h"
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "modem_log_constants.h"
|
||||
|
||||
namespace pixel_modem::logging {
|
||||
namespace {
|
||||
@ -22,9 +25,8 @@ inline constexpr static LogDumpInfo kAlwaysOnLogDumpInfo = {
|
||||
|
||||
void StartModemLogging(
|
||||
FakeAndroidPropertyManager& fake_android_property_manager) {
|
||||
fake_android_property_manager.SetProperty(
|
||||
kModemLoggingEnabledProperty.data(),
|
||||
FakeAndroidPropertyManager::kTruthString.data());
|
||||
fake_android_property_manager.SetProperty(kModemLoggingEnabledProperty.data(),
|
||||
kTruthString.data());
|
||||
}
|
||||
|
||||
class MockDumper : public Dumper {
|
||||
|
9
modem/modem_log_constants/Android.bp
Normal file
9
modem/modem_log_constants/Android.bp
Normal file
@ -0,0 +1,9 @@
|
||||
package {
|
||||
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||
}
|
||||
|
||||
cc_library {
|
||||
name: "modem_log_constants",
|
||||
export_include_dirs: [ "include" ],
|
||||
vendor_available: true,
|
||||
}
|
31
modem/modem_log_constants/include/modem_log_constants.h
Normal file
31
modem/modem_log_constants/include/modem_log_constants.h
Normal file
@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <string_view>
|
||||
|
||||
namespace pixel_modem::logging {
|
||||
|
||||
// Modem related Android System Properties
|
||||
|
||||
// Controls triggering `modem_logging_start` and `modem_logging_stop`.
|
||||
inline constexpr std::string_view kModemLoggingEnabledProperty =
|
||||
"vendor.sys.modem.logging.enable";
|
||||
// Signals the current modem logging state. This will be set to
|
||||
// `vendor.sys.modem.logging.enable` when `modem_log_start` or `modem_log_stop`
|
||||
// terminates.
|
||||
inline constexpr std::string_view kModemLoggingStatusProperty =
|
||||
"vendor.sys.modem.logging.status";
|
||||
// Int which specifies how many files to include in the bugreport.
|
||||
inline constexpr std::string_view kModemLoggingNumberBugreportProperty =
|
||||
"persist.vendor.sys.modem.logging.br_num";
|
||||
// Signals the current location that is being logged to. This can be used to
|
||||
// determine the logging type.
|
||||
inline constexpr std::string_view kModemLoggingPathProperty =
|
||||
"vendor.sys.modem.logging.log_path";
|
||||
|
||||
// Bugreport constants
|
||||
inline constexpr int kDefaultBugreportNumberFiles = 100;
|
||||
inline constexpr std::string_view kModemAlwaysOnLogDirectory =
|
||||
"/data/vendor/radio/logs/always-on";
|
||||
inline constexpr std::string_view kModemLogPrefix = "sbuff_";
|
||||
|
||||
} // namespace pixel_modem::logging
|
Loading…
x
Reference in New Issue
Block a user