blob: 866206c03eeb8060741408c76cae7e5456d126a8 [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",
26
27 cflags: [
28 "-Wall",
29 "-Werror",
30 "-Wunused",
31 "-Wunreachable-code",
32 ],
33
Leon Scroggins III9732e292019-12-16 10:26:57 -050034 srcs: [
Leon Scroggins III407b5442019-11-22 17:10:20 -050035 "imagedecoder.cpp",
Leon Scroggins III9732e292019-12-16 10:26:57 -050036 ],
Colin Cross02a86572017-10-07 18:38:31 -070037
38 shared_libs: [
Leon Scroggins III407b5442019-11-22 17:10:20 -050039 "libhwui",
Leon Scroggins III9732e292019-12-16 10:26:57 -050040 "liblog",
Colin Cross02a86572017-10-07 18:38:31 -070041 ],
Ian Pedowitz0c3c4d12018-01-18 16:24:11 -080042
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050043 header_libs: [
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050044 "jni_headers",
Orion Hodson9b4db532021-02-02 11:19:04 +000045 "libhwui_internal_headers",
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050046 ],
Derek Sollenbergeree538a32020-02-19 11:51:17 -050047
Leon Scroggins III407b5442019-11-22 17:10:20 -050048 static_libs: ["libarect"],
49
Ian Pedowitz0c3c4d12018-01-18 16:24:11 -080050 arch: {
51 arm: {
52 // TODO: This is to work around b/24465209. Remove after root cause is fixed
Chih-Hung Hsieheeb1ea82018-05-22 21:37:08 -070053 pack_relocations: false,
Ian Pedowitz0c3c4d12018-01-18 16:24:11 -080054 ldflags: ["-Wl,--hash-style=both"],
55 },
56 },
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -050057 host_supported: true,
58 target: {
59 android: {
60 srcs: [
61 "aassetstreamadaptor.cpp",
62 "bitmap.cpp",
63 ],
64 shared_libs: [
65 "libandroid",
66 ],
67 version_script: "libjnigraphics.map.txt",
68 },
69 host: {
70 header_libs: [
71 "libnativewindow_headers",
72 ],
73 },
74 },
Jooyung Han7a82df92024-01-25 07:45:05 +090075 stubs: {
76 symbol_file: "libjnigraphics.map.txt",
77 },
Colin Cross02a86572017-10-07 18:38:31 -070078}
79
Dan Albert7ce8df32016-09-23 16:43:49 -070080// The headers module is in frameworks/native/Android.bp.
81ndk_library {
Dan Willemsen3dcf0312017-04-07 15:48:45 -070082 name: "libjnigraphics",
Dan Albert7ce8df32016-09-23 16:43:49 -070083 symbol_file: "libjnigraphics.map.txt",
84 first_version: "9",
Dan Albert98e462d2017-01-05 16:01:14 -080085 unversioned_until: "current",
Dan Albert7ce8df32016-09-23 16:43:49 -070086}
Leon Scroggins III140f5082020-02-26 17:15:12 -050087
Leon Scroggins III8f774242021-01-15 11:33:23 -050088cc_defaults {
89 name: "imagedecoder_fuzzer_defaults",
90 srcs: ["fuzz/fuzz_imagedecoder.cpp"],
Leon Scroggins III140f5082020-02-26 17:15:12 -050091 header_libs: ["jni_headers"],
92 shared_libs: [
93 "libbinder",
94 "libjnigraphics",
95 "libutils",
96 ],
97 static_libs: ["libarect"],
98 fuzz_config: {
Leon Scroggins IIIf38eee42022-11-04 12:18:34 -040099 cc: ["dichenzhang@google.com","scroggo@google.com"],
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -0500100 asan_options: [
101 "detect_odr_violation=1",
102 ],
Leon Scroggins IIIba9a6902021-01-11 11:35:10 -0500103 hwasan_options: [
104 // Image decoders may attempt to allocate a large amount of memory
105 // (especially if the encoded image is large). This doesn't
106 // necessarily mean there is a bug. Set allocator_may_return_null=1
107 // for hwasan so the fuzzer can continue running.
108 "allocator_may_return_null = 1",
109 ],
Leon Scroggins III140f5082020-02-26 17:15:12 -0500110 },
Leon Scroggins IIIc72d0fb2020-12-30 16:38:23 -0500111 host_supported: true,
Leon Scroggins III140f5082020-02-26 17:15:12 -0500112}
Leon Scroggins III8f774242021-01-15 11:33:23 -0500113
114cc_fuzz {
115 name: "imagedecoder_fuzzer",
116 defaults: ["imagedecoder_fuzzer_defaults"],
117 corpus: ["fuzz/corpus/*"],
118}
119
120cc_fuzz {
121 name: "imagedecoder_png_fuzzer",
122 defaults: ["imagedecoder_fuzzer_defaults"],
123 shared_libs: [
124 "libz",
125 ],
126 cflags: [
127 "-DPNG_MUTATOR_DEFINE_LIBFUZZER_CUSTOM_MUTATOR",
128 ],
129}