pmt: Improvements for developers

- Android.bp was written to be included in ROMs/recoveries etc. in Android build system.
 - Macros have been added to simplify feature creation.
 - Some bug fixes (for JSON and pmt).
This commit is contained in:
2025-08-27 15:50:40 +03:00
parent 631c735a9a
commit e0f0b5b484
18 changed files with 200 additions and 109 deletions

View File

@@ -243,6 +243,14 @@ std::string getLibVersion();
#define LOGNF_IF(name, file, level, condition) \
if (condition) Helper::Logger(level, __func__, file, name, __FILE__, __LINE__)
#ifdef ANDROID_BUILD
#define MKVERSION(name) \
char vinfo[512]; \
sprintf(vinfo, \
"%s 1.2.0 [XXXX-XX-XX XX.XX.XX]\nBuildType: Release\nCompiler: clang\n" \
"BuildFlags: -Wall;-Werror;-Wno-deprecated-declarations;-Os", name); \
return std::string(vinfo)
#else
#define MKVERSION(name) \
char vinfo[512]; \
sprintf(vinfo, \
@@ -251,5 +259,6 @@ std::string getLibVersion();
name, BUILD_VERSION, BUILD_DATE, BUILD_TIME, BUILD_TYPE, \
BUILD_CMAKE_VERSION, BUILD_COMPILER_VERSION, BUILD_FLAGS); \
return std::string(vinfo)
#endif
#endif // #ifndef LIBHELPER_LIB_HPP

View File

@@ -58,10 +58,18 @@ Logger::~Logger() {
fd != -1)
close(fd);
else {
#ifdef ANDROID_BUILD
LoggingProperties::setLogFile("/tmp/last_pmt_logs.log")
#else
LoggingProperties::setLogFile("last_logs.log");
#endif
LOGN(HELPER, INFO) << "Cannot create log file: " << _logFile << ": "
<< strerror(errno)
#ifdef ANDROID_BUILD
<< " New logging file: /tmp/last_pmt_logs.log (this file)."
#else
<< " New logging file: last_logs.log (this file)."
#endif
<< std::endl;
}
}

View File

@@ -19,7 +19,12 @@
#include <ctime>
#include <cutils/android_reboot.h>
#include <fcntl.h>
#ifndef ANDROID_BUILD
#include <generated/buildInfo.hpp>
#include <sys/_system_properties.h>
#else
#include <sys/system_properties.h>
#endif
#include <iostream>
#include <libgen.h>
#include <libhelper/lib.hpp>

View File

@@ -20,7 +20,9 @@
#include <cstring>
#include <fcntl.h>
#include <filesystem>
#ifndef ANDROID_BUILD
#include <generated/buildInfo.hpp>
#endif
#include <iostream>
#include <libpartition_map/lib.hpp>
#include <linux/fs.h>