#ifndef RESTRICTED_EVENT_METRIC_PRODUCER_H #define RESTRICTED_EVENT_METRIC_PRODUCER_H #include #include "EventMetricProducer.h" #include "utils/RestrictedPolicyManager.h" namespace android { namespace os { namespace statsd { class RestrictedEventMetricProducer : public EventMetricProducer { public: RestrictedEventMetricProducer( const ConfigKey& key, const EventMetric& eventMetric, const int conditionIndex, const vector& initialConditionCache, const sp& wizard, const uint64_t protoHash, int64_t startTimeNs, const wp configMetadataProvider, const std::unordered_map>& eventActivationMap = {}, const std::unordered_map>>& eventDeactivationMap = {}, const vector& slicedStateAtoms = {}, const unordered_map>& stateGroupMap = {}); void onMetricRemove() override; void enforceRestrictedDataTtl(sqlite3* db, int64_t wallClockNs); void flushRestrictedData() override; bool writeMetricMetadataToProto(metadata::MetricMetadata* metricMetadata) override; void loadMetricMetadataFromProto(const metadata::MetricMetadata& metricMetadata) override; inline StatsdRestrictionCategory getRestrictionCategory() { std::lock_guard lock(mMutex); return mRestrictedDataCategory; } private: void onMatchedLogEventInternalLocked( const size_t matcherIndex, const MetricDimensionKey& eventKey, const ConditionKey& conditionKey, bool condition, const LogEvent& event, const std::map& statePrimaryKeys) override; void onDumpReportLocked(const int64_t dumpTimeNs, const bool include_current_partial_bucket, const bool erase_data, const DumpLatency dumpLatency, std::set* str_set, android::util::ProtoOutputStream* protoOutput) override; void clearPastBucketsLocked(const int64_t dumpTimeNs) override; void dropDataLocked(const int64_t dropTimeNs) override; void deleteMetricTable(); bool mIsMetricTableCreated = false; StatsdRestrictionCategory mRestrictedDataCategory; vector mLogEvents; }; } // namespace statsd } // namespace os } // namespace android #endif // RESTRICTED_EVENT_METRIC_PRODUCER_H