1// Copyright (C) 2018 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
15package {
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_av_license"
19    // to get the below license kinds:
20    //   SPDX-license-identifier-Apache-2.0
21    default_applicable_licenses: ["frameworks_av_license"],
22}
23
24apex_defaults {
25    name: "com.android.media-defaults",
26    updatable: true,
27    bootclasspath_fragments: ["com.android.media-bootclasspath-fragment"],
28    systemserverclasspath_fragments: ["com.android.media-systemserverclasspath-fragment"],
29    multilib: {
30        first: {
31            // Extractor process runs only with the primary ABI.
32            native_shared_libs: [
33                // Extractor plugins
34                "libaacextractor",
35                "libamrextractor",
36                "libflacextractor",
37                "libmidiextractor",
38                "libmkvextractor",
39                "libmp3extractor",
40                "libmp4extractor",
41                "libmpeg2extractor",
42                "liboggextractor",
43                "libwavextractor",
44            ],
45            // Transcoding service only run with primary ABI.
46            binaries: [
47                "mediatranscoding",
48            ],
49        },
50    },
51    // JNI
52    native_shared_libs: [
53        "libmediaparser-jni",
54        "libmediaformatshaper",
55    ],
56    compile_multilib: "both",
57    prebuilts: [
58        "code_coverage.policy",
59        "com.android.media-mediatranscoding.rc",
60        "crash_dump.policy",
61        "mediaextractor.policy",
62        "media-linker-config",
63    ],
64    key: "com.android.media.key",
65    certificate: ":com.android.media.certificate",
66
67    // Use a custom AndroidManifest.xml used for API targeting.
68    androidManifest: ":com.android.media-androidManifest",
69
70    // IMPORTANT: For the APEX to be installed on Android 10 (API 29),
71    // min_sdk_version should be 29. This enables the build system to make
72    // sure the package compatible to Android 10 in two ways:
73    // - build the APEX package compatible to Android 10
74    //   so that the package can be installed.
75    // - build artifacts (lib/javalib/bin) against Android 10 SDK
76    //   so that the artifacts can run.
77    min_sdk_version: "29",
78    // Indicates that pre-installed version of this apex can be compressed.
79    // Whether it actually will be compressed is controlled on per-device basis.
80    compressible: true,
81}
82
83apex {
84    name: "com.android.media",
85    manifest: "manifest.json",
86    defaults: ["com.android.media-defaults"],
87    prebuilts: ["current_sdkinfo"],
88}
89
90linker_config {
91    name: "media-linker-config",
92    src: "linker.config.json",
93    installable: false,
94}
95
96// Encapsulate the contributions made by the com.android.media to the bootclasspath.
97bootclasspath_fragment {
98    name: "com.android.media-bootclasspath-fragment",
99    contents: ["updatable-media"],
100    apex_available: ["com.android.media"],
101
102    api: {
103        stub_libs: [
104            // Stubs for the APIs provided by updatable-media. This has to be
105            // specified explicitly because updatable-media is not a
106            // java_sdk_library.
107            "framework-media",
108        ],
109    },
110
111    // The bootclasspath_fragments that provide APIs on which this depends.
112    fragments: [
113        {
114            apex: "com.android.art",
115            module: "art-bootclasspath-fragment",
116        },
117    ],
118
119    // Additional stubs libraries that this fragment's contents use which are
120    // not provided by another bootclasspath_fragment.
121    additional_stubs: [
122        "android-non-updatable",
123    ],
124
125    // Additional hidden API flag files to override the defaults. This must only be
126    // modified by the Soong or platform compat team.
127    hidden_api: {
128        max_target_o_low_priority: ["hiddenapi/hiddenapi-max-target-o-low-priority.txt"],
129    },
130}
131
132// Encapsulate the contributions made by the com.android.media to the systemserverclasspath.
133systemserverclasspath_fragment {
134    name: "com.android.media-systemserverclasspath-fragment",
135    contents: ["service-media-s"],
136    apex_available: ["com.android.media"],
137}
138
139filegroup {
140    name: "com.android.media-androidManifest",
141    srcs: ["AndroidManifest-media.xml"],
142}
143
144filegroup {
145    name: "com.android.media.swcodec-androidManifest",
146    srcs: ["AndroidManifest-swcodec.xml"],
147}
148
149apex_defaults {
150    name: "com.android.media.swcodec-defaults",
151    updatable: true,
152    binaries: [
153        "mediaswcodec",
154    ],
155    native_shared_libs: [
156        "libcodec2_hidl@1.0",
157        "libcodec2_hidl@1.1",
158        "libcodec2_hidl@1.2",
159        "libstagefright_foundation",
160    ],
161    prebuilts: [
162        "com.android.media.swcodec-mediaswcodec.rc",
163        "com.android.media.swcodec-ld.config.txt",
164        "mediaswcodec.policy",
165        "code_coverage.policy",
166        "crash_dump.policy",
167        "mediaswcodec.xml",
168    ],
169    key: "com.android.media.swcodec.key",
170    certificate: ":com.android.media.swcodec.certificate",
171
172    // Use a custom AndroidManifest.xml used for API targeting.
173    androidManifest: ":com.android.media.swcodec-androidManifest",
174
175    // IMPORTANT: For the APEX to be installed on Android 10 (API 29),
176    // min_sdk_version should be 29. This enables the build system to make
177    // sure the package compatible to Android 10 in two ways:
178    // - build the APEX package compatible to Android 10
179    //   so that the package can be installed.
180    // - build artifacts (lib/javalib/bin) against Android 10 SDK
181    //   so that the artifacts can run.
182    min_sdk_version: "29",
183    // Indicates that pre-installed version of this apex can be compressed.
184    // Whether it actually will be compressed is controlled on per-device basis.
185    compressible: true,
186}
187
188prebuilt_etc {
189    name: "com.android.media-mediatranscoding.rc",
190    src: "mediatranscoding.rc",
191    filename: "init.rc",
192    installable: false,
193}
194
195prebuilt_etc {
196    name: "com.android.media.swcodec-mediaswcodec.rc",
197    src: "mediaswcodec.rc",
198    filename: "init.rc",
199    installable: false,
200}
201
202prebuilt_etc {
203    name: "com.android.media.swcodec-ld.config.txt",
204    src: "ld.config.txt",
205    filename: "ld.config.txt",
206    installable: false,
207}
208
209apex {
210    name: "com.android.media.swcodec",
211    manifest: "manifest_codec.json",
212    defaults: ["com.android.media.swcodec-defaults"],
213}
214
215apex_key {
216    name: "com.android.media.key",
217    public_key: "com.android.media.avbpubkey",
218    private_key: "com.android.media.pem",
219}
220
221apex_key {
222    name: "com.android.media.swcodec.key",
223    public_key: "com.android.media.swcodec.avbpubkey",
224    private_key: "com.android.media.swcodec.pem",
225}
226
227android_app_certificate {
228    name: "com.android.media.certificate",
229    certificate: "com.android.media",
230}
231
232android_app_certificate {
233    name: "com.android.media.swcodec.certificate",
234    certificate: "com.android.media.swcodec",
235}
236