Move some properties users to __system_property_read_callback()
This is needed if they will ever handle ro. properties that have
values longer than 92 characters.
Bug: 23102347
Bug: 34954705
Test: read and write properties with value length > 92 characters
Change-Id: I44aa135c97ec010f12162c30f743387810ae2c5d
diff --git a/debuggerd/libdebuggerd/tombstone.cpp b/debuggerd/libdebuggerd/tombstone.cpp
index 418d092..e455693 100644
--- a/debuggerd/libdebuggerd/tombstone.cpp
+++ b/debuggerd/libdebuggerd/tombstone.cpp
@@ -35,12 +35,12 @@
#include <string>
#include <android-base/file.h>
+#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <android-base/unique_fd.h>
#include <android/log.h>
#include <backtrace/Backtrace.h>
#include <backtrace/BacktraceMap.h>
-#include <cutils/properties.h>
#include <log/log.h>
#include <log/logprint.h>
#include <private/android_filesystem_config.h>
@@ -53,6 +53,8 @@
#include "libdebuggerd/machine.h"
#include "libdebuggerd/open_files_list.h"
+using android::base::GetBoolProperty;
+using android::base::GetProperty;
using android::base::StringPrintf;
#define STACK_WORDS 16
@@ -206,14 +208,11 @@
}
static void dump_header_info(log_t* log) {
- char fingerprint[PROPERTY_VALUE_MAX];
- char revision[PROPERTY_VALUE_MAX];
+ auto fingerprint = GetProperty("ro.build.fingerprint", "unknown");
+ auto revision = GetProperty("ro.revision", "unknown");
- property_get("ro.build.fingerprint", fingerprint, "unknown");
- property_get("ro.revision", revision, "unknown");
-
- _LOG(log, logtype::HEADER, "Build fingerprint: '%s'\n", fingerprint);
- _LOG(log, logtype::HEADER, "Revision: '%s'\n", revision);
+ _LOG(log, logtype::HEADER, "Build fingerprint: '%s'\n", fingerprint.c_str());
+ _LOG(log, logtype::HEADER, "Revision: '%s'\n", revision.c_str());
_LOG(log, logtype::HEADER, "ABI: '%s'\n", ABI_STRING);
}
@@ -722,9 +721,7 @@
const std::string& process_name, const std::map<pid_t, std::string>& threads,
uintptr_t abort_msg_address) {
// don't copy log messages to tombstone unless this is a dev device
- char value[PROPERTY_VALUE_MAX];
- property_get("ro.debuggable", value, "0");
- bool want_logs = (value[0] == '1');
+ bool want_logs = GetBoolProperty("ro.debuggable", false);
_LOG(log, logtype::HEADER,
"*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***\n");