1## -*- 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 \
23         any_visible(section, kind_name, ('public','ndk_public') ):
24      % 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.
27        % for entry in filter_visibility(inner_namespace.merged_entries, ('public','ndk_public')):
28          % if not entry.synthetic:
29        case ${ndk(entry.name) | csym}:
30          % else:
31            assert(False),"A synthetic key should not present in NDK!"
32          % endif
33       % endfor
34    % endfor
35    % for entry in filter_visibility( \
36        get_children_by_filtering_kind(section, kind_name, 'merged_entries'), \
37                                         ('public','ndk_public')):
38      % 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
67// System tags that should be hidden from users
68std::unordered_set<uint32_t> ACameraMetadata::sSystemTags ({
69    % for sec in find_all_sections(metadata):
70      % for entry in remove_synthetic(find_unique_entries(sec)):
71        % if entry.applied_visibility == "system":
72    ${entry.name | csym},
73        % endif
74      % endfor
75    %endfor
76});
77
78/*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~
79 * End generated code
80 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/
81