1//
2// Copyright (C) 2019 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_team: "trendy_team_android_permissions",
19    default_applicable_licenses: [
20        "packages_modules_Permission_PermissionController_license",
21    ],
22}
23
24// Added automatically by a large-scale-change
25// See: http://go/android-license-faq
26license {
27    name: "packages_modules_Permission_PermissionController_license",
28    visibility: [":__subpackages__"],
29    license_kinds: [
30        "SPDX-license-identifier-Apache-2.0",
31    ],
32    license_text: [
33        "NOTICE",
34    ],
35}
36
37genrule {
38    name: "statslog-permissioncontroller-java-gen",
39    tools: ["stats-log-api-gen"],
40    cmd: "$(location stats-log-api-gen) --java $(out) --module permissioncontroller" +
41        " --javaPackage com.android.permissioncontroller" +
42        " --javaClass PermissionControllerStatsLog --minApiLevel 30",
43    out: ["com/android/permissioncontroller/PermissionControllerStatsLog.java"],
44}
45
46java_library {
47    name: "permissioncontroller-statsd",
48    sdk_version: "system_current",
49    min_sdk_version: "30",
50    apex_available: [
51        "com.android.permission",
52    ],
53    srcs: [
54        ":statslog-permissioncontroller-java-gen",
55    ],
56}
57
58java_library {
59    name: "permissioncontroller-protos",
60    sdk_version: "system_current",
61    min_sdk_version: "30",
62    srcs: [
63        "src/**/*.proto",
64    ],
65    proto: {
66        type: "lite",
67        include_dirs: ["packages/modules/Permission/PermissionController/src/com/android/permissioncontroller"],
68    },
69    apex_available: [
70        "//apex_available:platform",
71        "com.android.permission",
72    ],
73}
74
75android_library {
76    name: "PermissionController-lib",
77    sdk_version: "system_current",
78    min_sdk_version: "30",
79    use_resource_processor: true,
80    manifest: "AndroidManifest-lib.xml",
81    srcs: [
82        "src/**/*.java",
83        "src/**/*.kt",
84    ],
85
86    //javacflags: ["-Werror"],
87    kotlincflags: [
88        "-Werror",
89        "-opt-in=kotlinx.coroutines.DelicateCoroutinesApi",
90        "-Xjvm-default=all",
91    ],
92
93    libs: [
94        "android.car-stubs",
95        "safety-center-annotations",
96    ],
97
98    static_libs: [
99        "permissioncontroller-protos",
100        "iconloader_sc_mainline_prod",
101        "com.google.android.material_material",
102        "androidx.transition_transition",
103        "androidx-constraintlayout_constraintlayout",
104        "androidx.core_core",
105        "androidx.media_media",
106        "androidx.legacy_legacy-support-core-utils",
107        "androidx.legacy_legacy-support-core-ui",
108        "androidx.fragment_fragment",
109        "androidx.appcompat_appcompat",
110        "androidx.preference_preference",
111        "androidx.recyclerview_recyclerview",
112        "androidx.legacy_legacy-preference-v14",
113        "androidx.leanback_leanback",
114        "androidx.leanback_leanback-preference",
115        "androidx.lifecycle_lifecycle-extensions",
116        "androidx.lifecycle_lifecycle-common-java8",
117        "kotlin-stdlib",
118        "kotlinx-coroutines-android",
119        "androidx.navigation_navigation-common-ktx",
120        "androidx.navigation_navigation-fragment-ktx",
121        "androidx.navigation_navigation-runtime-ktx",
122        "androidx.navigation_navigation-ui-ktx",
123        "SettingsLibHelpUtils",
124        "SettingsLibRestrictedLockUtils",
125        "SettingsLibAppPreference",
126        "SettingsLibSearchWidget",
127        "SettingsLibLayoutPreference",
128        "SettingsLibBarChartPreference",
129        "SettingsLibActionBarShadow",
130        "SettingsLibProgressBar",
131        "SettingsLibCollapsingToolbarBaseActivity",
132        "SettingsLibActivityEmbedding",
133        "SettingsLibSettingsTheme",
134        "SettingsLibFooterPreference",
135        "SettingsLibSelectorWithWidgetPreference",
136        "SettingsLibTwoTargetPreference",
137        "SettingsLibIllustrationPreference",
138        "androidx.annotation_annotation",
139        "permissioncontroller-statsd",
140        "car-ui-lib",
141        "libprotobuf-java-lite",
142        "safety-center-internal-data",
143        "safety-center-pending-intents",
144        "SettingsLibUtils",
145        "modules-utils-build_system",
146        "safety-center-resources-lib",
147        "lottie",
148        "safety-label",
149        "role-controller",
150        "android.permission.flags-aconfig-java-export",
151        "com.android.permission.flags-aconfig-java-export",
152        "androidx.compose.foundation_foundation",
153        "androidx.compose.runtime_runtime",
154        "androidx.compose.runtime_runtime-livedata",
155        "androidx.compose.ui_ui",
156        "androidx.wear.compose_compose-material",
157        "android.content.pm.flags-aconfig-java-export",
158        "android.os.flags-aconfig-java-export",
159    ],
160
161    lint: {
162        error_checks: ["Recycle"],
163        baseline_filename: "lint-baseline.xml",
164    },
165
166    apex_available: [
167        "//apex_available:platform",
168        "com.android.permission",
169    ],
170
171    // TODO(b/313706381): Remove jarjar once flagging lib is fixed
172    jarjar_rules: "jarjar-rules.txt",
173}
174
175android_app {
176    name: "PermissionController",
177    // Compiling against "module_current" would allow using non-APIs within the permission APEX
178    // boundaries, which may be unsafe because PermissionController is also shipped as a standalone
179    // artifact. See also b/209458854.
180    sdk_version: "system_current",
181    min_sdk_version: "30",
182    updatable: true,
183    privileged: true,
184    certificate: "platform",
185    use_resource_processor: true,
186    rename_resources_package: false,
187    privapp_allowlist: ":privapp_allowlist_com.android.permissioncontroller.xml",
188
189    static_libs: ["PermissionController-lib"],
190
191    lint: {
192        error_checks: ["Recycle"],
193    },
194
195    optimize: {
196        proguard_compatibility: false, // TODO(b/215530220): remove when this is default behavior
197        proguard_flags_files: ["proguard.flags"],
198    },
199
200    apex_available: [
201        "//apex_available:platform",
202        "com.android.permission",
203    ],
204}
205