diff --git a/logd/LogBuffer.cpp b/logd/LogBuffer.cpp index 1e4f3b01e..5922f16e6 100644 --- a/logd/LogBuffer.cpp +++ b/logd/LogBuffer.cpp @@ -100,6 +100,11 @@ void LogBuffer::init() { unsigned long default_size = property_get_size(global_tuneable); if (!default_size) { default_size = property_get_size(global_default); + if (!default_size) { + default_size = property_get_bool("ro.config.low_ram", false) ? + LOG_BUFFER_MIN_SIZE : // 64K + LOG_BUFFER_SIZE; // 256K + } } log_id_for_each(i) { diff --git a/logd/LogUtils.h b/logd/LogUtils.h index b591f2892..fccba6152 100644 --- a/logd/LogUtils.h +++ b/logd/LogUtils.h @@ -43,6 +43,9 @@ const char *tagToName(uint32_t tag); bool clientHasLogCredentials(uid_t uid, gid_t gid, pid_t pid); bool clientHasLogCredentials(SocketClient *cli); +// Furnished in main.cpp +bool property_get_bool(const char *key, bool def); + static inline bool worstUidEnabledForLogid(log_id_t id) { return (id == LOG_ID_MAIN) || (id == LOG_ID_SYSTEM) || (id == LOG_ID_RADIO); } diff --git a/logd/main.cpp b/logd/main.cpp index 0f55d6081..2fcabdc9d 100644 --- a/logd/main.cpp +++ b/logd/main.cpp @@ -143,7 +143,7 @@ static int drop_privs() { } // Property helper -static bool property_get_bool(const char *key, bool def) { +bool property_get_bool(const char *key, bool def) { char property[PROPERTY_VALUE_MAX]; property_get(key, property, "");