blob: 23dd9b7aee37aae5379544148000e2c59da6ff8c [file] [log] [blame]
Dan Albert7ce8df32016-09-23 16:43:49 -07001// Copyright (C) 2016 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
Bob Badoure539dba2021-02-12 17:07:05 -080015package {
16 // See: http://go/android-license-faq
17 // A large-scale-change added 'default_applicable_licenses' to import
18 // all of the 'license_kinds' from "frameworks_base_license"
19 // to get the below license kinds:
20 // SPDX-license-identifier-Apache-2.0
21 default_applicable_licenses: ["frameworks_base_license"],
22}
23
Colin Cross02a86572017-10-07 18:38:31 -070024cc_library_shared {
25 name: "libjnigraphics",
Elliott Hughes395607d2024-06-18 18:23:59 +000026 defaults: [
27 "bug_24465209_workaround",
28 ],
Colin Cross02a86572017-10-07 18:38:31 -070029
30 cflags: [
31 "-Wall",
32 "-Werror",
33 "-Wunused",
34 "-Wunreachable-code",
35 ],
36
Leon Scroggins III9732e292019-12-16 10:26:57 -050037 srcs: [
Leon Scroggins III407b5442019-11-22 17:10:20 -050038 "imagedecoder.cpp",
Leon Scroggins III9732e292019-12-16 10:26:57 -050039 ],
Colin Cross02a86572017-10-07 18:38:31 -070040
41 shared_libs: [
Leon Scroggins III407b5442019-11-22 17:10:20 -050042 "libhwui",
Leon Scroggins III9732e292019-12-16 10:26:57 -050043 "liblog",
Colin Cross02a86572017-10-07 18:38:31 -070044 ],
Ian Pedowitz0c3c4d12018-01-18 16:24:11 -080045
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050046 header_libs: [
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050047 "jni_headers",
Orion Hodson9b4db532021-02-02 11:19:04 +000048 "libhwui_internal_headers",
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050049 ],
Derek Sollenbergeree538a32020-02-19 11:51:17 -050050
Alec Mouri0ba21a72024-10-10 22:45:08 +000051 static_libs: [
52 "libarect",
53 ],
Leon Scroggins III407b5442019-11-22 17:10:20 -050054
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050055 host_supported: true,
56 target: {
57 android: {
58 srcs: [
59 "aassetstreamadaptor.cpp",
60 "bitmap.cpp",
61 ],
62 shared_libs: [
63 "libandroid",
64 ],
Alec Mouri0ba21a72024-10-10 22:45:08 +000065 static_libs: [
66 "libstatslog_hwui",
67 "libstatspull_lazy",
68 "libstatssocket_lazy",
69 ],
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050070 version_script: "libjnigraphics.map.txt",
71 },
72 host: {
73 header_libs: [
74 "libnativewindow_headers",
75 ],
76 },
77 },
Jooyung Han7a82df92024-01-25 07:45:05 +090078 stubs: {
79 symbol_file: "libjnigraphics.map.txt",
80 },
Colin Cross02a86572017-10-07 18:38:31 -070081}
82
Dan Albert7ce8df32016-09-23 16:43:49 -070083// The headers module is in frameworks/native/Android.bp.
84ndk_library {
Dan Willemsen3dcf0312017-04-07 15:48:45 -070085 name: "libjnigraphics",
Dan Albert7ce8df32016-09-23 16:43:49 -070086 symbol_file: "libjnigraphics.map.txt",
87 first_version: "9",
Dan Albert98e462d2017-01-05 16:01:14 -080088 unversioned_until: "current",
Dan Albert7ce8df32016-09-23 16:43:49 -070089}
Leon Scroggins III140f5082020-02-26 17:15:12 -050090
Leon Scroggins III8f774242021-01-15 11:33:23 -050091cc_defaults {
92 name: "imagedecoder_fuzzer_defaults",
93 srcs: ["fuzz/fuzz_imagedecoder.cpp"],
Leon Scroggins III140f5082020-02-26 17:15:12 -050094 header_libs: ["jni_headers"],
95 shared_libs: [
96 "libbinder",
97 "libjnigraphics",
98 "libutils",
99 ],
100 static_libs: ["libarect"],
101 fuzz_config: {
Jooyung Hanf9394142024-01-25 08:00:28 +0900102 cc: [
103 "dichenzhang@google.com",
104 "scroggo@google.com",
105 ],
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -0500106 asan_options: [
107 "detect_odr_violation=1",
108 ],
Leon Scroggins IIIba9a6902021-01-11 11:35:10 -0500109 hwasan_options: [
Jooyung Hanf9394142024-01-25 08:00:28 +0900110 // Image decoders may attempt to allocate a large amount of memory
111 // (especially if the encoded image is large). This doesn't
112 // necessarily mean there is a bug. Set allocator_may_return_null=1
113 // for hwasan so the fuzzer can continue running.
Leon Scroggins IIIba9a6902021-01-11 11:35:10 -0500114 "allocator_may_return_null = 1",
115 ],
Leon Scroggins III140f5082020-02-26 17:15:12 -0500116 },
Onkar Shinde85c84962024-04-25 15:58:31 +0530117 dictionary: "fuzz/imagedecoder_fuzzer.dict",
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -0500118 host_supported: true,
Leon Scroggins III140f5082020-02-26 17:15:12 -0500119}
Leon Scroggins III8f774242021-01-15 11:33:23 -0500120
121cc_fuzz {
122 name: "imagedecoder_fuzzer",
123 defaults: ["imagedecoder_fuzzer_defaults"],
124 corpus: ["fuzz/corpus/*"],
125}
126
127cc_fuzz {
128 name: "imagedecoder_png_fuzzer",
129 defaults: ["imagedecoder_fuzzer_defaults"],
130 shared_libs: [
131 "libz",
132 ],
133 cflags: [
134 "-DPNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR",
135 ],
136}
Onkar Shinde27e27972024-04-25 15:58:44 +0530137
138cc_fuzz {
139 name: "imagedecoder_heif_fuzzer",
140 defaults: ["imagedecoder_fuzzer_defaults"],
141 team: "trendy_team_android_core_graphics_stack",
142 shared_libs: [
143 "libfakeservicemanager",
144 ],
145 target: {
146 android: {
147 shared_libs: [
148 "libmediaplayerservice",
149 "libmediaextractorservice",
150 ],
151 },
152 host: {
153 static_libs: [
154 "libbinder_random_parcel",
155 "libcutils",
156 ],
157 },
158 },
159 include_dirs: ["frameworks/av/services/mediaextractor"],
160 cflags: [
161 "-DFUZZ_HEIF_FORMAT",
162 ],
163}