Yin-Chia Yeh | ea7662f | 2015-12-22 16:25:00 -0800 | [diff] [blame] | 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 \ |
Yin-Chia Yeh | c6c2416 | 2016-04-02 16:30:30 -0700 | [diff] [blame] | 23 | any_visible(section, kind_name, ('public','ndk_public') ): |
Yin-Chia Yeh | ea7662f | 2015-12-22 16:25:00 -0800 | [diff] [blame] | 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. |
Yin-Chia Yeh | c6c2416 | 2016-04-02 16:30:30 -0700 | [diff] [blame] | 27 | % for entry in filter_visibility(inner_namespace.merged_entries, ('public','ndk_public')): |
Yin-Chia Yeh | ea7662f | 2015-12-22 16:25:00 -0800 | [diff] [blame] | 28 | % if not entry.synthetic: |
| 29 | case ${ndk(entry.name) | csym}: |
Yin-Chia Yeh | c6c2416 | 2016-04-02 16:30:30 -0700 | [diff] [blame] | 30 | % else: |
| 31 | assert(False),"A synthetic key should not present in NDK!" |
Yin-Chia Yeh | ea7662f | 2015-12-22 16:25:00 -0800 | [diff] [blame] | 32 | % endif |
| 33 | % endfor |
| 34 | % endfor |
| 35 | % for entry in filter_visibility( \ |
| 36 | get_children_by_filtering_kind(section, kind_name, 'merged_entries'), \ |
Yin-Chia Yeh | c6c2416 | 2016-04-02 16:30:30 -0700 | [diff] [blame] | 37 | ('public','ndk_public')): |
Yin-Chia Yeh | ea7662f | 2015-12-22 16:25:00 -0800 | [diff] [blame] | 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 | |
| 52 | bool |
| 53 | ACameraMetadata::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 Yeh | 8b86793 | 2016-03-03 15:38:33 -0800 | [diff] [blame] | 67 | // System tags that should be hidden from users |
| 68 | std::unordered_set<uint32_t> ACameraMetadata::sSystemTags ({ |
| 69 | % for sec in find_all_sections(metadata): |
Shuzhen Wang | ccdf3a3 | 2022-04-20 10:15:57 -0700 | [diff] [blame] | 70 | % for entry in remove_hal_non_visible(find_unique_entries(sec)): |
Yin-Chia Yeh | 8b86793 | 2016-03-03 15:38:33 -0800 | [diff] [blame] | 71 | % if entry.applied_visibility == "system": |
| 72 | ${entry.name | csym}, |
| 73 | % endif |
| 74 | % endfor |
| 75 | %endfor |
| 76 | }); |
| 77 | |
Yin-Chia Yeh | ea7662f | 2015-12-22 16:25:00 -0800 | [diff] [blame] | 78 | /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ |
| 79 | * End generated code |
| 80 | *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ |