1package {
2    default_applicable_licenses: ["Android-Apache-2.0"],
3}
4
5cc_defaults {
6    name: "vold_default_flags",
7
8    cflags: [
9        "-Wall",
10        "-Werror",
11        "-Wextra",
12        "-Wno-unused-parameter",
13    ],
14
15    tidy: true,
16    tidy_checks: [
17        "-*",
18        "cert-*",
19        "clang-analyzer-security*",
20        "android-*",
21    ],
22    tidy_checks_as_errors: [
23        "clang-analyzer-security*",
24        "cert-*",
25    ],
26}
27
28cc_defaults {
29    name: "vold_default_libs",
30
31    static_libs: [
32        "android.hardware.health.storage@1.0",
33        "android.hardware.health.storage-V1-ndk",
34        "android.security.maintenance-ndk",
35        "libasync_safe",
36        "libavb",
37        "libbootloader_message",
38        "libdm",
39        "libext2_uuid",
40        "libfec",
41        "libfec_rs",
42        "libfs_avb",
43        "libfs_mgr",
44        "libsquashfs_utils",
45        "libvold_binder",
46    ],
47    shared_libs: [
48        "android.hardware.boot@1.0",
49        "android.hardware.boot-V1-ndk",
50        "libboot_control_client",
51        "libbase",
52        "libbinder",
53        "libbinder_ndk",
54        "libcrypto",
55        "libcrypto_utils",
56        "libcutils",
57        "libext4_utils",
58        "libf2fs_sparseblock",
59        "libgsi",
60        "libhardware",
61        "libhardware_legacy",
62        "libincfs",
63        "libhidlbase",
64        "libkeymint_support",
65        "liblog",
66        "liblogwrap",
67        "libselinux",
68        "libsysutils",
69        "libutils",
70    ],
71}
72
73cc_library_static {
74    name: "libvold_binder",
75    defaults: ["vold_default_flags"],
76
77    srcs: [
78        ":vold_aidl",
79    ],
80    shared_libs: [
81        "libbinder",
82        "libutils",
83    ],
84    aidl: {
85        local_include_dirs: ["binder"],
86        include_dirs: [
87            "frameworks/native/aidl/binder",
88            "frameworks/base/core/java",
89        ],
90        export_aidl_headers: true,
91    },
92    whole_static_libs: [
93        "libincremental_aidl-cpp",
94    ],
95    export_shared_lib_headers: [
96        "libbinder",
97    ],
98}
99
100cc_library_headers {
101    name: "libvold_headers",
102    recovery_available: true,
103    export_include_dirs: ["."],
104}
105
106// Static library factored out to support testing
107cc_library_static {
108    name: "libvold",
109    defaults: [
110        "vold_default_flags",
111        "vold_default_libs",
112        "keystore2_use_latest_aidl_ndk_shared",
113    ],
114
115    srcs: [
116        "AppFuseUtil.cpp",
117        "Benchmark.cpp",
118        "Checkpoint.cpp",
119        "CryptoType.cpp",
120        "EncryptInplace.cpp",
121        "FileDeviceUtils.cpp",
122        "FsCrypt.cpp",
123        "IdleMaint.cpp",
124        "KeyBuffer.cpp",
125        "KeyStorage.cpp",
126        "KeyUtil.cpp",
127        "Keystore.cpp",
128        "Loop.cpp",
129        "MetadataCrypt.cpp",
130        "MoveStorage.cpp",
131        "NetlinkHandler.cpp",
132        "NetlinkManager.cpp",
133        "Process.cpp",
134        "Utils.cpp",
135        "VoldNativeService.cpp",
136        "VoldNativeServiceValidation.cpp",
137        "VoldUtil.cpp",
138        "VolumeManager.cpp",
139        "cryptfs.cpp",
140        "fs/Exfat.cpp",
141        "fs/Ext4.cpp",
142        "fs/F2fs.cpp",
143        "fs/Vfat.cpp",
144        "model/Disk.cpp",
145        "model/EmulatedVolume.cpp",
146        "model/ObbVolume.cpp",
147        "model/PrivateVolume.cpp",
148        "model/PublicVolume.cpp",
149        "model/StubVolume.cpp",
150        "model/VolumeBase.cpp",
151        "model/VolumeEncryption.cpp",
152    ],
153    product_variables: {
154        arc: {
155            exclude_srcs: [
156                "model/StubVolume.cpp",
157            ],
158            static_libs: [
159                "libarcvolume",
160            ],
161        },
162        debuggable: {
163            cppflags: ["-D__ANDROID_DEBUGGABLE__"],
164        },
165    },
166}
167
168cc_binary {
169    name: "vold",
170    defaults: [
171        "vold_default_flags",
172        "vold_default_libs",
173        "keystore2_use_latest_aidl_ndk_shared",
174    ],
175
176    srcs: ["main.cpp"],
177    static_libs: [
178        "libvold",
179    ],
180
181    init_rc: [
182        "vold.rc",
183    ],
184
185    required: [
186        "mke2fs",
187        "vold_prepare_subdirs",
188        "fuseMedia.o",
189    ],
190
191    product_variables: {
192        arc: {
193            exclude_srcs: [
194                "model/StubVolume.cpp",
195            ],
196            static_libs: [
197                "libarcvolume",
198            ],
199        },
200    },
201}
202
203cc_binary {
204    name: "vdc",
205    defaults: ["vold_default_flags"],
206
207    srcs: [
208        "vdc.cpp",
209        "Utils.cpp",
210    ],
211    shared_libs: [
212        "libbase",
213        "libbinder",
214        "libcutils",
215        "liblogwrap",
216        "libselinux",
217        "libutils",
218    ],
219    static_libs: [
220        "libvold_binder",
221    ],
222}
223
224cc_binary {
225    name: "secdiscard",
226    defaults: ["vold_default_flags"],
227
228    srcs: [
229        "FileDeviceUtils.cpp",
230        "secdiscard.cpp",
231    ],
232    shared_libs: ["libbase"],
233}
234
235cc_binary {
236    name: "vold_prepare_subdirs",
237    defaults: ["vold_default_flags"],
238
239    srcs: [
240        "vold_prepare_subdirs.cpp",
241        "Utils.cpp",
242    ],
243    shared_libs: [
244        "libbase",
245        "libcutils",
246        "liblogwrap",
247        "libselinux",
248        "libutils",
249    ],
250    static_libs: [
251        "libvold_binder",
252    ],
253}
254
255filegroup {
256    name: "vold_aidl",
257    srcs: [
258        "binder/android/os/IVold.aidl",
259        "binder/android/os/IVoldListener.aidl",
260        "binder/android/os/IVoldMountCallback.aidl",
261        "binder/android/os/IVoldTaskListener.aidl",
262    ],
263    path: "binder",
264}
265