1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "hardware_interfaces_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_av_license"],
8}
9
10cc_defaults {
11    name: "aidl_clearkey_service_defaults-use-shared-deps",
12
13    shared_libs: [
14        "libbase",
15        "libbinder_ndk",
16        "libcrypto",
17        "liblog",
18        "libprotobuf-cpp-lite",
19        "libutils",
20        "android.hardware.drm-V1-ndk",
21    ],
22
23    static_libs: [
24        "android.hardware.common-V2-ndk",
25        "libclearkeybase",
26        "libjsoncpp",
27    ],
28}
29
30cc_defaults {
31    name: "aidl_clearkey_service_defaults-use-static-deps",
32
33    stl: "c++_static",
34
35    shared_libs: [
36        "libbinder_ndk",
37        "libcrypto",
38        "liblog",
39    ],
40
41    static_libs: [
42        "android.hardware.common-V2-ndk",
43        "android.hardware.drm-V1-ndk",
44        "libbase",
45        "libclearkeybase",
46        "libjsoncpp",
47        "libprotobuf-cpp-lite",
48        "libutils",
49    ],
50}
51
52cc_defaults {
53    name: "aidl_clearkey_service_defaults",
54    vendor: true,
55
56    srcs: [
57        "CreatePluginFactories.cpp",
58        "CryptoPlugin.cpp",
59        "DrmFactory.cpp",
60        "DrmPlugin.cpp",
61    ],
62
63    relative_install_path: "hw",
64
65    cflags: ["-Wall", "-Werror", "-Wthread-safety"],
66
67    include_dirs: ["frameworks/av/include"],
68
69    local_include_dirs: ["include"],
70
71    sanitize: {
72        integer_overflow: true,
73    },
74}
75
76cc_binary {
77    name: "android.hardware.drm-service.clearkey",
78    defaults: [
79        "aidl_clearkey_service_defaults",
80        "aidl_clearkey_service_defaults-use-shared-deps",
81    ],
82    srcs: ["Service.cpp"],
83    init_rc: ["android.hardware.drm-service.clearkey.rc"],
84    vintf_fragments: ["android.hardware.drm-service.clearkey.xml"],
85}
86
87cc_binary {
88    name: "android.hardware.drm-service-lazy.clearkey",
89    defaults: [
90        "aidl_clearkey_service_defaults",
91        "aidl_clearkey_service_defaults-use-shared-deps",
92    ],
93    overrides: ["android.hardware.drm-service.clearkey"],
94    srcs: ["ServiceLazy.cpp"],
95    init_rc: ["android.hardware.drm-service-lazy.clearkey.rc"],
96    vintf_fragments: ["android.hardware.drm-service.clearkey.xml"],
97}
98
99cc_binary {
100    name: "android.hardware.drm-service.clearkey.apex",
101    stem: "android.hardware.drm-service.clearkey",
102    defaults: [
103        "aidl_clearkey_service_defaults",
104        "aidl_clearkey_service_defaults-use-static-deps",
105    ],
106    srcs: ["Service.cpp"],
107    installable: false, // installed in APEX
108}
109
110cc_binary {
111    name: "android.hardware.drm-service-lazy.clearkey.apex",
112    stem: "android.hardware.drm-service-lazy.clearkey",
113    defaults: [
114        "aidl_clearkey_service_defaults",
115        "aidl_clearkey_service_defaults-use-static-deps",
116    ],
117    srcs: ["ServiceLazy.cpp"],
118    installable: false, // installed in APEX
119}
120
121phony {
122    name: "android.hardware.drm@latest-service.clearkey",
123    required: [
124        "com.android.hardware.drm.clearkey",
125    ],
126}
127
128cc_defaults {
129    name: "fuzz_aidl_clearkey_service_defaults",
130
131    srcs: [
132        "CreatePluginFactories.cpp",
133        "CryptoPlugin.cpp",
134        "DrmFactory.cpp",
135        "DrmPlugin.cpp",
136    ],
137
138    relative_install_path: "hw",
139
140    cflags: ["-Wall", "-Werror", "-Wthread-safety"],
141
142    include_dirs: ["frameworks/av/include"],
143
144    shared_libs: [
145        "libbase",
146        "libbinder_ndk",
147        "libcrypto",
148        "liblog",
149        "libprotobuf-cpp-lite",
150        "libutils",
151        "android.hardware.drm-V1-ndk",
152    ],
153
154    static_libs: [
155        "android.hardware.common-V2-ndk",
156        "libclearkeybase_fuzz",
157        "libjsoncpp",
158    ],
159
160    local_include_dirs: ["include"],
161
162    sanitize: {
163        integer_overflow: true,
164    },
165}
166
167cc_fuzz {
168    name: "android.hardware.drm-service.clearkey.aidl_fuzzer",
169    defaults: [
170        "fuzz_aidl_clearkey_service_defaults",
171        "service_fuzzer_defaults",
172    ],
173    srcs: ["fuzzer.cpp"],
174    fuzz_config: {
175        cc: [
176            "hamzeh@google.com",
177        ],
178    },
179}
180
181apex {
182    name: "com.android.hardware.drm.clearkey",
183    manifest: "manifest.json",
184    file_contexts: "file_contexts",
185    key: "com.android.hardware.key",
186    certificate: ":com.android.hardware.certificate",
187    vendor: true,
188    updatable: false,
189
190    binaries: [
191        "android.hardware.drm-service.clearkey.apex",
192    ],
193    prebuilts: [
194        "android.hardware.drm-service.clearkey.apex.rc",
195        "android.hardware.drm-service.clearkey.xml"
196    ],
197    overrides: [
198        "android.hardware.drm-service.clearkey",
199    ],
200}
201
202prebuilt_etc {
203    name: "android.hardware.drm-service.clearkey.apex.rc",
204    src: ":gen-android.hardware.drm-service.clearkey.apex.rc",
205    installable: false,
206}
207
208genrule {
209    name: "gen-android.hardware.drm-service.clearkey.apex.rc",
210    srcs: ["android.hardware.drm-service.clearkey.rc"],
211    out: ["android.hardware.drm-service.clearkey.apex.rc"],
212    cmd: "sed -E 's%/vendor/bin/%/apex/com.android.hardware.drm.clearkey/bin/%' $(in) > $(out)",
213}
214
215prebuilt_etc {
216    name: "android.hardware.drm-service.clearkey.xml",
217    src: "android.hardware.drm-service.clearkey.xml",
218    sub_dir: "vintf",
219    installable: false,
220}
221
222apex {
223    name: "com.android.hardware.drm.clearkey.lazy",
224    manifest: "manifest.json",
225    file_contexts: "file_contexts",
226    key: "com.android.hardware.key",
227    certificate: ":com.android.hardware.certificate",
228    vendor: true,
229    updatable: false,
230
231    binaries: [
232        "android.hardware.drm-service-lazy.clearkey.apex",
233    ],
234    prebuilts: [
235        "android.hardware.drm-service-lazy.clearkey.apex.rc",
236        "android.hardware.drm-service.clearkey.xml"
237    ],
238    overrides: [
239        "android.hardware.drm-service.clearkey",
240        "android.hardware.drm-service-lazy.clearkey",
241        "com.android.hardware.drm.clearkey",
242    ],
243}
244
245prebuilt_etc {
246    name: "android.hardware.drm-service-lazy.clearkey.apex.rc",
247    src: ":gen-android.hardware.drm-service-lazy.clearkey.apex.rc",
248    installable: false,
249}
250
251genrule {
252    name: "gen-android.hardware.drm-service-lazy.clearkey.apex.rc",
253    srcs: ["android.hardware.drm-service-lazy.clearkey.rc"],
254    out: ["android.hardware.drm-service-lazy.clearkey.apex.rc"],
255    cmd: "sed -E 's%/vendor/bin/%/apex/com.android.hardware.drm.clearkey/bin/%' $(in) > $(out)",
256}
257