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: [
226        "vdc.cpp",
227        "Utils.cpp",
228    ],
229    shared_libs: [
230        "libbase",
231        "libbinder",
232        "libcutils",
233        "liblogwrap",
234        "libselinux",
235        "libutils",
236    ],
237    static_libs: [
238        "libvold_binder",
239    ],
240    init_rc: ["vdc.rc"],
241}
242
243cc_binary {
244    name: "wait_for_keymaster",
245    defaults: ["vold_default_flags"],
246
247    srcs: [
248        "wait_for_keymaster.cpp",
249        "Keymaster.cpp",
250    ],
251    shared_libs: [
252        "libbase",
253        "libbinder",
254        "libbinder_ndk",
255
256        "android.system.keystore2-V1-ndk_platform",
257        "android.security.maintenance-ndk_platform",
258        "libhardware",
259        "libhardware_legacy",
260        "libhidlbase",
261        "libkeymint_support",
262        "libutils",
263    ],
264}
265
266cc_binary {
267    name: "secdiscard",
268    defaults: ["vold_default_flags"],
269
270    srcs: [
271        "FileDeviceUtils.cpp",
272        "secdiscard.cpp",
273    ],
274    shared_libs: ["libbase"],
275}
276
277cc_binary {
278    name: "vold_prepare_subdirs",
279    defaults: ["vold_default_flags"],
280
281    srcs: ["vold_prepare_subdirs.cpp", "Utils.cpp"],
282    shared_libs: [
283        "libbase",
284        "libcutils",
285        "liblogwrap",
286        "libselinux",
287        "libutils",
288    ],
289    static_libs: [
290        "libvold_binder",
291    ],
292}
293
294filegroup {
295    name: "vold_aidl",
296    srcs: [
297        "binder/android/os/IVold.aidl",
298        "binder/android/os/IVoldListener.aidl",
299        "binder/android/os/IVoldMountCallback.aidl",
300        "binder/android/os/IVoldTaskListener.aidl",
301    ],
302    path: "binder",
303}
304