1// Copyright (C) 2019 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_visibility: [ ":__pkg__" ],
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20genrule {
21    name: "statslog-statsd-java-gen",
22    tools: ["stats-log-api-gen"],
23    cmd: "$(location stats-log-api-gen) --java $(out) --module statsd" +
24         " --javaPackage com.android.internal.statsd --javaClass StatsdStatsLog --minApiLevel 30",
25    out: ["com/android/internal/statsd/StatsdStatsLog.java"],
26}
27
28java_library_static {
29    name: "statslog-statsd",
30    srcs: [
31        ":statslog-statsd-java-gen",
32    ],
33    visibility: [
34        "//cts/hostsidetests/statsd/apps:__subpackages__",
35        "//vendor:__subpackages__",
36    ],
37}
38
39filegroup {
40    name: "framework-statsd-sources",
41    srcs: [
42        "java/**/*.java",
43        ":framework-statsd-aidl-sources",
44        ":statslog-statsd-java-gen",
45    ],
46    visibility: [
47        "//frameworks/base", // For the "global" stubs.
48        "//frameworks/base/apex/statsd:__subpackages__",
49        "//packages/modules/StatsD/framework:__subpackages__",
50    ],
51}
52java_sdk_library {
53    name: "framework-statsd",
54    defaults: ["framework-module-defaults"],
55    installable: true,
56
57    srcs: [
58        ":framework-statsd-sources",
59    ],
60
61    permitted_packages: [
62        "android.app",
63        "android.os",
64        "android.util",
65        // From :statslog-statsd-java-gen
66        "com.android.internal.statsd",
67    ],
68
69    api_packages: [
70        "android.app",
71        "android.os",
72        "android.util",
73    ],
74
75    hostdex: true, // for hiddenapi check
76
77    impl_library_visibility: [
78        "//frameworks/base/apex/statsd/framework/test:__subpackages__",
79        "//packages/modules/StatsD/framework/test:__subpackages__",
80        "//packages/modules/StatsD/service:__subpackages__",
81    ],
82
83    apex_available: [
84        "com.android.os.statsd",
85        "test_com.android.os.statsd",
86    ],
87    min_sdk_version: "30",
88}
89
90// JNI library for StatsLog.write
91cc_library_shared {
92    name: "libstats_jni",
93    srcs: ["jni/**/*.cpp"],
94    header_libs: ["libnativehelper_header_only"],
95    shared_libs: [
96        "liblog",  // Has a stable abi - should not be copied into apex.
97        "libstatssocket",
98    ],
99    stl: "libc++_static",
100    cflags: [
101        "-Wall",
102        "-Werror",
103        "-Wextra",
104        "-Wno-unused-parameter",
105    ],
106    apex_available: [
107        "com.android.os.statsd",
108        "test_com.android.os.statsd",
109    ],
110    min_sdk_version: "30",
111    visibility: [
112        "//packages/modules/StatsD/apex:__subpackages__",
113    ],
114}
115