Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8a15f4df authored by Stefan Lafon's avatar Stefan Lafon Committed by Android (Google) Code Review
Browse files

Merge "Rename a few things in statsd_config.proto."

parents edb95359 b8c9aa8c
Loading
Loading
Loading
Loading
+33 −33
Original line number Diff line number Diff line
@@ -348,69 +348,69 @@ StatsdConfig build_fake_config() {
    gaugeMetric->mutable_bucket()->set_bucket_size_millis(60 * 1000L);

    // Event matchers............
    LogEntryMatcher* temperatureEntryMatcher = config.add_log_entry_matcher();
    temperatureEntryMatcher->set_name("DEVICE_TEMPERATURE");
    temperatureEntryMatcher->mutable_simple_log_entry_matcher()->set_tag(
    AtomMatcher* temperatureAtomMatcher = config.add_atom_matcher();
    temperatureAtomMatcher->set_name("DEVICE_TEMPERATURE");
    temperatureAtomMatcher->mutable_simple_atom_matcher()->set_tag(
        DEVICE_TEMPERATURE_TAG_ID);

    LogEntryMatcher* eventMatcher = config.add_log_entry_matcher();
    AtomMatcher* eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("SCREEN_TURNED_ON");
    SimpleLogEntryMatcher* simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(SCREEN_EVENT_TAG_ID);
    KeyValueMatcher* keyValueMatcher = simpleLogEntryMatcher->add_key_value_matcher();
    SimpleAtomMatcher* simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(SCREEN_EVENT_TAG_ID);
    KeyValueMatcher* keyValueMatcher = simpleAtomMatcher->add_key_value_matcher();
    keyValueMatcher->mutable_key_matcher()->set_key(SCREEN_EVENT_STATE_KEY);
    keyValueMatcher->set_eq_int(SCREEN_EVENT_ON_VALUE);

    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("SCREEN_TURNED_OFF");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(SCREEN_EVENT_TAG_ID);
    keyValueMatcher = simpleLogEntryMatcher->add_key_value_matcher();
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(SCREEN_EVENT_TAG_ID);
    keyValueMatcher = simpleAtomMatcher->add_key_value_matcher();
    keyValueMatcher->mutable_key_matcher()->set_key(SCREEN_EVENT_STATE_KEY);
    keyValueMatcher->set_eq_int(SCREEN_EVENT_OFF_VALUE);

    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("PROCESS_STATE_CHANGE");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(UID_PROCESS_STATE_TAG_ID);
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(UID_PROCESS_STATE_TAG_ID);

    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("APP_GOES_BACKGROUND");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(APP_USAGE_ID);
    keyValueMatcher = simpleLogEntryMatcher->add_key_value_matcher();
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(APP_USAGE_ID);
    keyValueMatcher = simpleAtomMatcher->add_key_value_matcher();
    keyValueMatcher->mutable_key_matcher()->set_key(APP_USAGE_STATE_KEY);
    keyValueMatcher->set_eq_int(APP_USAGE_BACKGROUND);

    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("APP_GOES_FOREGROUND");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(APP_USAGE_ID);
    keyValueMatcher = simpleLogEntryMatcher->add_key_value_matcher();
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(APP_USAGE_ID);
    keyValueMatcher = simpleAtomMatcher->add_key_value_matcher();
    keyValueMatcher->mutable_key_matcher()->set_key(APP_USAGE_STATE_KEY);
    keyValueMatcher->set_eq_int(APP_USAGE_FOREGROUND);

    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("APP_GET_WL");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(WAKE_LOCK_TAG_ID);
    keyValueMatcher = simpleLogEntryMatcher->add_key_value_matcher();
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(WAKE_LOCK_TAG_ID);
    keyValueMatcher = simpleAtomMatcher->add_key_value_matcher();
    keyValueMatcher->mutable_key_matcher()->set_key(WAKE_LOCK_STATE_KEY);
    keyValueMatcher->set_eq_int(WAKE_LOCK_ACQUIRE_VALUE);

    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("APP_RELEASE_WL");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(WAKE_LOCK_TAG_ID);
    keyValueMatcher = simpleLogEntryMatcher->add_key_value_matcher();
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(WAKE_LOCK_TAG_ID);
    keyValueMatcher = simpleAtomMatcher->add_key_value_matcher();
    keyValueMatcher->mutable_key_matcher()->set_key(WAKE_LOCK_STATE_KEY);
    keyValueMatcher->set_eq_int(WAKE_LOCK_RELEASE_VALUE);

    // pulled events
    eventMatcher = config.add_log_entry_matcher();
    eventMatcher = config.add_atom_matcher();
    eventMatcher->set_name("KERNEL_WAKELOCK");
    simpleLogEntryMatcher = eventMatcher->mutable_simple_log_entry_matcher();
    simpleLogEntryMatcher->set_tag(KERNEL_WAKELOCK_TAG_ID);
    simpleAtomMatcher = eventMatcher->mutable_simple_atom_matcher();
    simpleAtomMatcher->set_tag(KERNEL_WAKELOCK_TAG_ID);

    // Conditions.............
    Condition* condition = config.add_condition();
+2 −2
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ CombinationLogMatchingTracker::CombinationLogMatchingTracker(const string& name,
CombinationLogMatchingTracker::~CombinationLogMatchingTracker() {
}

bool CombinationLogMatchingTracker::init(const vector<LogEntryMatcher>& allLogMatchers,
bool CombinationLogMatchingTracker::init(const vector<AtomMatcher>& allLogMatchers,
                                         const vector<sp<LogMatchingTracker>>& allTrackers,
                                         const unordered_map<string, int>& matcherMap,
                                         vector<bool>& stack) {
@@ -47,7 +47,7 @@ bool CombinationLogMatchingTracker::init(const vector<LogEntryMatcher>& allLogMa
    // mark this node as visited in the recursion stack.
    stack[mIndex] = true;

    LogEntryMatcher_Combination matcher = allLogMatchers[mIndex].combination();
    AtomMatcher_Combination matcher = allLogMatchers[mIndex].combination();

    // LogicalOperation is missing in the config
    if (!matcher.has_operation()) {
+2 −2
Original line number Diff line number Diff line
@@ -28,12 +28,12 @@ namespace android {
namespace os {
namespace statsd {

// Represents a LogEntryMatcher_Combination in the StatsdConfig.
// Represents a AtomMatcher_Combination in the StatsdConfig.
class CombinationLogMatchingTracker : public virtual LogMatchingTracker {
public:
    CombinationLogMatchingTracker(const std::string& name, const int index);

    bool init(const std::vector<LogEntryMatcher>& allLogMatchers,
    bool init(const std::vector<AtomMatcher>& allLogMatchers,
              const std::vector<sp<LogMatchingTracker>>& allTrackers,
              const std::unordered_map<std::string, int>& matcherMap,
              std::vector<bool>& stack);
+2 −2
Original line number Diff line number Diff line
@@ -39,14 +39,14 @@ public:
    virtual ~LogMatchingTracker(){};

    // Initialize this LogMatchingTracker.
    // allLogMatchers: the list of the LogEntryMatcher proto config. This is needed because we don't
    // allLogMatchers: the list of the AtomMatcher proto config. This is needed because we don't
    //                 store the proto object in memory. We only need it during initilization.
    // allTrackers: the list of the LogMatchingTracker objects. It's a one-to-one mapping with
    //              allLogMatchers. This is needed because the initialization is done recursively
    //              for CombinationLogMatchingTrackers using DFS.
    // stack: a bit map to record which matcher has been visited on the stack. This is for detecting
    //        circle dependency.
    virtual bool init(const std::vector<LogEntryMatcher>& allLogMatchers,
    virtual bool init(const std::vector<AtomMatcher>& allLogMatchers,
                      const std::vector<sp<LogMatchingTracker>>& allTrackers,
                      const std::unordered_map<std::string, int>& matcherMap,
                      std::vector<bool>& stack) = 0;
+2 −2
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ using std::vector;


SimpleLogMatchingTracker::SimpleLogMatchingTracker(const string& name, const int index,
                                                   const SimpleLogEntryMatcher& matcher)
                                                   const SimpleAtomMatcher& matcher)
    : LogMatchingTracker(name, index), mMatcher(matcher) {
    if (!matcher.has_tag()) {
        mInitialized = false;
@@ -43,7 +43,7 @@ SimpleLogMatchingTracker::SimpleLogMatchingTracker(const string& name, const int
SimpleLogMatchingTracker::~SimpleLogMatchingTracker() {
}

bool SimpleLogMatchingTracker::init(const vector<LogEntryMatcher>& allLogMatchers,
bool SimpleLogMatchingTracker::init(const vector<AtomMatcher>& allLogMatchers,
                                    const vector<sp<LogMatchingTracker>>& allTrackers,
                                    const unordered_map<string, int>& matcherMap,
                                    vector<bool>& stack) {
Loading