blob: 30327d8dfb4cc904d1dafc4fa6d1048afb1ce0bd [file] [log] [blame]
Igor Murashkinaa133d32013-06-28 17:27:49 -07001## -*- coding: utf-8 -*-
Igor Murashkinaa133d32013-06-28 17:27:49 -07002##
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -07003## Copyright (C) 2013 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\
18## These sections of metadata Key definitions are inserted into the middle of
Igor Murashkin21d0f1a2013-09-10 12:25:56 -070019## android.hardware.camera2.CameraCharacteristics, CaptureRequest, and CaptureResult.
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070020<%page args="java_class, xml_kind" />\
21 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
22 * The key entries below this point are generated from metadata
23 * definitions in /system/media/camera/docs. Do not modify by hand or
24 * modify the comment blocks at the start or end.
25 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
Igor Murashkinaa133d32013-06-28 17:27:49 -070026
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070027##
28## Generate a single key and docs
29<%def name="generate_key(entry)">\
30 /**
Igor Murashkin88b858d2014-01-14 14:57:46 -080031<%
32 # Dedent fixes markdown not to generate code blocks. Then do the rest.
33 description = ""
34 if entry.description:
35 description = dedent(entry.description) + "\n\n"
36 details = ""
37 if entry.details:
38 details = dedent(entry.details)
39 # Unconditionally add extra information if necessary
Eino-Ville Talvala567167a2014-10-02 18:27:34 -070040 extra_detail = generate_extra_javadoc_detail(entry)("")
Igor Murashkin88b858d2014-01-14 14:57:46 -080041
42 concatenated_info = description + details + extra_detail
43%>\
44## Glue description and details together before javadoc-izing. Otherwise @see in middle of javadoc.
Eino-Ville Talvala81afd332023-11-27 15:03:02 -080045## Avoid @see across differently-flagged API entries for now.
Igor Murashkin88b858d2014-01-14 14:57:46 -080046${concatenated_info | javadoc(metadata)}\
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070047 % if entry.enum and not (entry.typedef and entry.typedef.languages.get('java')):
48 % for value in entry.enum.values:
Eino-Ville Talvala81afd332023-11-27 15:03:02 -080049 % if not value.hidden and (value.aconfig_flag == entry.aconfig_flag):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070050 * @see #${jenum_value(entry, value)}
Eino-Ville Talvalab4329162014-06-09 14:23:02 -070051 % endif
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070052 % endfor
53 % endif
Igor Murashkin6c936c12014-05-13 14:51:49 -070054 % if entry.deprecated:
55 * @deprecated
Eino-Ville Talvala245e2792018-03-13 19:10:23 -070056${entry.deprecation_description | javadoc(metadata)}
Igor Murashkin6c936c12014-05-13 14:51:49 -070057 % endif
Eino-Ville Talvala9c059772024-11-06 17:04:09 -080058 % if entry.applied_visibility in ('hidden', 'ndk_public', 'fwk_only', 'extension', 'fwk_system_public'):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070059 * @hide
60 % endif
61 */
Igor Murashkin6c936c12014-05-13 14:51:49 -070062 % if entry.deprecated:
63 @Deprecated
64 % endif
Emilian Peevc29a66b2024-12-11 20:07:05 +000065 % if entry.applied_visibility in ('public', 'java_public', 'fwk_java_public', 'fwk_public', 'extension_passthrough'):
Igor Murashkin68a26ca2014-07-16 16:54:57 -070066 @PublicKey
Shuzhen Wangc9410422019-02-28 09:53:41 -080067 @NonNull
Igor Murashkin68a26ca2014-07-16 16:54:57 -070068 % endif
Eino-Ville Talvala9c059772024-11-06 17:04:09 -080069 % if entry.applied_visibility == 'fwk_system_public':
70 @SystemApi
71 @NonNull
72 % endif
Igor Murashkin68a26ca2014-07-16 16:54:57 -070073 % if entry.synthetic:
74 @SyntheticKey
75 % endif
Ravneet Dhanjal4e50ec42023-12-04 21:40:25 +000076 % if entry.applied_visibility in ('extension'):
77 @ExtensionKey
78 % endif
Eino-Ville Talvala3a0ef712023-08-25 17:29:01 -070079 % if entry.aconfig_flag:
80 @FlaggedApi(Flags.FLAG_${entry.aconfig_flag | jkey_identifier})
81 % endif
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070082 public static final Key<${jtype_boxed(entry)}> ${entry.name | jkey_identifier} =
Igor Murashkin35a108f2014-05-27 10:51:25 -070083 new Key<${jtype_boxed(entry)}>("${entry.name}", ${jkey_type_token(entry)});
Igor Murashkinaa133d32013-06-28 17:27:49 -070084</%def>\
85##
86## Generate a list of only Static, Controls, or Dynamic properties.
87<%def name="single_kind_keys(java_name, xml_name)">\
Igor Murashkinaa133d32013-06-28 17:27:49 -070088% for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
89 % for section in outer_namespace.sections:
Eino-Ville Talvalaf384f0a2013-07-12 17:02:27 -070090 % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \
Shuzhen Wangf72f59e2024-10-29 17:45:37 -070091 any_visible(section, xml_name, ('public','hidden','ndk_public','java_public','fwk_only',\
Emilian Peevc29a66b2024-12-11 20:07:05 +000092 'fwk_java_public','fwk_public','extension','fwk_system_public','extension_passthrough') ):
Igor Murashkinaa133d32013-06-28 17:27:49 -070093 % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'):
94## We only support 1 level of inner namespace, i.e. android.a.b and android.a.b.c works, but not android.a.b.c.d
95## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
Shuzhen Wangf72f59e2024-10-29 17:45:37 -070096 % for entry in filter_visibility(inner_namespace.merged_entries, ('hidden','public',\
Eino-Ville Talvala9c059772024-11-06 17:04:09 -080097 'ndk_public','java_public','fwk_only','fwk_java_public','fwk_public',\
Emilian Peevc29a66b2024-12-11 20:07:05 +000098 'extension','fwk_system_public','extension_passthrough')):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070099${generate_key(entry)}
100 % endfor
101 % endfor
102 % for entry in filter_visibility( \
103 get_children_by_filtering_kind(section, xml_name, 'merged_entries'), \
Shuzhen Wangf72f59e2024-10-29 17:45:37 -0700104 ('hidden', 'public', 'ndk_public', 'java_public', 'fwk_only', 'fwk_java_public',\
Emilian Peevc29a66b2024-12-11 20:07:05 +0000105 'fwk_public','extension','fwk_system_public','extension_passthrough')):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -0700106${generate_key(entry)}
107 % endfor
Igor Murashkinaa133d32013-06-28 17:27:49 -0700108 % endif
109 % endfor
110% endfor
Igor Murashkinaa133d32013-06-28 17:27:49 -0700111</%def>\
112##
113## Static properties only
Igor Murashkin21d0f1a2013-09-10 12:25:56 -0700114##${single_kind_keys('CameraCharacteristicsKeys', 'static')}
Igor Murashkinaa133d32013-06-28 17:27:49 -0700115##
116## Controls properties only
117##${single_kind_keys('CaptureRequestKeys', 'controls')}
118##
119## Dynamic properties only
120##${single_kind_keys('CaptureResultKeys', 'dynamic')}
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -0700121${single_kind_keys(java_class, xml_kind)}\