blob: d62fcc3ec627bad3a0b62582419e814251784f86 [file] [log] [blame]
Yin-Chia Yehea7662f2015-12-22 16:25:00 -08001## -*- coding: utf-8 -*-
2##
3## Copyright (C) 2015 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## Generate a list of only Static, Controls, or Dynamic properties.
19<%def name="single_kind_keys(kind_name)">\
20% for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace
21 % for section in outer_namespace.sections:
22 % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == kind_name) and \
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070023 any_visible(section, kind_name, ('public','ndk_public') ):
Yin-Chia Yehea7662f2015-12-22 16:25:00 -080024 % for inner_namespace in get_children_by_filtering_kind(section, kind_name, 'namespaces'):
25## 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
26## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier.
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070027 % for entry in filter_visibility(inner_namespace.merged_entries, ('public','ndk_public')):
Yin-Chia Yehea7662f2015-12-22 16:25:00 -080028 % if not entry.synthetic:
29 case ${ndk(entry.name) | csym}:
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070030 % else:
31 assert(False),"A synthetic key should not present in NDK!"
Yin-Chia Yehea7662f2015-12-22 16:25:00 -080032 % endif
33 % endfor
34 % endfor
35 % for entry in filter_visibility( \
36 get_children_by_filtering_kind(section, kind_name, 'merged_entries'), \
Yin-Chia Yehc6c24162016-04-02 16:30:30 -070037 ('public','ndk_public')):
Yin-Chia Yehea7662f2015-12-22 16:25:00 -080038 % if not entry.synthetic:
39 case ${ndk(entry.name) | csym}:
40 % endif
41 % endfor
42 % endif
43 % endfor
44% endfor
45</%def>\
46/*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
47 * The key entries below this point are generated from metadata
48 * definitions in /system/media/camera/docs. Do not modify by hand or
49 * modify the comment blocks at the start or end.
50 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/
51
52bool
53ACameraMetadata::isCaptureRequestTag(const uint32_t tag) {
54 // Skip check for vendor keys
55 if (isVendorTag(tag)) {
56 return true;
57 }
58
59 switch (tag) {
60${single_kind_keys("controls")}\
61 return true;
62 default:
63 return false;
64 }
65}
66
Yin-Chia Yeh8b867932016-03-03 15:38:33 -080067// System tags that should be hidden from users
68std::unordered_set<uint32_t> ACameraMetadata::sSystemTags ({
69 % for sec in find_all_sections(metadata):
Shuzhen Wangccdf3a32022-04-20 10:15:57 -070070 % for entry in remove_hal_non_visible(find_unique_entries(sec)):
Yin-Chia Yeh8b867932016-03-03 15:38:33 -080071 % if entry.applied_visibility == "system":
72 ${entry.name | csym},
73 % endif
74 % endfor
75 %endfor
76});
77
Yin-Chia Yehea7662f2015-12-22 16:25:00 -080078/*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
79 * End generated code
80 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/