blob: ae946d16b352e26acd6aa9fc2e8aba52f218abfa [file] [log] [blame]
David Chendd896942017-09-26 11:44:40 -07001/*
2 * Copyright (C) 2017 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Yangster-mac20877162017-12-22 17:19:39 -080017#pragma once
David Chendd896942017-09-26 11:44:40 -070018
Joe Onoratoc4dfae52017-10-17 23:38:21 -070019#include "logd/LogEvent.h"
20
David Chendd896942017-09-26 11:44:40 -070021#include <log/log_read.h>
Yao Chen44cf27c2017-09-14 22:32:50 -070022#include <log/logprint.h>
David Chendd896942017-09-26 11:44:40 -070023#include <set>
Yao Chend54f9dd2017-10-17 17:37:48 +000024#include <string>
David Chendd896942017-09-26 11:44:40 -070025#include <unordered_map>
Yao Chen44cf27c2017-09-14 22:32:50 -070026#include <vector>
Yao Chen9c1debe2018-02-19 14:39:19 -080027#include "frameworks/base/cmds/statsd/src/stats_log_common.pb.h"
Yao Chen44cf27c2017-09-14 22:32:50 -070028#include "frameworks/base/cmds/statsd/src/statsd_config.pb.h"
Yangster-mac20877162017-12-22 17:19:39 -080029#include "packages/UidMap.h"
Yao Chen9c1debe2018-02-19 14:39:19 -080030#include "stats_util.h"
David Chendd896942017-09-26 11:44:40 -070031
David Chendd896942017-09-26 11:44:40 -070032namespace android {
33namespace os {
34namespace statsd {
35
Yao Chencaf339d2017-10-06 16:01:10 -070036enum MatchingState {
37 kNotComputed = -1,
38 kNotMatched = 0,
39 kMatched = 1,
David Chendd896942017-09-26 11:44:40 -070040};
41
Yao Chencaf339d2017-10-06 16:01:10 -070042bool combinationMatch(const std::vector<int>& children, const LogicalOperation& operation,
43 const std::vector<MatchingState>& matcherResults);
44
Yangster-mac20877162017-12-22 17:19:39 -080045bool matchesSimple(const UidMap& uidMap,
46 const SimpleAtomMatcher& simpleMatcher, const LogEvent& wrapper);
47
Yao Chen44cf27c2017-09-14 22:32:50 -070048} // namespace statsd
49} // namespace os
50} // namespace android