From c469f7dc234ec0b901440902cd6e39acaf9b0781 Mon Sep 17 00:00:00 2001 From: Igor Murashkin Date: Tue, 23 Apr 2013 14:31:02 -0700 Subject: camera_metadata: add new android.led.transmit and availableLeds fields Bug: 8554573 Change-Id: Iaa93deeab5ee228bf7e01c58d80f1cdb5b2bb79c --- camera/docs/docs.html | 234 +++++++++++++++++++++++++++ camera/docs/html.mako | 10 +- camera/docs/metadata-generate | 1 + camera/docs/metadata_properties.xml | 40 +++++ camera/include/system/camera_metadata_tags.h | 18 +++ camera/src/camera_metadata_tag_info.c | 39 +++++ 6 files changed, 340 insertions(+), 2 deletions(-) diff --git a/camera/docs/docs.html b/camera/docs/docs.html index f149184f..6fdf265c 100644 --- a/camera/docs/docs.html +++ b/camera/docs/docs.html @@ -343,6 +343,13 @@
  • android.tonemap.mode (dynamic)
  • +
  • led

    + +
  • Properties

    @@ -9867,6 +9874,233 @@ + + + + + led + + + controls + + + + Property Name + Type + Description + Units + Range + Notes + Tags + + + + + + + + + + + + + + + + android.led.transmit + + byte + + + + + + + + + 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. + + + + + + + + + + + + + + + + + + + + + + dynamic + + + + Property Name + Type + Description + Units + Range + Notes + Tags + + + + + + + + + + + + + + + + android.led.transmit + + byte + + + + + + + + + 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. + + + + + + + + + + + + + + + + + + + + + + static + + + + Property Name + Type + Description + Units + Range + Notes + Tags + + + + + + + + + + + + + + + + android.led.availableLeds + + byte + x + + + n + + + + + + + + + A list of camera LEDs that are available on this system. + + + + + + + + + + + + + + + + + + + diff --git a/camera/docs/html.mako b/camera/docs/html.mako index 0baf1813..b1b97597 100644 --- a/camera/docs/html.mako +++ b/camera/docs/html.mako @@ -73,6 +73,8 @@ <%! + 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 + "") return new_txt + + # insert line breaks after every two \n\n + def br(text): + return re.sub(r"(\r?\n)(\r?\n)", r"\1
    \2
    ", text) %> @@ -233,7 +239,7 @@ % if prop.description is not None: - ${prop.description | wbr} + ${prop.description | wbr, br} % endif @@ -251,7 +257,7 @@ % if prop.notes is not None: - ${prop.notes | wbr} + ${prop.notes | wbr, br} % endif diff --git a/camera/docs/metadata-generate b/camera/docs/metadata-generate index 8e5bf56f..59aaff28 100755 --- a/camera/docs/metadata-generate +++ b/camera/docs/metadata-generate @@ -48,6 +48,7 @@ function gen_file() { } $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 14d865f0..4db5bac2 100644 --- a/camera/docs/metadata_properties.xml +++ b/camera/docs/metadata_properties.xml @@ -2203,5 +2203,45 @@ xsi:schemaLocation="http://schemas.android.com/service/camera/metadata/ metadata +
    + + + + OFF + ON + + 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. + + + + + + + + + + n + + + TRANSMIT + android.led.transmit control is used + + + A list of camera LEDs that are available on this system. + + + +
    diff --git a/camera/include/system/camera_metadata_tags.h b/camera/include/system/camera_metadata_tags.h index 47968e38..8d5cdf40 100644 --- a/camera/include/system/camera_metadata_tags.h +++ b/camera/include/system/camera_metadata_tags.h @@ -57,6 +57,7 @@ typedef enum camera_metadata_section { ANDROID_STATISTICS, ANDROID_STATISTICS_INFO, ANDROID_TONEMAP, + ANDROID_LED, ANDROID_SECTION_COUNT, VENDOR_SECTION = 0x8000 @@ -89,6 +90,7 @@ typedef enum camera_metadata_section_start { 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 @@ typedef enum camera_metadata_tag { 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 @@ typedef enum camera_metadata_enum_android_tonemap_mode { } 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 6a4e0e6a..c547dfb7 100644 --- a/camera/src/camera_metadata_tag_info.c +++ b/camera/src/camera_metadata_tag_info.c @@ -53,6 +53,7 @@ const char *camera_metadata_section_names[ANDROID_SECTION_COUNT] = { [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 @@ unsigned int camera_metadata_section_bounds[ANDROID_SECTION_COUNT][2] = { 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 @@ static tag_info_t android_tonemap[ANDROID_TONEMAP_END - { "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 @@ tag_info_t *tag_info[ANDROID_SECTION_COUNT] = { android_statistics, android_statistics_info, android_tonemap, + android_led, }; int camera_metadata_enum_snprint(uint32_t tag, @@ -1804,6 +1816,33 @@ int camera_metadata_enum_snprint(uint32_t tag, 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); -- cgit v1.2.3