camera_metadata: add new android.led.transmit and availableLeds fields
Bug: 8554573
Change-Id: Iaa93deeab5ee228bf7e01c58d80f1cdb5b2bb79c
diff --git a/camera/docs/docs.html b/camera/docs/docs.html
index f149184..6fdf265 100644
--- a/camera/docs/docs.html
+++ b/camera/docs/docs.html
@@ -343,6 +343,13 @@
<li><a href="#dynamic_android.tonemap.mode">android.tonemap.mode</a> (dynamic)</li>
</ul>
</li> <!-- toc_section -->
+ <li><p class="toc_section"><a href="#section_led">led</a></p>
+ <ul class="toc_section">
+ <li><a href="#controls_android.led.transmit">android.led.transmit</a> (controls)</li>
+ <li><a href="#dynamic_android.led.transmit">android.led.transmit</a> (dynamic)</li>
+ <li><a href="#static_android.led.availableLeds">android.led.availableLeds</a> (static)</li>
+ </ul>
+ </li> <!-- toc_section -->
</ul>
<h1>Properties</h1>
@@ -9871,6 +9878,233 @@
</tbody>
<!-- end of section -->
+ <tr><td colspan="7" id="section_led" class="section">led</td></tr>
+
+
+ <tr><td colspan="7" class="kind">controls</td></tr>
+
+ <thead>
+ <tr>
+ <th class="th_name">Property Name</th>
+ <th class="th_type">Type</th>
+ <th class="th_description">Description</th>
+ <th class="th_units">Units</th>
+ <th class="th_range">Range</th>
+ <th class="th_notes">Notes</th>
+ <th class="th_tags">Tags</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+
+
+
+
+
+
+
+
+ <tr class="entry" id="controls_android.led.transmit">
+ <td class="entry_name">android.<wbr>led.<wbr>transmit</td>
+ <td class="entry_type">
+ <span class="entry_type_name entry_type_name_enum">byte</span>
+
+
+
+ <ul class="entry_type_enum">
+ <li>
+ <span class="entry_type_enum_name">OFF</span>
+ </li>
+ <li>
+ <span class="entry_type_enum_name">ON</span>
+ </li>
+ </ul>
+
+ </td> <!-- entry_type -->
+
+ <td class="entry_description">
+ This LED is nominally used to indicate to the user
+ that the camera is powered on and may be streaming images back to the
+ Application Processor.<wbr> In certain rare circumstances,<wbr> the OS may
+ disable this when video is processed locally and not transmitted to
+ any untrusted applications.<wbr>
+<br>
+<br> In particular,<wbr> the LED *must* always be on when the data could be
+ transmitted off the device.<wbr> The LED *should* always be on whenever
+ data is stored locally on the device.<wbr>
+<br>
+<br> The LED *may* be off if a trusted application is using the data that
+ doesn't violate the above rules.<wbr>
+
+ </td>
+
+ <td class="entry_units">
+ </td>
+
+ <td class="entry_range">
+ </td>
+
+ <td class="entry_notes">
+ </td>
+
+ <td class="entry_tags">
+ </td>
+
+ </tr> <!-- end of entry -->
+
+
+
+ <!-- end of kind -->
+ </tbody>
+ <tr><td colspan="7" class="kind">dynamic</td></tr>
+
+ <thead>
+ <tr>
+ <th class="th_name">Property Name</th>
+ <th class="th_type">Type</th>
+ <th class="th_description">Description</th>
+ <th class="th_units">Units</th>
+ <th class="th_range">Range</th>
+ <th class="th_notes">Notes</th>
+ <th class="th_tags">Tags</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+
+
+
+
+
+
+
+
+ <tr class="entry" id="dynamic_android.led.transmit">
+ <td class="entry_name">android.<wbr>led.<wbr>transmit</td>
+ <td class="entry_type">
+ <span class="entry_type_name entry_type_name_enum">byte</span>
+
+
+
+ <ul class="entry_type_enum">
+ <li>
+ <span class="entry_type_enum_name">OFF</span>
+ </li>
+ <li>
+ <span class="entry_type_enum_name">ON</span>
+ </li>
+ </ul>
+
+ </td> <!-- entry_type -->
+
+ <td class="entry_description">
+ This LED is nominally used to indicate to the user
+ that the camera is powered on and may be streaming images back to the
+ Application Processor.<wbr> In certain rare circumstances,<wbr> the OS may
+ disable this when video is processed locally and not transmitted to
+ any untrusted applications.<wbr>
+<br>
+<br> In particular,<wbr> the LED *must* always be on when the data could be
+ transmitted off the device.<wbr> The LED *should* always be on whenever
+ data is stored locally on the device.<wbr>
+<br>
+<br> The LED *may* be off if a trusted application is using the data that
+ doesn't violate the above rules.<wbr>
+
+ </td>
+
+ <td class="entry_units">
+ </td>
+
+ <td class="entry_range">
+ </td>
+
+ <td class="entry_notes">
+ </td>
+
+ <td class="entry_tags">
+ </td>
+
+ </tr> <!-- end of entry -->
+
+
+
+ <!-- end of kind -->
+ </tbody>
+ <tr><td colspan="7" class="kind">static</td></tr>
+
+ <thead>
+ <tr>
+ <th class="th_name">Property Name</th>
+ <th class="th_type">Type</th>
+ <th class="th_description">Description</th>
+ <th class="th_units">Units</th>
+ <th class="th_range">Range</th>
+ <th class="th_notes">Notes</th>
+ <th class="th_tags">Tags</th>
+ </tr>
+ </thead>
+
+ <tbody>
+
+
+
+
+
+
+
+
+
+
+ <tr class="entry" id="static_android.led.availableLeds">
+ <td class="entry_name">android.<wbr>led.<wbr>available<wbr>Leds</td>
+ <td class="entry_type">
+ <span class="entry_type_name entry_type_name_enum">byte</span>
+ <span class="entry_type_container">x</span>
+
+ <span class="entry_type_array">
+ n
+ </span>
+
+
+ <ul class="entry_type_enum">
+ <li>
+ <span class="entry_type_enum_name">TRANSMIT</span>
+ <span class="entry_type_enum_notes">android.<wbr>led.<wbr>transmit control is used</span>
+ </li>
+ </ul>
+
+ </td> <!-- entry_type -->
+
+ <td class="entry_description">
+ A list of camera LEDs that are available on this system.<wbr>
+
+ </td>
+
+ <td class="entry_units">
+ </td>
+
+ <td class="entry_range">
+ </td>
+
+ <td class="entry_notes">
+ </td>
+
+ <td class="entry_tags">
+ </td>
+
+ </tr> <!-- end of entry -->
+
+
+
+ <!-- end of kind -->
+ </tbody>
+
+ <!-- end of section -->
<!-- </namespace> -->
</table>
diff --git a/camera/docs/html.mako b/camera/docs/html.mako
index 0baf181..b1b9759 100644
--- a/camera/docs/html.mako
+++ b/camera/docs/html.mako
@@ -73,6 +73,8 @@
</head>
<%!
+ import re
+
# insert word break hints for the browser
def wbr(text):
new_txt = text
@@ -91,6 +93,10 @@
new_txt = new_txt.replace(i, i + "<wbr>")
return new_txt
+
+ # insert line breaks after every two \n\n
+ def br(text):
+ return re.sub(r"(\r?\n)(\r?\n)", r"\1<br>\2<br>", text)
%>
@@ -233,7 +239,7 @@
<td class="entry_description">
% if prop.description is not None:
- ${prop.description | wbr}
+ ${prop.description | wbr, br}
% endif
</td>
@@ -251,7 +257,7 @@
<td class="entry_notes">
% if prop.notes is not None:
- ${prop.notes | wbr}
+ ${prop.notes | wbr, br}
% endif
</td>
diff --git a/camera/docs/metadata-generate b/camera/docs/metadata-generate
index 8e5bf56..59aaff2 100755
--- a/camera/docs/metadata-generate
+++ b/camera/docs/metadata-generate
@@ -48,6 +48,7 @@
}
$thisdir/metadata-check-dependencies || exit 1
+$thisdir/metadata-validate $thisdir/metadata_properties.xml || exit 1
$thisdir/metadata-parser-sanity-check || exit 1
gen_file html.mako docs.html || exit 1
gen_file camera_metadata_tag_info.mako ../src/camera_metadata_tag_info.c || exit 1
diff --git a/camera/docs/metadata_properties.xml b/camera/docs/metadata_properties.xml
index 14d865f..4db5bac 100644
--- a/camera/docs/metadata_properties.xml
+++ b/camera/docs/metadata_properties.xml
@@ -2203,5 +2203,45 @@
</clone>
</dynamic>
</section>
+ <section name="led">
+ <controls>
+ <entry name="transmit" type="byte" enum="true">
+ <enum>
+ <value>OFF</value>
+ <value>ON</value>
+ </enum>
+ <description>This LED is nominally used to indicate to the user
+ that the camera is powered on and may be streaming images back to the
+ Application Processor. In certain rare circumstances, the OS may
+ disable this when video is processed locally and not transmitted to
+ any untrusted applications.
+
+ In particular, the LED *must* always be on when the data could be
+ transmitted off the device. The LED *should* always be on whenever
+ data is stored locally on the device.
+
+ The LED *may* be off if a trusted application is using the data that
+ doesn't violate the above rules.
+ </description>
+ </entry>
+ </controls>
+ <dynamic>
+ <clone entry="android.led.transmit" kind="controls"></clone>
+ </dynamic>
+ <static>
+ <entry name="availableLeds" type="byte" enum="true" container="array">
+ <array>
+ <size>n</size>
+ </array>
+ <enum>
+ <value>TRANSMIT
+ <notes>android.led.transmit control is used</notes>
+ </value>
+ </enum>
+ <description>A list of camera LEDs that are available on this system.
+ </description>
+ </entry>
+ </static>
+ </section>
</namespace>
</metadata>
diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h
index 47968e3..8d5cdf4 100644
--- a/camera/include/system/camera_metadata_tags.h
+++ b/camera/include/system/camera_metadata_tags.h
@@ -57,6 +57,7 @@
ANDROID_STATISTICS,
ANDROID_STATISTICS_INFO,
ANDROID_TONEMAP,
+ ANDROID_LED,
ANDROID_SECTION_COUNT,
VENDOR_SECTION = 0x8000
@@ -89,6 +90,7 @@
ANDROID_STATISTICS_START = ANDROID_STATISTICS << 16,
ANDROID_STATISTICS_INFO_START = ANDROID_STATISTICS_INFO << 16,
ANDROID_TONEMAP_START = ANDROID_TONEMAP << 16,
+ ANDROID_LED_START = ANDROID_LED << 16,
VENDOR_SECTION_START = VENDOR_SECTION << 16
} camera_metadata_section_start_t;
@@ -301,6 +303,10 @@
ANDROID_TONEMAP_MAX_CURVE_POINTS,
ANDROID_TONEMAP_END,
+ ANDROID_LED_TRANSMIT = ANDROID_LED_START,
+ ANDROID_LED_AVAILABLE_LEDS,
+ ANDROID_LED_END,
+
} camera_metadata_tag_t;
/**
@@ -637,3 +643,15 @@
} camera_metadata_enum_android_tonemap_mode_t;
+// ANDROID_LED_TRANSMIT
+typedef enum camera_metadata_enum_android_led_transmit {
+ ANDROID_LED_TRANSMIT_OFF,
+ ANDROID_LED_TRANSMIT_ON,
+} camera_metadata_enum_android_led_transmit_t;
+
+// ANDROID_LED_AVAILABLE_LEDS
+typedef enum camera_metadata_enum_android_led_available_leds {
+ ANDROID_LED_AVAILABLE_LEDS_TRANSMIT,
+} camera_metadata_enum_android_led_available_leds_t;
+
+
diff --git a/camera/src/camera_metadata_tag_info.c b/camera/src/camera_metadata_tag_info.c
index 6a4e0e6..c547dfb 100644
--- a/camera/src/camera_metadata_tag_info.c
+++ b/camera/src/camera_metadata_tag_info.c
@@ -53,6 +53,7 @@
[ANDROID_STATISTICS] = "android.statistics",
[ANDROID_STATISTICS_INFO] = "android.statistics.info",
[ANDROID_TONEMAP] = "android.tonemap",
+ [ANDROID_LED] = "android.led",
};
unsigned int camera_metadata_section_bounds[ANDROID_SECTION_COUNT][2] = {
@@ -100,6 +101,8 @@
ANDROID_STATISTICS_INFO_END },
[ANDROID_TONEMAP] = { ANDROID_TONEMAP_START,
ANDROID_TONEMAP_END },
+ [ANDROID_LED] = { ANDROID_LED_START,
+ ANDROID_LED_END },
};
static tag_info_t android_color_correction[ANDROID_COLOR_CORRECTION_END -
@@ -504,6 +507,14 @@
{ "maxCurvePoints", TYPE_INT32 },
};
+static tag_info_t android_led[ANDROID_LED_END -
+ ANDROID_LED_START] = {
+ [ ANDROID_LED_TRANSMIT - ANDROID_LED_START ] =
+ { "transmit", TYPE_BYTE },
+ [ ANDROID_LED_AVAILABLE_LEDS - ANDROID_LED_START ] =
+ { "availableLeds", TYPE_BYTE },
+};
+
tag_info_t *tag_info[ANDROID_SECTION_COUNT] = {
android_color_correction,
@@ -528,6 +539,7 @@
android_statistics,
android_statistics_info,
android_tonemap,
+ android_led,
};
int camera_metadata_enum_snprint(uint32_t tag,
@@ -1804,6 +1816,33 @@
break;
}
+ case ANDROID_LED_TRANSMIT: {
+ switch (value) {
+ case ANDROID_LED_TRANSMIT_OFF:
+ msg = "OFF";
+ ret = 0;
+ break;
+ case ANDROID_LED_TRANSMIT_ON:
+ msg = "ON";
+ ret = 0;
+ break;
+ default:
+ msg = "error: enum value out of range";
+ }
+ break;
+ }
+ case ANDROID_LED_AVAILABLE_LEDS: {
+ switch (value) {
+ case ANDROID_LED_AVAILABLE_LEDS_TRANSMIT:
+ msg = "TRANSMIT";
+ ret = 0;
+ break;
+ default:
+ msg = "error: enum value out of range";
+ }
+ break;
+ }
+
}
strncpy(dst, msg, size - 1);