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}
18
19genrule {
20    name: "statslog-statsd-java-gen",
21    tools: ["stats-log-api-gen"],
22    cmd: "$(location stats-log-api-gen) --java $(out) --module statsd" +
23         " --javaPackage com.android.internal.statsd --javaClass StatsdStatsLog",
24    out: ["com/android/internal/statsd/StatsdStatsLog.java"],
25}
26
27java_library_static {
28    name: "statslog-statsd",
29    srcs: [
30        ":statslog-statsd-java-gen",
31    ],
32    visibility: [
33        "//cts/hostsidetests/statsd/apps:__subpackages__",
34    ]
35}
36
37filegroup {
38    name: "framework-statsd-sources",
39    srcs: [
40        "java/**/*.java",
41        ":framework-statsd-aidl-sources",
42        ":statslog-statsd-java-gen",
43    ],
44    visibility: [
45        "//frameworks/base", // For the "global" stubs.
46        "//frameworks/base/apex/statsd:__subpackages__",
47    ],
48}
49java_sdk_library {
50    name: "framework-statsd",
51    defaults: ["framework-module-defaults"],
52    installable: true,
53
54    srcs: [
55        ":framework-statsd-sources",
56    ],
57
58    permitted_packages: [
59        "android.app",
60        "android.os",
61        "android.util",
62        // From :statslog-statsd-java-gen
63        "com.android.internal.statsd",
64    ],
65
66    api_packages: [
67        "android.app",
68        "android.os",
69        "android.util",
70    ],
71
72    hostdex: true, // for hiddenapi check
73
74    visibility: [
75        "//frameworks/base", // Framework
76        "//frameworks/base/apex/statsd:__subpackages__", // statsd apex
77        "//frameworks/base/packages/Tethering", // Tethering
78        "//frameworks/opt/net/wifi/service", // wifi service
79        "//packages/providers/MediaProvider", // MediaProvider apk
80    ],
81
82    // Restrict access to implementation library.
83    impl_library_visibility: [
84        "//visibility:override", // Ignore the visibility property.
85        "//frameworks/base/apex/statsd:__subpackages__", // statsd apex
86    ],
87
88    apex_available: [
89        "com.android.os.statsd",
90        "test_com.android.os.statsd",
91    ],
92}
93