xref: /aosp_15_r20/system/media/camera/docs/metadata_template.mako (revision b9df5ad1c9ac98a7fefaac271a55f7ae3db05414)
1## -*- coding: utf-8 -*-
2<?xml version="1.0" encoding="UTF-8"?>
3<!-- Copyright (C) 2012 The Android Open Source Project
4
5     Licensed under the Apache License, Version 2.0 (the "License");
6     you may not use this file except in compliance with the License.
7     You may obtain a copy of the License at
8
9          http://www.apache.org/licenses/LICENSE-2.0
10
11     Unless required by applicable law or agreed to in writing, software
12     distributed under the License is distributed on an "AS IS" BASIS,
13     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14     See the License for the specific language governing permissions and
15     limitations under the License.
16-->
17<metadata
18    xmlns="http://schemas.android.com/service/camera/metadata/"
19    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20    xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata_definitions.xsd">
21
22<tags>
23% for tag in metadata.tags:
24  % if tag.description and tag.description.strip():
25  <tag id="${tag.id}">${tag.description | x}</tag>
26  % else:
27  <tag id="${tag.id}"><!-- TODO: fill the tag description --></tag>
28  % endif
29% endfor
30</tags>
31
32<types>
33% for typedef in metadata.types:
34  <typedef name="${typedef.name}">
35    % for (language, klass) in typedef.languages.items():
36      <language name="${language}">${klass | h}</language>
37    % endfor
38  </typedef>
39% endfor
40</types>
41
42% for root in metadata.outer_namespaces:
43<namespace name="${root.name}">
44  % for section in root.sections:
45  <section name="${section.name}">
46
47    % if section.description is not None:
48      <description>${section.description}</description>
49    % endif
50
51    % for kind in section.kinds: # dynamic,static,controls
52      <${kind.name}>
53
54        <%def name="insert_body(node)">
55            % for nested in node.namespaces:
56                ${insert_namespace(nested)}
57            % endfor
58
59            % for entry in node.entries:
60                ${insert_entry(entry)}
61            % endfor
62        </%def>
63
64        <%def name="insert_namespace(namespace)">
65        <namespace name="${namespace.name}">
66            ${insert_body(namespace)}
67        </namespace>
68        </%def>
69
70        <%def name="insert_entry(prop)">
71        % if prop.is_clone():
72            <clone entry="${prop.name}" kind="${prop.target_kind}"
73          % if ('hal_version' in prop._property_keys):
74                hal_version="${prop.hal_major_version}.${prop.hal_minor_version}"
75          % endif
76            >
77
78              % if prop.details is not None:
79                <details>${prop.details}</details>
80              % endif
81
82              % if prop.ndk_details is not None:
83                <ndk_details>${prop.ndk_details}</ndk_details>
84              % endif
85
86              % if prop.hal_details is not None:
87                <hal_details>${prop.hal_details}</hal_details>
88              % endif
89
90              % for tag in prop.tags:
91                <tag id="${tag.id}" />
92              % endfor
93
94            </clone>
95        % else:
96            <entry name="${prop.name_short}" type="${prop.type}"
97          % if prop.visibility:
98                visibility="${prop.visibility}"
99          % endif
100          % if prop.synthetic:
101                synthetic="true"
102          % endif
103          % if prop.deprecated:
104                deprecated="true"
105          % endif
106          % if prop.optional:
107                optional="${str(prop.optional).lower()}"
108          % endif
109          % if prop.enum:
110                enum="true"
111          % endif
112          % if prop.type_notes is not None:
113                type_notes="${prop.type_notes}"
114          % endif
115          % if prop.container is not None:
116                container="${prop.container}"
117          % endif
118
119          % if prop.typedef is not None:
120                typedef="${prop.typedef.name}"
121          % endif
122
123          % if prop.hwlevel:
124                hwlevel="${prop.hwlevel}"
125          % endif
126
127          % if prop.permission_needed == "true":
128                permission_needed="true"
129          % endif
130
131          % if prop.aconfig_flag:
132                aconfig_flag="${prop.aconfig_flag}"
133          % endif
134
135          % if (prop.hal_major_version, prop.hal_minor_version) != (3,2):
136                hal_version="${prop.hal_major_version}.${prop.hal_minor_version}"
137          % endif
138
139          % if prop.session_characteristics_key_since:
140                session_characteristics_key_since="${prop.session_characteristics_key_since}"
141          % endif
142            >
143
144              % if prop.container == 'array':
145                <array>
146                  % for size in prop.container_sizes:
147                    <size>${size}</size>
148                  % endfor
149                </array>
150              % elif prop.container == 'tuple':
151                <tuple>
152                  % for size in prop.container_sizes:
153                    <value /> <!-- intentionally generated empty. manually fix -->
154                  % endfor
155                </tuple>
156              % endif
157              % if prop.enum:
158                <enum>
159                  % for value in prop.enum.values:
160                      <value
161                    % if value.deprecated:
162                             deprecated="true"
163                    % endif:
164                    % if value.optional:
165                             optional="true"
166                    % endif:
167                    % if value.visibility is not None:
168                             visibility="${value.visibility}"
169                    % endif:
170                    % if value.id is not None:
171                             id="${value.id}"
172                    % endif
173                    % if not (value.hal_major_version == prop.hal_major_version and value.hal_minor_version == prop.hal_minor_version):
174                             hal_version=${"%d.%d" % (value.hal_major_version, value.hal_minor_version)}
175                    % endif
176                    % if not (value.aconfig_flag == prop.aconfig_flag):
177                             aconfig_flag="${value.aconfig_flag}"
178                    % endif
179                      >${value.name}
180                    % if value.notes is not None:
181                             <notes>${value.notes}</notes>
182                    % endif
183                    % if value.sdk_notes is not None:
184                             <sdk_notes>${value.sdk_notes}</sdk_notes>
185                    % endif
186                    % if value.ndk_notes is not None:
187                             <ndk_notes>${value.ndk_notes}</ndk_notes>
188                    % endif
189
190                      </value>
191                  % endfor
192                </enum>
193              % endif
194
195              % if prop.description is not None:
196                <description>${prop.description | x}</description>
197              % endif
198
199              % if prop.deprecation_description is not None:
200                <deprecation_description>${prop.deprecation_description | x}</deprecation_description>
201              % endif
202
203              % if prop.units is not None:
204                <units>${prop.units | x}</units>
205              % endif
206
207              % if prop.range is not None:
208                <range>${prop.range | x}</range>
209              % endif
210
211              % if prop.details is not None:
212                <details>${prop.details | x}</details>
213              % endif
214
215              % if prop.ndk_details is not None:
216                <ndk_details>${prop.ndk_details}</ndk_details>
217              % endif
218
219              % if prop.hal_details is not None:
220                <hal_details>${prop.hal_details | x}</hal_details>
221              % endif
222
223              % for tag in prop.tags:
224                <tag id="${tag.id}" />
225              % endfor
226
227            </entry>
228        % endif
229        </%def>
230
231        ${insert_body(kind)}
232
233      </${kind.name}>
234    % endfor # for each kind
235
236  </section>
237  % endfor
238</namespace>
239% endfor
240
241</metadata>
242