488 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
			
		
		
	
	
			488 lines
		
	
	
		
			14 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
| //
 | |
| // Copyright (C) 2017 The Android Open Source Project
 | |
| //
 | |
| // Licensed under the Apache License, Version 2.0 (the "License");
 | |
| // you may not use this file except in compliance with the License.
 | |
| // You may obtain a copy of the License at
 | |
| //
 | |
| //      http://www.apache.org/licenses/LICENSE-2.0
 | |
| //
 | |
| // Unless required by applicable law or agreed to in writing, software
 | |
| // distributed under the License is distributed on an "AS IS" BASIS,
 | |
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | |
| // See the License for the specific language governing permissions and
 | |
| // limitations under the License.
 | |
| //
 | |
| 
 | |
| package {
 | |
|     default_applicable_licenses: ["Android-Apache-2.0"],
 | |
| }
 | |
| 
 | |
| cc_defaults {
 | |
|     name: "statsd_defaults",
 | |
| 
 | |
|     srcs: [
 | |
|         "src/active_config_list.proto",
 | |
|         "src/anomaly/AlarmMonitor.cpp",
 | |
|         "src/anomaly/AlarmTracker.cpp",
 | |
|         "src/anomaly/AnomalyTracker.cpp",
 | |
|         "src/anomaly/DurationAnomalyTracker.cpp",
 | |
|         "src/anomaly/subscriber_util.cpp",
 | |
|         "src/condition/CombinationConditionTracker.cpp",
 | |
|         "src/condition/condition_util.cpp",
 | |
|         "src/condition/ConditionWizard.cpp",
 | |
|         "src/condition/SimpleConditionTracker.cpp",
 | |
|         "src/config/ConfigKey.cpp",
 | |
|         "src/config/ConfigListener.cpp",
 | |
|         "src/config/ConfigManager.cpp",
 | |
|         "src/experiment_ids.proto",
 | |
|         "src/external/Perfetto.cpp",
 | |
|         "src/external/PullResultReceiver.cpp",
 | |
|         "src/external/puller_util.cpp",
 | |
|         "src/external/StatsCallbackPuller.cpp",
 | |
|         "src/external/StatsPuller.cpp",
 | |
|         "src/external/StatsPullerManager.cpp",
 | |
|         "src/external/TrainInfoPuller.cpp",
 | |
|         "src/FieldValue.cpp",
 | |
|         "src/flags/FlagProvider.cpp",
 | |
|         "src/guardrail/StatsdStats.cpp",
 | |
|         "src/hash.cpp",
 | |
|         "src/HashableDimensionKey.cpp",
 | |
|         "src/logd/LogEvent.cpp",
 | |
|         "src/logd/LogEventQueue.cpp",
 | |
|         "src/matchers/CombinationAtomMatchingTracker.cpp",
 | |
|         "src/matchers/EventMatcherWizard.cpp",
 | |
|         "src/matchers/matcher_util.cpp",
 | |
|         "src/matchers/SimpleAtomMatchingTracker.cpp",
 | |
|         "src/metadata_util.cpp",
 | |
|         "src/metrics/CountMetricProducer.cpp",
 | |
|         "src/metrics/duration_helper/MaxDurationTracker.cpp",
 | |
|         "src/metrics/duration_helper/OringDurationTracker.cpp",
 | |
|         "src/metrics/DurationMetricProducer.cpp",
 | |
|         "src/metrics/EventMetricProducer.cpp",
 | |
|         "src/metrics/GaugeMetricProducer.cpp",
 | |
|         "src/metrics/KllMetricProducer.cpp",
 | |
|         "src/metrics/MetricProducer.cpp",
 | |
|         "src/metrics/MetricsManager.cpp",
 | |
|         "src/metrics/ValueMetricProducer.cpp",
 | |
|         "src/metrics/parsing_utils/config_update_utils.cpp",
 | |
|         "src/metrics/parsing_utils/metrics_manager_util.cpp",
 | |
|         "src/metrics/NumericValueMetricProducer.cpp",
 | |
|         "src/packages/UidMap.cpp",
 | |
|         "src/shell/shell_config.proto",
 | |
|         "src/shell/ShellSubscriber.cpp",
 | |
|         "src/socket/StatsSocketListener.cpp",
 | |
|         "src/state/StateManager.cpp",
 | |
|         "src/state/StateTracker.cpp",
 | |
|         "src/stats_log_util.cpp",
 | |
|         "src/statscompanion_util.cpp",
 | |
|         "src/statsd_config.proto",
 | |
|         "src/statsd_metadata.proto",
 | |
|         "src/StatsLogProcessor.cpp",
 | |
|         "src/StatsService.cpp",
 | |
|         "src/storage/StorageManager.cpp",
 | |
|         "src/subscriber/IncidentdReporter.cpp",
 | |
|         "src/subscriber/SubscriberReporter.cpp",
 | |
|         "src/uid_data.proto",
 | |
|         "src/utils/MultiConditionTrigger.cpp",
 | |
|     ],
 | |
| 
 | |
|     local_include_dirs: [
 | |
|         "src",
 | |
|     ],
 | |
| 
 | |
|     static_libs: [
 | |
|         "libbase",
 | |
|         "libcutils",
 | |
|         "libkll",
 | |
|         "libmodules-utils-build",
 | |
|         "libprotoutil",
 | |
|         "libstatslog_statsd",
 | |
|         "libsysutils",
 | |
|         "libutils",
 | |
|         "server_configurable_flags",
 | |
|         "statsd-aidl-ndk",
 | |
|     ],
 | |
|     shared_libs: [
 | |
|         "libbinder_ndk",
 | |
|         "libincident",
 | |
|         "liblog",
 | |
|     ],
 | |
|     header_libs: [
 | |
|         "libgtest_prod_headers",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| genrule {
 | |
|     name: "statslog_statsd.h",
 | |
|     tools: ["stats-log-api-gen"],
 | |
|     cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_statsd.h --module statsd --namespace android,os,statsd,util",
 | |
|     out: [
 | |
|         "statslog_statsd.h",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| genrule {
 | |
|     name: "statslog_statsd.cpp",
 | |
|     tools: ["stats-log-api-gen"],
 | |
|     cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_statsd.cpp --module statsd --namespace android,os,statsd,util --importHeader statslog_statsd.h",
 | |
|     out: [
 | |
|         "statslog_statsd.cpp",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| genrule {
 | |
|     name: "statslog_statsdtest.h",
 | |
|     tools: ["stats-log-api-gen"],
 | |
|     cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_statsdtest.h --module statsdtest --namespace android,os,statsd,util",
 | |
|     out: [
 | |
|         "statslog_statsdtest.h",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| genrule {
 | |
|     name: "statslog_statsdtest.cpp",
 | |
|     tools: ["stats-log-api-gen"],
 | |
|     cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_statsdtest.cpp --module statsdtest --namespace android,os,statsd,util --importHeader statslog_statsdtest.h",
 | |
|     out: [
 | |
|         "statslog_statsdtest.cpp",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| cc_library_static {
 | |
|     name: "libstatslog_statsdtest",
 | |
|     generated_sources: ["statslog_statsdtest.cpp"],
 | |
|     generated_headers: ["statslog_statsdtest.h"],
 | |
|     export_generated_headers: ["statslog_statsdtest.h"],
 | |
|     shared_libs: [
 | |
|         "libstatssocket",
 | |
|         "libstatspull",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| cc_library_static {
 | |
|     name: "libstatslog_statsd",
 | |
|     generated_sources: ["statslog_statsd.cpp"],
 | |
|     generated_headers: ["statslog_statsd.h"],
 | |
|     export_generated_headers: ["statslog_statsd.h"],
 | |
|     apex_available: [
 | |
|         "com.android.os.statsd",
 | |
|         "test_com.android.os.statsd",
 | |
|     ],
 | |
|     min_sdk_version: "30",
 | |
|     shared_libs: [
 | |
|         "libstatssocket",
 | |
|         "libstatspull",
 | |
|     ],
 | |
|     export_shared_lib_headers: [
 | |
|         "libstatspull",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| // =========
 | |
| // statsd
 | |
| // =========
 | |
| 
 | |
| cc_binary {
 | |
|     name: "statsd",
 | |
|     defaults: ["statsd_defaults"],
 | |
| 
 | |
|     srcs: ["src/main.cpp"],
 | |
| 
 | |
|     cflags: [
 | |
|         "-Wall",
 | |
|         "-Wextra",
 | |
|         "-Werror",
 | |
|         "-Wno-unused-parameter",
 | |
|         // optimize for size (protobuf glop can get big)
 | |
|         "-Os",
 | |
|         // "-g",
 | |
|         // "-O0",
 | |
|     ],
 | |
| 
 | |
|     product_variables: {
 | |
|         eng: {
 | |
|             // Enable sanitizer ONLY on eng builds
 | |
|             //sanitize: {
 | |
|             //    address: true,
 | |
|             //},
 | |
|         },
 | |
|     },
 | |
| 
 | |
|     proto: {
 | |
|         type: "lite",
 | |
|         static: true,
 | |
|     },
 | |
|     stl: "libc++_static",
 | |
| 
 | |
|     shared_libs: [
 | |
|         "libstatssocket",
 | |
|     ],
 | |
| 
 | |
|     apex_available: [
 | |
|         "com.android.os.statsd",
 | |
|         "test_com.android.os.statsd",
 | |
|     ],
 | |
|     min_sdk_version: "30",
 | |
| 
 | |
|     sanitize: {
 | |
|         memtag_heap: true,
 | |
|     },
 | |
| }
 | |
| 
 | |
| // ==============
 | |
| // statsd_test
 | |
| // ==============
 | |
| 
 | |
| cc_test {
 | |
|     name: "statsd_test",
 | |
|     defaults: ["statsd_defaults"],
 | |
|     test_suites: ["device-tests", "mts-statsd"],
 | |
|     test_config: "statsd_test.xml",
 | |
| 
 | |
|     //TODO(b/153588990): Remove when the build system properly separates
 | |
|     //32bit and 64bit architectures.
 | |
|     compile_multilib: "both",
 | |
|     multilib: {
 | |
|         lib64: {
 | |
|             suffix: "64",
 | |
|         },
 | |
|         lib32: {
 | |
|             suffix: "32",
 | |
|         },
 | |
|     },
 | |
| 
 | |
|     cflags: [
 | |
|         "-Wall",
 | |
|         "-Werror",
 | |
|         "-Wno-enum-compare",
 | |
|         "-Wno-missing-field-initializers",
 | |
|         "-Wno-unused-function",
 | |
|         "-Wno-unused-parameter",
 | |
|         "-Wno-unused-variable",
 | |
|     ],
 | |
| 
 | |
|     require_root: true,
 | |
| 
 | |
|     srcs: [
 | |
|         // atom_field_options.proto needs field_options.proto, but that is
 | |
|         // not included in libprotobuf-cpp-lite, so compile it here.
 | |
|         ":libprotobuf-internal-protos",
 | |
|         ":libstats_internal_protos",
 | |
| 
 | |
|         "src/shell/shell_data.proto",
 | |
|         "src/stats_log.proto",
 | |
|         "tests/AlarmMonitor_test.cpp",
 | |
|         "tests/anomaly/AlarmTracker_test.cpp",
 | |
|         "tests/anomaly/AnomalyTracker_test.cpp",
 | |
|         "tests/condition/CombinationConditionTracker_test.cpp",
 | |
|         "tests/condition/ConditionTimer_test.cpp",
 | |
|         "tests/condition/SimpleConditionTracker_test.cpp",
 | |
|         "tests/ConfigManager_test.cpp",
 | |
|         "tests/e2e/Alarm_e2e_test.cpp",
 | |
|         "tests/e2e/Anomaly_count_e2e_test.cpp",
 | |
|         "tests/e2e/Anomaly_duration_sum_e2e_test.cpp",
 | |
|         "tests/e2e/Attribution_e2e_test.cpp",
 | |
|         "tests/e2e/ConfigTtl_e2e_test.cpp",
 | |
|         "tests/e2e/ConfigUpdate_e2e_ab_test.cpp",
 | |
|         "tests/e2e/ConfigUpdate_e2e_test.cpp",
 | |
|         "tests/e2e/CountMetric_e2e_test.cpp",
 | |
|         "tests/e2e/DurationMetric_e2e_test.cpp",
 | |
|         "tests/e2e/EventMetric_e2e_test.cpp",
 | |
|         "tests/e2e/GaugeMetric_e2e_pull_test.cpp",
 | |
|         "tests/e2e/GaugeMetric_e2e_push_test.cpp",
 | |
|         "tests/e2e/KllMetric_e2e_test.cpp",
 | |
|         "tests/e2e/MetricActivation_e2e_test.cpp",
 | |
|         "tests/e2e/MetricConditionLink_e2e_test.cpp",
 | |
|         "tests/e2e/PartialBucket_e2e_test.cpp",
 | |
|         "tests/e2e/ValueMetric_pull_e2e_test.cpp",
 | |
|         "tests/e2e/WakelockDuration_e2e_test.cpp",
 | |
|         "tests/external/puller_util_test.cpp",
 | |
|         "tests/external/StatsCallbackPuller_test.cpp",
 | |
|         "tests/external/StatsPuller_test.cpp",
 | |
|         "tests/external/StatsPullerManager_test.cpp",
 | |
|         "tests/FieldValue_test.cpp",
 | |
|         "tests/flags/FlagProvider_test.cpp",
 | |
|         "tests/guardrail/StatsdStats_test.cpp",
 | |
|         "tests/HashableDimensionKey_test.cpp",
 | |
|         "tests/indexed_priority_queue_test.cpp",
 | |
|         "tests/log_event/LogEventQueue_test.cpp",
 | |
|         "tests/LogEntryMatcher_test.cpp",
 | |
|         "tests/LogEvent_test.cpp",
 | |
|         "tests/metadata_util_test.cpp",
 | |
|         "tests/metrics/CountMetricProducer_test.cpp",
 | |
|         "tests/metrics/DurationMetricProducer_test.cpp",
 | |
|         "tests/metrics/EventMetricProducer_test.cpp",
 | |
|         "tests/metrics/GaugeMetricProducer_test.cpp",
 | |
|         "tests/metrics/KllMetricProducer_test.cpp",
 | |
|         "tests/metrics/MaxDurationTracker_test.cpp",
 | |
|         "tests/metrics/metrics_test_helper.cpp",
 | |
|         "tests/metrics/OringDurationTracker_test.cpp",
 | |
|         "tests/metrics/NumericValueMetricProducer_test.cpp",
 | |
|         "tests/metrics/parsing_utils/config_update_utils_test.cpp",
 | |
|         "tests/metrics/parsing_utils/metrics_manager_util_test.cpp",
 | |
|         "tests/subscriber/SubscriberReporter_test.cpp",
 | |
|         "tests/MetricsManager_test.cpp",
 | |
|         "tests/shell/ShellSubscriber_test.cpp",
 | |
|         "tests/state/StateTracker_test.cpp",
 | |
|         "tests/statsd_test_util.cpp",
 | |
|         "tests/StatsLogProcessor_test.cpp",
 | |
|         "tests/StatsService_test.cpp",
 | |
|         "tests/storage/StorageManager_test.cpp",
 | |
|         "tests/UidMap_test.cpp",
 | |
|         "tests/utils/MultiConditionTrigger_test.cpp",
 | |
|     ],
 | |
| 
 | |
|     static_libs: [
 | |
|         "libgmock",
 | |
|         "libplatformprotos",
 | |
|         "libstatslog_statsdtest",
 | |
|         "libstatssocket_private",
 | |
|     ],
 | |
| 
 | |
|     proto: {
 | |
|         type: "lite",
 | |
|         include_dirs: [
 | |
|             "external/protobuf/src",
 | |
|             "frameworks/proto_logging/stats",
 | |
|         ],
 | |
|     },
 | |
| 
 | |
| }
 | |
| 
 | |
| //#############################
 | |
| // statsd micro benchmark
 | |
| //#############################
 | |
| 
 | |
| cc_benchmark {
 | |
|     name: "statsd_benchmark",
 | |
|     defaults: ["statsd_defaults"],
 | |
| 
 | |
|     srcs: [
 | |
|         // atom_field_options.proto needs field_options.proto, but that is
 | |
|         // not included in libprotobuf-cpp-lite, so compile it here.
 | |
|         ":libprotobuf-internal-protos",
 | |
|         ":libstats_internal_protos",
 | |
| 
 | |
|         "benchmark/duration_metric_benchmark.cpp",
 | |
|         "benchmark/filter_value_benchmark.cpp",
 | |
|         "benchmark/get_dimensions_for_condition_benchmark.cpp",
 | |
|         "benchmark/hello_world_benchmark.cpp",
 | |
|         "benchmark/log_event_benchmark.cpp",
 | |
|         "benchmark/main.cpp",
 | |
|         "benchmark/metric_util.cpp",
 | |
|         "benchmark/stats_write_benchmark.cpp",
 | |
|         "src/stats_log.proto",
 | |
|     ],
 | |
| 
 | |
|     proto: {
 | |
|         type: "lite",
 | |
|         include_dirs: [
 | |
|             "external/protobuf/src",
 | |
|             "frameworks/proto_logging/stats",
 | |
|         ],
 | |
|     },
 | |
| 
 | |
|     cflags: [
 | |
|         "-Wall",
 | |
|         "-Werror",
 | |
|         "-Wno-unused-parameter",
 | |
|         "-Wno-unused-variable",
 | |
|         "-Wno-unused-function",
 | |
| 
 | |
|         // Bug: http://b/29823425 Disable -Wvarargs for Clang update to r271374
 | |
|         "-Wno-varargs",
 | |
|     ],
 | |
| 
 | |
|     static_libs: [
 | |
|         "libplatformprotos",
 | |
|         "libstatssocket_private",
 | |
|     ],
 | |
| 
 | |
|     shared_libs: [
 | |
|         "libprotobuf-cpp-lite",
 | |
|         "libstatslog",
 | |
|     ],
 | |
| 
 | |
|     header_libs: [
 | |
|         "libgtest_prod_headers",
 | |
|     ],
 | |
| }
 | |
| 
 | |
| // ====  java proto device library (for test only)  ==============================
 | |
| java_library {
 | |
|     name: "statsdprotolite",
 | |
|     sdk_version: "core_current",
 | |
|     proto: {
 | |
|         type: "lite",
 | |
|         include_dirs: [
 | |
|             "external/protobuf/src",
 | |
|             "frameworks/proto_logging/stats",
 | |
|         ],
 | |
|     },
 | |
| 
 | |
|     srcs: [
 | |
|         ":libstats_atoms_proto",
 | |
|         "src/shell/shell_config.proto",
 | |
|         "src/shell/shell_data.proto",
 | |
|         "src/stats_log.proto",
 | |
|         "src/statsd_config.proto",
 | |
|     ],
 | |
| 
 | |
|     static_libs: [
 | |
|         "platformprotoslite",
 | |
|     ],
 | |
|     // Protos have lots of MissingOverride and similar.
 | |
|     errorprone: {
 | |
|         javacflags: ["-XepDisableAllChecks"],
 | |
|     },
 | |
| }
 | |
| 
 | |
| java_library {
 | |
|     name: "statsdprotonano",
 | |
|     sdk_version: "9",
 | |
|     proto: {
 | |
|         type: "nano",
 | |
|         output_params: ["store_unknown_fields=true"],
 | |
|         include_dirs: [
 | |
|             "external/protobuf/src",
 | |
|             "frameworks/proto_logging/stats",
 | |
|         ],
 | |
|     },
 | |
|     srcs: [
 | |
|         ":libstats_atoms_proto",
 | |
|         "src/shell/shell_config.proto",
 | |
|         "src/shell/shell_data.proto",
 | |
|         "src/stats_log.proto",
 | |
|         "src/statsd_config.proto",
 | |
|     ],
 | |
|     static_libs: [
 | |
|         "platformprotosnano",
 | |
|     ],
 | |
|     // Protos have lots of MissingOverride and similar.
 | |
|     errorprone: {
 | |
|         javacflags: ["-XepDisableAllChecks"],
 | |
|     },
 | |
| }
 | |
| 
 | |
| // Filegroup for statsd config proto definition.
 | |
| filegroup {
 | |
|     name: "statsd-config-proto-def",
 | |
|     srcs: ["src/statsd_config.proto"],
 | |
| }
 | |
| 
 | |
| // Filegroup for all statsd protos
 | |
| filegroup {
 | |
|     name: "statsd_internal_protos",
 | |
|     srcs: [
 | |
|         "src/active_config_list.proto",
 | |
|         "src/experiment_ids.proto",
 | |
|         "src/shell/shell_config.proto",
 | |
|         "src/shell/shell_data.proto",
 | |
|         "src/statsd_config.proto",
 | |
|         "src/statsd_metadata.proto",
 | |
|         "src/stats_log.proto",
 | |
|         "src/uid_data.proto",
 | |
|     ],
 | |
| }
 |