blob: 5e2f1c56cfa30e7b5d812f4dbb706b253f0d90a7 [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 /**
31 % if entry.description:
32${entry.description | javadoc}\
33 % endif
34 % if entry.notes:
35${entry.notes | javadoc}\
36 % endif
37 % if entry.enum and not (entry.typedef and entry.typedef.languages.get('java')):
38 % for value in entry.enum.values:
39 * @see #${jenum_value(entry, value)}
40 % endfor
41 % endif
42 % if entry.applied_visibility == 'hidden':
43 *
44 * @hide
45 % endif
46 */
47 public static final Key<${jtype_boxed(entry)}> ${entry.name | jkey_identifier} =
48 new Key<${jtype_boxed(entry)}>("${entry.name}", ${jclass(entry)});
Igor Murashkinaa133d32013-06-28 17:27:49 -070049</%def>\
50##
51## Generate a list of only Static, Controls, or Dynamic properties.
52<%def name="single_kind_keys(java_name, xml_name)">\
Igor Murashkinaa133d32013-06-28 17:27:49 -070053% for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
54 % for section in outer_namespace.sections:
Eino-Ville Talvalaf384f0a2013-07-12 17:02:27 -070055 % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \
56 any_visible(section, xml_name, ('public','hidden') ):
Igor Murashkinaa133d32013-06-28 17:27:49 -070057 % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'):
58## 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
59## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070060 % for entry in filter_visibility(inner_namespace.merged_entries, ('hidden','public')):
61${generate_key(entry)}
62 % endfor
63 % endfor
64 % for entry in filter_visibility( \
65 get_children_by_filtering_kind(section, xml_name, 'merged_entries'), \
Eino-Ville Talvalaf384f0a2013-07-12 17:02:27 -070066 ('hidden', 'public')):
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070067${generate_key(entry)}
68 % endfor
Igor Murashkinaa133d32013-06-28 17:27:49 -070069 % endif
70 % endfor
71% endfor
Igor Murashkinaa133d32013-06-28 17:27:49 -070072</%def>\
73##
74## Static properties only
Igor Murashkin21d0f1a2013-09-10 12:25:56 -070075##${single_kind_keys('CameraCharacteristicsKeys', 'static')}
Igor Murashkinaa133d32013-06-28 17:27:49 -070076##
77## Controls properties only
78##${single_kind_keys('CaptureRequestKeys', 'controls')}
79##
80## Dynamic properties only
81##${single_kind_keys('CaptureResultKeys', 'dynamic')}
Eino-Ville Talvalad4e240a2013-08-08 12:56:37 -070082${single_kind_keys(java_class, xml_kind)}\
83 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
84 * End generated code
85 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/