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','fwk_public','fwk_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 'fwk_public','fwk_ndk_public')): 29 % if not entry.synthetic: 30 case ${ndk(entry.name) | csym}: 31 % else: 32 assert(False),"A synthetic key should not present in NDK!" 33 % endif 34 % endfor 35 % endfor 36 % for entry in filter_visibility( \ 37 get_children_by_filtering_kind(section, kind_name, 'merged_entries'), \ 38 ('public','ndk_public','fwk_public','fwk_ndk_public')): 39 % if not entry.synthetic: 40 case ${ndk(entry.name) | csym}: 41 % endif 42 % endfor 43 % endif 44 % endfor 45% endfor 46</%def>\ 47/*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 48 * The key entries below this point are generated from metadata 49 * definitions in /system/media/camera/docs. Do not modify by hand or 50 * modify the comment blocks at the start or end. 51 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ 52 53bool 54ACameraMetadata::isCaptureRequestTag(const uint32_t tag) { 55 // Skip check for vendor keys 56 if (isVendorTag(tag)) { 57 return true; 58 } 59 60 switch (tag) { 61${single_kind_keys("controls")}\ 62 return true; 63 default: 64 return false; 65 } 66} 67 68// System tags that should be hidden from users 69std::unordered_set<uint32_t> ACameraMetadata::sSystemTags ({ 70 % for sec in find_all_sections(metadata): 71 % for entry in remove_hal_non_visible(find_unique_entries(sec)): 72 % if entry.applied_visibility == "system": 73 ${entry.name | csym}, 74 % endif 75 % endfor 76 %endfor 77}); 78 79/*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 80 * End generated code 81 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ 82