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## These sections of metadata Key definitions are inserted into the middle of 19## android.hardware.camera2.CameraCharacteristics, CaptureRequest, and CaptureResult. 20<%page args="java_class, xml_kind" />\ 21 /*@O~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~ 22 * The key entries below this point are generated from metadata 23 * definitions in /system/media/camera/docs. Do not modify by hand or 24 * modify the comment blocks at the start or end. 25 *~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~@~*/ 26 27## 28## Generate a single key and docs 29<%def name="generate_key(entry)">\ 30 /** 31<% 32 # Dedent fixes markdown not to generate code blocks. Then do the rest. 33 description = "" 34 if entry.description: 35 description = dedent(entry.description) + "\n\n" 36 details = "" 37 if entry.details: 38 details = dedent(entry.details) 39 # Unconditionally add extra information if necessary 40 extra_detail = generate_extra_javadoc_detail(entry)("") 41 42 concatenated_info = description + details + extra_detail 43%>\ 44## Glue description and details together before javadoc-izing. Otherwise @see in middle of javadoc. 45## Avoid @see across differently-flagged API entries for now. 46${concatenated_info | javadoc(metadata)}\ 47 % if entry.enum and not (entry.typedef and entry.typedef.languages.get('java')): 48 % for value in entry.enum.values: 49 % if not value.hidden and (value.aconfig_flag == entry.aconfig_flag): 50 * @see #${jenum_value(entry, value)} 51 % endif 52 % endfor 53 % endif 54 % if entry.deprecated: 55 * @deprecated 56${entry.deprecation_description | javadoc(metadata)} 57 % endif 58 % if entry.applied_visibility in ('hidden', 'ndk_public', 'fwk_only', 'extension', 'fwk_system_public'): 59 * @hide 60 % endif 61 */ 62 % if entry.deprecated: 63 @Deprecated 64 % endif 65 % if entry.applied_visibility in ('public', 'java_public', 'fwk_java_public', 'fwk_public'): 66 @PublicKey 67 @NonNull 68 % endif 69 % if entry.applied_visibility == 'fwk_system_public': 70 @SystemApi 71 @NonNull 72 % endif 73 % if entry.synthetic: 74 @SyntheticKey 75 % endif 76 % if entry.applied_visibility in ('extension'): 77 @ExtensionKey 78 % endif 79 % if entry.aconfig_flag: 80 @FlaggedApi(Flags.FLAG_${entry.aconfig_flag | jkey_identifier}) 81 % endif 82 public static final Key<${jtype_boxed(entry)}> ${entry.name | jkey_identifier} = 83 new Key<${jtype_boxed(entry)}>("${entry.name}", ${jkey_type_token(entry)}); 84</%def>\ 85## 86## Generate a list of only Static, Controls, or Dynamic properties. 87<%def name="single_kind_keys(java_name, xml_name)">\ 88% for outer_namespace in metadata.outer_namespaces: ## assumes single 'android' namespace 89 % for section in outer_namespace.sections: 90 % if section.find_first(lambda x: isinstance(x, metadata_model.Entry) and x.kind == xml_name) and \ 91 any_visible(section, xml_name, ('public','hidden','ndk_public','java_public','fwk_only',\ 92 'fwk_java_public','fwk_public','extension','fwk_system_public') ): 93 % for inner_namespace in get_children_by_filtering_kind(section, xml_name, 'namespaces'): 94## 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 95## If we need to support more, we should use a recursive function here instead.. but the indentation gets trickier. 96 % for entry in filter_visibility(inner_namespace.merged_entries, ('hidden','public',\ 97 'ndk_public','java_public','fwk_only','fwk_java_public','fwk_public',\ 98 'extension','fwk_system_public')): 99${generate_key(entry)} 100 % endfor 101 % endfor 102 % for entry in filter_visibility( \ 103 get_children_by_filtering_kind(section, xml_name, 'merged_entries'), \ 104 ('hidden', 'public', 'ndk_public', 'java_public', 'fwk_only', 'fwk_java_public',\ 105 'fwk_public','extension','fwk_system_public')): 106${generate_key(entry)} 107 % endfor 108 % endif 109 % endfor 110% endfor 111</%def>\ 112## 113## Static properties only 114##${single_kind_keys('CameraCharacteristicsKeys', 'static')} 115## 116## Controls properties only 117##${single_kind_keys('CaptureRequestKeys', 'controls')} 118## 119## Dynamic properties only 120##${single_kind_keys('CaptureResultKeys', 'dynamic')} 121${single_kind_keys(java_class, xml_kind)}\ 122