1## -*- coding: utf-8 -*- 2## 3## 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## This section of enum integer definitions is inserted into 19## android.hardware.camera2.CameraMetadata. 20 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 21 * The enum values below this point are generated from metadata 22 * definitions in /system/media/camera/docs. Do not modify by hand or 23 * modify the comment blocks at the start or end. 24 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ 25## 26## Generate an enum's integers 27<%def name="generate_enum(entry, target_class)">\ 28 // 29 // Enumeration values for ${target_class}#${entry.name | jkey_identifier} 30 // 31 32 % for value in entry.enum.values: 33 /** 34 % if value.notes: 35${value.notes | javadoc(metadata)}\ 36 % endif 37 * @see ${target_class}#${entry.name | jkey_identifier} 38 % if entry.applied_visibility == 'hidden' or value.hidden: 39 * @hide 40 %endif 41 */ 42 public static final int ${jenum_value(entry, value)} = ${enum_calculate_value_string(value)}; 43 44 % endfor 45</%def>\ 46## 47## Generate a list of only Static, Controls, or Dynamic properties. 48<%def name="single_kind_keys(xml_name, target_class)">\ 49% for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace 50 % for section in outer_namespace.sections: 51 % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \ 52 any_visible(section, xml_name, ('public','hidden') ): 53 % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'): 54## 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 55## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier. 56 % for entry in filter_visibility(inner_namespace.entries, ('hidden','public')): 57 % if entry.enum \ 58 and not (entry.typedef and entry.typedef.languages.get('java')) \ 59 and not entry.is_clone(): 60${generate_enum(entry, target_class)}\ 61 % endif 62 % endfor 63 % endfor 64 % for entry in filter_visibility( \ 65 get_children_by_filtering_kind(section, xml_name, 'entries'), \ 66 ('hidden', 'public')): 67 % if entry.enum \ 68 and not (entry.typedef and entry.typedef.languages.get('java')) \ 69 and not entry.is_clone(): 70${generate_enum(entry, target_class)}\ 71 % endif 72 % endfor 73 % endif 74 % endfor 75% endfor 76</%def>\ 77 78## 79## Static properties only 80${single_kind_keys('static','CameraCharacteristics')}\ 81## 82## Controls properties only 83${single_kind_keys('controls','CaptureRequest')}\ 84## 85## Dynamic properties only 86${single_kind_keys('dynamic','CaptureResult')}\ 87 /*~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 88 * End generated code 89 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~O@*/ 90