1// Copyright (C) 2024 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    // See: http://go/android-license-faq
17    default_applicable_licenses: ["Android-Apache-2.0"],
18}
19
20java_sdk_library {
21    name: "framework-pdf",
22    defaults: ["framework-module-defaults"],
23    srcs: [
24        ":framework-pdf-sources",
25    ],
26
27    permitted_packages: [
28        "android.graphics.pdf",
29    ],
30    static_libs: [
31        "pdf_viewer_flags_java_lib",
32        "pdf-statsd",
33    ],
34    libs: [
35        "androidx.annotation_annotation",
36        "error_prone_annotations",
37        "modules-utils-preconditions",
38        "unsupportedappusage",
39    ],
40    apex_available: [
41        "com.android.mediaprovider",
42    ],
43    aconfig_declarations: [
44        "pdf_viewer_flags",
45    ],
46    impl_library_visibility: [
47        "//packages/providers/MediaProvider:__subpackages__",
48        "//cts/tests/pdf:__subpackages__",
49    ],
50    jarjar_rules: "jarjar-rules.txt",
51    min_sdk_version: "31",
52}
53
54filegroup {
55    name: "framework-pdf-sources",
56    defaults: ["framework-sources-module-defaults"],
57    srcs: [
58        "java/**/*.java",
59    ],
60    path: "java",
61    visibility: [
62        "//packages/providers/MediaProvider/pdf/tests",
63    ],
64}
65
66aconfig_declarations {
67    name: "pdf_viewer_flags",
68    package: "android.graphics.pdf.flags",
69    srcs: [
70        "pdf_viewer_flags.aconfig",
71    ],
72    container: "com.android.mediaprovider",
73}
74
75java_aconfig_library {
76    name: "pdf_viewer_flags_java_lib",
77    aconfig_declarations: "pdf_viewer_flags",
78    visibility: [
79        "//packages/providers/MediaProvider/pdf:__subpackages__",
80    ],
81    min_sdk_version: "31",
82    apex_available: [
83        "com.android.mediaprovider",
84    ],
85    defaults: ["framework-minus-apex-aconfig-java-defaults"],
86
87}
88
89// To generate the Stats log classes for the Android Pdf.
90genrule {
91    name: "statslog-pdf-java-gen",
92    tools: ["stats-log-api-gen"],
93    cmd: "$(location stats-log-api-gen) --java $(out) --module mediaprovider" +
94        " --javaPackage android.graphics.pdf --javaClass PdfStatsLog" +
95        " --minApiLevel 31",
96    out: ["android/graphics/pdf/PdfStatsLog.java"],
97}
98
99// To disable NewApi checks on the generated PdfStatsLog.
100java_library {
101    name: "pdf-statsd",
102    sdk_version: "module_current",
103    min_sdk_version: "31",
104    srcs: [
105        ":statslog-pdf-java-gen",
106    ],
107    libs: [
108        // To add StatsLog as a dependency of the generated file.
109        "framework-statsd.stubs.module_lib",
110    ],
111    apex_available: [
112        "com.android.mediaprovider",
113    ],
114}
115