1// Copyright (C) 2020 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_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19filegroup {
20    name: "service-permission-sources",
21    srcs: [
22        "java/**/*.java",
23    ],
24    path: "java",
25    visibility: ["//visibility:private"],
26}
27
28filegroup {
29    name: "service-permission-protos",
30    srcs: [
31        "proto/**/*.proto",
32    ],
33    visibility: ["//frameworks/base"],
34}
35
36gensrcs {
37    name: "service-permission-javastream-protos",
38    depfile: true,
39
40    tools: [
41        "aprotoc",
42        "protoc-gen-javastream",
43        "soong_zip",
44    ],
45
46    cmd: "mkdir -p $(genDir)/$(in) " +
47        "&& $(location aprotoc) " +
48        "  --plugin=$(location protoc-gen-javastream) " +
49        "  --dependency_out=$(depfile) " +
50        "  --javastream_out=$(genDir)/$(in) " +
51        "  -Iexternal/protobuf/src " +
52        "  -I . " +
53        "  $(in) " +
54        "&& $(location soong_zip) -jar -o $(out) -C $(genDir)/$(in) -D $(genDir)/$(in)",
55
56    srcs: [
57        ":service-permission-protos",
58    ],
59    output_extension: "srcjar",
60}
61
62java_library {
63    name: "service-permission-shared",
64    srcs: [":service-permission-shared-srcs"],
65    libs: [
66        "framework-annotations-lib",
67        "framework-permission-s-shared",
68    ],
69    apex_available: [
70        "com.android.permission",
71        "test_com.android.permission",
72    ],
73    installable: false,
74    min_sdk_version: "30",
75    sdk_version: "system_server_current",
76}
77
78java_sdk_library {
79    name: "service-permission",
80    defaults: ["framework-system-server-module-defaults"],
81    impl_library_visibility: [
82        "//frameworks/base/apex/permission/tests",
83        "//frameworks/base/services/tests/mockingservicestests",
84        "//frameworks/base/services/tests/servicestests",
85        "//packages/modules/Permission/tests",
86    ],
87    srcs: [
88        ":service-permission-sources",
89        ":service-permission-javastream-protos",
90    ],
91    libs: [
92        // TODO(b/177884622): Short term solution to prevent service-permission from seeing hidden
93        //  APIs in framework-permission, as we don't actually have any dependency in it.
94        //"framework-permission",
95        "framework-permission-s.impl",
96        "androidx.annotation_annotation",
97        "framework-permission-s-shared",
98        "modules-annotation-minsdk",
99    ],
100    static_libs: [
101        "modules-utils-os",
102        "service-permission-shared",
103    ],
104    jarjar_rules: ":permission-jarjar-rules",
105    lint: {
106        strict_updatability_linting: true,
107    },
108    min_sdk_version: "30",
109    sdk_version: "system_server_current",
110    apex_available: [
111        "com.android.permission",
112        "test_com.android.permission",
113    ],
114    installable: true,
115}
116