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",
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    libs: [
34        "androidx.annotation_annotation",
35    ],
36    visibility: [
37        "//cts/hostsidetests/statsd/apps:__subpackages__",
38        "//vendor:__subpackages__",
39    ],
40}
41
42filegroup {
43    name: "framework-statsd-sources",
44    defaults: ["framework-sources-module-defaults"],
45    srcs: [
46        "java/**/*.java",
47        ":framework-statsd-aidl-sources",
48        ":statslog-statsd-java-gen",
49    ],
50    visibility: ["//packages/modules/StatsD/framework:__subpackages__"],
51}
52
53java_sdk_library {
54    name: "framework-statsd",
55    defaults: ["framework-module-defaults"],
56    installable: true,
57
58    jarjar_rules: "jarjar-rules.txt",
59
60    srcs: [
61        ":framework-statsd-sources",
62    ],
63
64    libs: [
65        "androidx.annotation_annotation",
66        "framework-configinfrastructure.stubs.module_lib",
67    ],
68
69    static_libs: [
70         "modules-utils-build",
71    ],
72
73    permitted_packages: [
74        "android.app",
75        "android.os",
76        "android.util",
77        // From :statslog-statsd-java-gen
78        "com.android.internal.statsd",
79    ],
80
81    api_packages: [
82        "android.app",
83        "android.os",
84        "android.util",
85    ],
86
87    hostdex: true, // for hiddenapi check
88
89    lint: {
90        strict_updatability_linting: true
91    },
92
93    impl_library_visibility: [
94        "//packages/modules/StatsD/framework/test:__subpackages__",
95        "//packages/modules/StatsD/tests/utils:__pkg__",
96        "//packages/modules/StatsD/service:__subpackages__",
97        "//frameworks/base/ravenwood",
98    ],
99
100    apex_available: [
101        "com.android.os.statsd",
102        "test_com.android.os.statsd",
103    ],
104    min_sdk_version: "30",
105}
106
107filegroup {
108    name: "framework-statsd-ravenwood-policies",
109    srcs: [
110        "framework-statsd-ravenwood-policies.txt",
111    ],
112    visibility: ["//frameworks/base/ravenwood"],
113}
114
115// JNI library for StatsLog.write
116cc_library_shared {
117    name: "libstats_jni",
118    srcs: ["jni/**/*.cpp"],
119    header_libs: ["libnativehelper_header_only"],
120    shared_libs: [
121        "liblog",  // Has a stable abi - should not be copied into apex.
122        "libstatssocket#impl",
123    ],
124    stl: "libc++_static",
125    cflags: [
126        "-Wall",
127        "-Werror",
128        "-Wextra",
129        "-Wno-unused-parameter",
130        "-Wthread-safety",
131    ],
132    apex_available: [
133        "com.android.os.statsd",
134        "test_com.android.os.statsd",
135    ],
136    min_sdk_version: "30",
137    visibility: [
138        "//packages/modules/StatsD/apex:__subpackages__",
139    ],
140}
141