xref: /aosp_15_r20/frameworks/av/services/audiopolicy/engineconfigurable/tools/Android.bp (revision ec779b8e0859a360c3d303172224686826e6e0e1)
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    default_team: "trendy_team_android_media_audio_framework",
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "frameworks_av_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    default_applicable_licenses: ["frameworks_av_license"],
23}
24
25//##################################################################################################
26// Legacy tools for audio policy engine criterion type configuration file
27//
28python_binary_host {
29    name: "buildPolicyCriterionTypes",
30    main: "buildPolicyCriterionTypes.py",
31    srcs: [
32        "buildPolicyCriterionTypes.py",
33    ],
34}
35
36genrule_defaults {
37    name: "buildpolicycriteriontypesrule",
38    tools: ["buildPolicyCriterionTypes"],
39    cmd: "cp $(locations :audio_policy_configuration_files) $(genDir)/. && " +
40        "cp $(location :audio_policy_configuration_top_file) $(genDir)/audio_policy_configuration.xml && " +
41        "$(location buildPolicyCriterionTypes) " +
42        " --androidaudiobaseheader $(location :libaudio_system_audio_base) " +
43        " --androidaudiocommonbaseheader $(location :libaudio_system_audio_common_base) " +
44        "--audiopolicyconfigurationfile $(genDir)/audio_policy_configuration.xml " +
45        "--criteriontypes $(location :audio_policy_engine_criterion_types_template) " +
46        "--outputfile $(out)",
47    srcs: [
48        // The commented inputs must be provided to use this genrule_defaults
49        // @todo uncomment if 1428659 is merged":android_audio_base_header_file",
50        ":audio_policy_engine_criterion_types_template",
51        ":libaudio_system_audio_base",
52        ":libaudio_system_audio_common_base",
53        // ":audio_policy_configuration_top_file",
54        // ":audio_policy_configuration_files",
55    ],
56    out: ["audio_policy_engine_criterion_types.xml"],
57}
58
59//##################################################################################################
60// Tools for audio policy engine criterion type configuration file
61//
62python_binary_host {
63    name: "capBuildPolicyCriterionTypes",
64    main: "capBuildPolicyCriterionTypes.py",
65    srcs: [
66        "capBuildPolicyCriterionTypes.py",
67    ],
68}
69
70genrule_defaults {
71    name: "capbuildpolicycriteriontypesrule",
72    tools: ["capBuildPolicyCriterionTypes"],
73    cmd: "cp $(locations :audio_policy_configuration_files) $(genDir)/. && " +
74        "cp $(location :audio_policy_configuration_top_file) $(genDir)/audio_policy_configuration.xml && " +
75        "$(location capBuildPolicyCriterionTypes) " +
76        " --androidaudiobaseheader $(location :libaudio_system_audio_base) " +
77        " --androidaudiocommonbaseheader $(location :libaudio_system_audio_common_base) " +
78        "--audiopolicyconfigurationfile $(genDir)/audio_policy_configuration.xml " +
79        "--criteriontypes $(location :audio_policy_engine_aidl_criterion_types_template) " +
80        "--outputfile $(out)",
81    srcs: [
82        // The commented inputs must be provided to use this genrule_defaults
83        // @todo uncomment if 1428659 is merged":android_audio_base_header_file",
84        ":audio_policy_engine_aidl_criterion_types_template",
85        ":libaudio_system_audio_base",
86        ":libaudio_system_audio_common_base",
87        // ":audio_policy_configuration_top_file",
88        // ":audio_policy_configuration_files",
89    ],
90    out: ["audio_policy_engine_criterion_types.xml"],
91}
92
93//##################################################################################################
94// Tools for audio policy engine parameter framework configurable domains
95//
96python_binary_host {
97    name: "domainGeneratorPolicy",
98    main: "domainGeneratorPolicy.py",
99    srcs: [
100        "domainGeneratorPolicy.py",
101    ],
102    libs: [
103        "EddParser.py",
104        "PFWScriptGenerator.py",
105        "hostConfig.py",
106    ],
107    required: [
108        "domainGeneratorConnector",
109    ],
110}
111
112genrule_defaults {
113    name: "domaingeneratorpolicyrule",
114    tools: [
115        "domainGeneratorConnector",
116        "domainGeneratorPolicy",
117    ],
118    cmd: "mkdir -p $(genDir)/Structure/Policy && " +
119        "cp $(locations :audio_policy_pfw_structure_files) $(genDir)/Structure/Policy && " +
120        "cp $(location :audio_policy_pfw_toplevel) $(genDir)/top_level && " +
121        "sed -i -e 's|TuningAllowed=\"false\"|TuningAllowed=\"true\" ServerPort=\"unix:///dev/socket/audioserver/policy_debug\"|g' $(genDir)/top_level &&" +
122        "$(location domainGeneratorPolicy) " +
123        "--validate " +
124        "--domain-generator-tool $(location domainGeneratorConnector) " +
125        "--toplevel-config $(genDir)/top_level " +
126        "--criteria $(location :audio_policy_engine_criteria) " +
127        "--criteriontypes $(location :audio_policy_engine_criterion_types) " +
128        "--add-edds $(locations :edd_files) " +
129        "--schemas-dir external/parameter-framework/upstream/schemas " +
130        " > $(out)",
131    srcs: [
132        // The commented inputs must be provided to use this genrule_defaults
133        // ":audio_policy_pfw_toplevel",
134        // ":audio_policy_pfw_structure_files",
135        ":audio_policy_engine_criteria",
136        // ":audio_policy_engine_criterion_types",
137        // ":edd_files",
138        ":parameter_frameworks_configuration_schemas",
139    ],
140    out: ["PolicyConfigurableDomains.xml"],
141}
142
143//##################################################################################################
144// Legacy tools for policy parameter-framework product strategies structure file generation
145//
146python_binary_host {
147    name: "buildStrategiesStructureFile",
148    main: "buildStrategiesStructureFile.py",
149    srcs: [
150        "buildStrategiesStructureFile.py",
151    ],
152}
153
154genrule_defaults {
155    name: "buildstrategiesstructurerule",
156    tools: ["buildStrategiesStructureFile"],
157    cmd: "cp $(locations :audio_policy_engine_configuration_files) $(genDir) && ls -l $(genDir) &&" +
158        "$(location buildStrategiesStructureFile) " +
159        "--audiopolicyengineconfigurationfile $(genDir)/audio_policy_engine_configuration.xml " +
160        "--productstrategiesstructurefile $(location :product_strategies_structure_template) " +
161        "--outputfile $(out)",
162    srcs: [
163        // The commented inputs must be provided to use this genrule_defaults
164        // ":audio_policy_engine_configuration_files",
165        ":product_strategies_structure_template",
166    ],
167    out: ["ProductStrategies.xml"],
168}
169
170//##################################################################################################
171// Tools for policy parameter-framework common type structure file generation
172//
173python_binary_host {
174    name: "buildCommonTypesStructureFile",
175    main: "buildCommonTypesStructureFile.py",
176    srcs: [
177        "buildCommonTypesStructureFile.py",
178    ],
179}
180
181genrule_defaults {
182    name: "buildcommontypesstructurerule",
183    tools: ["buildCommonTypesStructureFile"],
184    cmd: "$(location buildCommonTypesStructureFile) " +
185        "--androidaudiobaseheader $(location :libaudio_system_audio_base) " +
186        "--commontypesstructure $(location :common_types_structure_template) " +
187        "--outputfile $(out)",
188    srcs: [
189        ":common_types_structure_template",
190        ":libaudio_system_audio_base",
191    ],
192}
193