logd: don't use libcutils properties
This is the only non-socket usage of libcutils. Test: logging unit tests Change-Id: Ia9877ddb32da4955a818299c109e5c639423a9fd
This commit is contained in:
parent
0b3f9567c5
commit
a8c7f30651
|
@ -31,7 +31,6 @@
|
|||
#include <unordered_map>
|
||||
#include <utility>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
#include <private/android_logger.h>
|
||||
|
||||
#include "LogKlog.h"
|
||||
|
|
|
@ -16,13 +16,11 @@
|
|||
|
||||
#include <ctype.h>
|
||||
|
||||
#include <android-base/properties.h>
|
||||
#include <android-base/stringprintf.h>
|
||||
#include <cutils/properties.h>
|
||||
|
||||
#include "LogWhiteBlackList.h"
|
||||
|
||||
// White and Black list
|
||||
|
||||
Prune::Prune(uid_t uid, pid_t pid) : mUid(uid), mPid(pid) {
|
||||
}
|
||||
|
||||
|
@ -75,14 +73,12 @@ int PruneList::init(const char* str) {
|
|||
it = mNaughty.erase(it);
|
||||
}
|
||||
|
||||
static const char _default[] = "default";
|
||||
// default here means take ro.logd.filter, persist.logd.filter then
|
||||
// internal default in that order.
|
||||
if (str && !strcmp(str, _default)) {
|
||||
if (str && !strcmp(str, "default")) {
|
||||
str = nullptr;
|
||||
}
|
||||
static const char _disable[] = "disable";
|
||||
if (str && !strcmp(str, _disable)) {
|
||||
if (str && !strcmp(str, "disable")) {
|
||||
str = "";
|
||||
}
|
||||
|
||||
|
@ -91,22 +87,20 @@ int PruneList::init(const char* str) {
|
|||
if (str) {
|
||||
filter = str;
|
||||
} else {
|
||||
char property[PROPERTY_VALUE_MAX];
|
||||
property_get("ro.logd.filter", property, _default);
|
||||
filter = property;
|
||||
property_get("persist.logd.filter", property, filter.c_str());
|
||||
filter = android::base::GetProperty("ro.logd.filter", "default");
|
||||
auto persist_filter = android::base::GetProperty("persist.logd.filter", "default");
|
||||
// default here means take ro.logd.filter
|
||||
if (strcmp(property, _default)) {
|
||||
filter = property;
|
||||
if (persist_filter != "default") {
|
||||
filter = persist_filter;
|
||||
}
|
||||
}
|
||||
|
||||
// default here means take internal default.
|
||||
if (filter == _default) {
|
||||
if (filter == "default") {
|
||||
// See README.property for description of filter format
|
||||
filter = "~! ~1000/!";
|
||||
}
|
||||
if (filter == _disable) {
|
||||
if (filter == "disable") {
|
||||
filter = "";
|
||||
}
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _LOGD_LOG_WHITE_BLACK_LIST_H__
|
||||
#define _LOGD_LOG_WHITE_BLACK_LIST_H__
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
|
@ -24,8 +23,6 @@
|
|||
|
||||
#include "LogBufferElement.h"
|
||||
|
||||
// White and Blacklist
|
||||
|
||||
class Prune {
|
||||
friend class PruneList;
|
||||
|
||||
|
@ -84,5 +81,3 @@ class PruneList {
|
|||
|
||||
std::string format();
|
||||
};
|
||||
|
||||
#endif // _LOGD_LOG_WHITE_BLACK_LIST_H__
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
|
||||
#include <android-base/macros.h>
|
||||
#include <cutils/android_get_control_file.h>
|
||||
#include <cutils/properties.h>
|
||||
#include <cutils/sockets.h>
|
||||
#include <log/event_tag_map.h>
|
||||
#include <packagelistparser/packagelistparser.h>
|
||||
|
|
Loading…
Reference in New Issue