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-missing-field-initializers",
13        "-Wno-unused-parameter",
14        "-Wno-unused-variable",
15    ],
16
17    clang: true,
18
19    tidy: true,
20    tidy_checks: [
21        "-*",
22        "cert-*",
23        "clang-analyzer-security*",
24        "android-*",
25    ],
26    tidy_flags: [
27        "-warnings-as-errors=clang-analyzer-security*,cert-*",
28    ],
29}
30
31cc_defaults {
32    name: "vold_default_libs",
33
34    static_libs: [
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        "libscrypt_static",
45        "libsquashfs_utils",
46        "libvold_binder",
47    ],
48    shared_libs: [
49        "android.hardware.boot@1.0",
50        "libbase",
51        "libbinder",
52        "libcrypto",
53        "libcrypto_utils",
54        "libcutils",
55        "libdiskconfig",
56        "libext4_utils",
57        "libf2fs_sparseblock",
58        "libgsi",
59        "libhardware",
60        "libhardware_legacy",
61        "libincfs",
62        "libhidlbase",
63        "libkeyutils",
64        "liblog",
65        "liblogwrap",
66        "libselinux",
67        "libsysutils",
68        "libutils",
69    ],
70}
71
72cc_library_static {
73    name: "libvold_binder",
74    defaults: ["vold_default_flags"],
75
76    srcs: [
77        ":vold_aidl",
78    ],
79    shared_libs: [
80        "libbinder",
81        "libutils",
82    ],
83    aidl: {
84        local_include_dirs: ["binder"],
85        include_dirs: [
86            "frameworks/native/aidl/binder",
87            "frameworks/base/core/java",
88        ],
89        export_aidl_headers: true,
90    },
91    whole_static_libs: [
92        "libincremental_aidl-cpp",
93    ],
94    export_shared_lib_headers: [
95        "libbinder",
96    ],
97}
98
99cc_library_headers {
100    name: "libvold_headers",
101    recovery_available: true,
102    export_include_dirs: ["."],
103}
104
105// Static library factored out to support testing
106cc_library_static {
107    name: "libvold",
108    defaults: [
109        "vold_default_flags",
110        "vold_default_libs",
111    ],
112
113    srcs: [
114        "AppFuseUtil.cpp",
115        "Benchmark.cpp",
116        "Checkpoint.cpp",
117        "CryptoType.cpp",
118        "Devmapper.cpp",
119        "EncryptInplace.cpp",
120        "FileDeviceUtils.cpp",
121        "FsCrypt.cpp",
122        "IdleMaint.cpp",
123        "KeyBuffer.cpp",
124        "KeyStorage.cpp",
125        "KeyUtil.cpp",
126        "Keymaster.cpp",
127        "Loop.cpp",
128        "MetadataCrypt.cpp",
129        "MoveStorage.cpp",
130        "NetlinkHandler.cpp",
131        "NetlinkManager.cpp",
132        "Process.cpp",
133        "ScryptParameters.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    shared_libs: [
167        "android.hardware.health.storage@1.0",
168        "android.hardware.health.storage-V1-ndk_platform",
169        "android.system.keystore2-V1-ndk_platform",
170        "android.security.maintenance-ndk_platform",
171        "libbinder_ndk",
172        "libkeymint_support",
173    ],
174    whole_static_libs: [
175        "com.android.sysprop.apex",
176        "libc++fs"
177    ],
178}
179
180cc_binary {
181    name: "vold",
182    defaults: [
183        "vold_default_flags",
184        "vold_default_libs",
185    ],
186
187    srcs: ["main.cpp"],
188    static_libs: ["libvold"],
189    init_rc: [
190        "vold.rc",
191        "wait_for_keymaster.rc",
192    ],
193
194    required: [
195        "mke2fs",
196        "vold_prepare_subdirs",
197        "wait_for_keymaster",
198    ],
199
200    shared_libs: [
201        "android.hardware.health.storage@1.0",
202        "android.hardware.health.storage-V1-ndk_platform",
203        "android.system.keystore2-V1-ndk_platform",
204        "android.security.maintenance-ndk_platform",
205        "libbinder_ndk",
206        "libkeymint_support",
207    ],
208
209    product_variables: {
210        arc: {
211            exclude_srcs: [
212                "model/StubVolume.cpp",
213            ],
214            static_libs: [
215                "libarcvolume",
216            ],
217        },
218	},
219}
220
221cc_binary {
222    name: "vdc",
223    defaults: ["vold_default_flags"],
224
225    srcs: ["vdc.cpp"],
226    shared_libs: [
227        "libbase",
228        "libbinder",
229        "libcutils",
230        "libutils",
231    ],
232    static_libs: [
233        "libvold_binder",
234    ],
235    init_rc: ["vdc.rc"],
236}
237
238cc_binary {
239    name: "wait_for_keymaster",
240    defaults: ["vold_default_flags"],
241
242    srcs: [
243        "wait_for_keymaster.cpp",
244        "Keymaster.cpp",
245    ],
246    shared_libs: [
247        "libbase",
248        "libbinder",
249        "libbinder_ndk",
250
251        "android.system.keystore2-V1-ndk_platform",
252        "android.security.maintenance-ndk_platform",
253        "libhardware",
254        "libhardware_legacy",
255        "libhidlbase",
256        "libkeymint_support",
257        "libutils",
258    ],
259}
260
261cc_binary {
262    name: "secdiscard",
263    defaults: ["vold_default_flags"],
264
265    srcs: [
266        "FileDeviceUtils.cpp",
267        "secdiscard.cpp",
268    ],
269    shared_libs: ["libbase"],
270}
271
272cc_binary {
273    name: "vold_prepare_subdirs",
274    defaults: ["vold_default_flags"],
275
276    srcs: ["vold_prepare_subdirs.cpp", "Utils.cpp"],
277    shared_libs: [
278        "libbase",
279        "libcutils",
280        "liblogwrap",
281        "libselinux",
282        "libutils",
283    ],
284    static_libs: [
285        "libvold_binder",
286    ],
287}
288
289filegroup {
290    name: "vold_aidl",
291    srcs: [
292        "binder/android/os/IVold.aidl",
293        "binder/android/os/IVoldListener.aidl",
294        "binder/android/os/IVoldMountCallback.aidl",
295        "binder/android/os/IVoldTaskListener.aidl",
296    ],
297    path: "binder",
298}
299