1// Copyright (C) 2023 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    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19soong_config_module_type {
20    name: "custom_bootclasspath_fragment",
21    module_type: "bootclasspath_fragment",
22    config_namespace: "ANDROID",
23    bool_variables: [
24        "release_crashrecovery_module",
25    ],
26    properties: [
27        "enabled"
28    ],
29}
30
31// Encapsulate the contributions made by the com.android.crashrecovery to the bootclasspath.
32custom_bootclasspath_fragment {
33    // This fragment will be enabled using release_crashrecovery_module flag
34    enabled: false,
35    soong_config_variables: {
36      release_crashrecovery_module: {
37        enabled: true,
38      },
39    },
40
41    name: "com.android.crashrecovery-bootclasspath-fragment",
42    contents: ["framework-crashrecovery"],
43    apex_available: ["com.android.crashrecovery"],
44    hidden_api: {
45        split_packages: ["*"] // TODO(b/289203818) be more specific
46    },
47    // The bootclasspath_fragments that provide APIs on which this depends.
48    fragments: [
49
50        // Needed to access core java APIs.
51        {
52            apex: "com.android.art",
53            module: "art-bootclasspath-fragment",
54        },
55    ],
56
57    // Additional stubs libraries that this fragment's contents use which are
58    // not provided by another bootclasspath_fragment.
59    additional_stubs: [
60        // Needed to access platform APIs.
61        "android-non-updatable",
62    ],
63}
64
65soong_config_module_type {
66    name: "custom_systemserverclasspath_fragment",
67    module_type: "systemserverclasspath_fragment",
68    config_namespace: "ANDROID",
69    bool_variables: [
70        "release_crashrecovery_module",
71    ],
72    properties: [
73        "enabled"
74    ],
75}
76
77// Encapsulate the contributions made by the com.android.crashrecovery to the systemserverclasspath.
78custom_systemserverclasspath_fragment {
79    // This fragment will be enabled using release_crashrecovery_module flag
80    enabled: false,
81    soong_config_variables: {
82      release_crashrecovery_module: {
83        enabled: true,
84      },
85    },
86
87    name: "com.android.crashrecovery-systemserverclasspath-fragment",
88    contents: ["service-crashrecovery"],
89    apex_available: ["com.android.crashrecovery"],
90}
91
92apex_key {
93    name: "com.android.crashrecovery.key",
94    public_key: "com.android.crashrecovery.avbpubkey",
95    private_key: "com.android.crashrecovery.pem",
96}
97
98android_app_certificate {
99    name: "com.android.crashrecovery.certificate",
100    certificate: "com.android.crashrecovery",
101}
102
103soong_config_module_type {
104    name: "custom_apex",
105    module_type: "apex",
106    config_namespace: "ANDROID",
107    bool_variables: [
108        "release_crashrecovery_module",
109    ],
110    properties: [
111        "enabled"
112    ],
113}
114
115custom_apex {
116    // This apex will be enabled using release_crashrecovery_module flag
117    enabled: false,
118    soong_config_variables: {
119        release_crashrecovery_module: {
120          enabled: true,
121        },
122    },
123
124    name: "com.android.crashrecovery",
125    defaults: ["v-launched-apex-module"],
126    bootclasspath_fragments: ["com.android.crashrecovery-bootclasspath-fragment"],
127    systemserverclasspath_fragments: [
128    "com.android.crashrecovery-systemserverclasspath-fragment",
129    ],
130    file_contexts: ":com.android.crashrecovery-file_contexts",
131    prebuilts: [
132      "current_sdkinfo",
133    ],
134    key: "com.android.crashrecovery.key",
135    certificate: ":com.android.crashrecovery.certificate",
136    manifest: "manifest.json",
137    min_sdk_version: "34",
138}
139
140soong_config_module_type {
141    name: "custom_sdk",
142    module_type: "sdk",
143    config_namespace: "ANDROID",
144    bool_variables: [
145        "release_crashrecovery_module",
146    ],
147    properties: [
148        "enabled"
149    ],
150}
151
152custom_sdk {
153    // This sdk will be enabled using release_crashrecovery_module flag
154    enabled: false,
155    soong_config_variables: {
156        release_crashrecovery_module: {
157          enabled: true,
158        },
159    },
160
161    name: "crashrecovery-sdk",
162    apexes: ["com.android.crashrecovery"],
163}
164