Add a camera metadata structure and utility methods

Change-Id: I320cc33f31ebd8ce183572a447df8fae691eec0d
Improvements to the camera metadata structure

- Add vendor_tag_query_ops_t as argument to methods inside it.

- Add version and flags fields

- Add sorted flag; additions and appends are not sorted, and thus
  reset the flag.

- Add sort method, which sets the sorted flag.

- Add find-by-tag method, which uses a linear search on a non-sorted
  buffer, and a binary search on a sorted buffer.

- Change dump method to take in a fd, like the HAL-level dump methods
  do.

- Minor revisions to tag definitions, including a few enums for
  enumerated-value tags.

Change-Id: I5f37e326519bda032cb3362da4ab3bf50eb98b4e
Make camera metadata tag definitions more robust to mismatches.

Use array assignment-by-index syntax to make sure we match the desired
index to the entry, so it's easier to keep the metadata header and the
info structures in sync.

Change-Id: I06d1ea3d52c651b447cc167cd551e907c8e001ab
Improvements to camera metadata handling.

- Cleaner interface to get/find
- Adds delete entry, an expensive O(n) operation
- Adds update entry, which is O(n) sometimes
- Minor bugfixes:
  - Keep sorted state when appending empty buffers
  - Misspelling of camera_metadata_type_size in header
  - Missing entry in type name array

Bug: 6243944
Change-Id: I316507d6adcc22aff6e7c464c6c484f31ef1510d
Camera: Minor revision to metadata tags, many more enum definitions.

- Remove some tags, adding a few others
- Add enums for all current tags that need them for their values.

Bug: 6243944
Change-Id: I69085eaad68ef39f7047e93570b4591165cca308
Camera: Update to latest metadata definitions

- Revamp resolution information
- Add sizes for shading, geometric correction map
- Add hyperfocal distance
- Add sensor physical size
- Remove unneeded color modes
- Add scene, effect modes
- Add some missing enums for other parameters
  - Facing
  - AF modes
  - Available scene modes

Bug: 6243944
Change-Id: Ia5c9448ef2857f8dd39488810030b4e548711194
Camera: Add opaque user pointer to camera metadata buffer

This is useful for associating a metadata buffer handed off to a third
party with its parent object, when the buffer is returned.

Change-Id: I7e19708bb3adf4da26fc6101e78c276477276608
Camera: Add clone buffer, make type names public

Clone metadata buffer allows for straightforward duplication of
existing buffers; type names are useful for debugging code.

Bug: 6243944
Change-Id: Ibf70f4e3bcf49d6c772bba18a577e2673f2b9213
Camera: Add metadata field ANDROID_JPEG_MAX_SIZE

This is used for communicating how large JPEG buffers must be to the
framework.

Bug: 6243944
Change-Id: Ib296961c4033535cdcd9baf297d440a31cf94d84
Camera: Add LOCKED values for AE/AWB modes.

Bug: 6243944
Change-Id: I52e842d568790e8ac0d9c231507e865aad58601b
Camera: Add indented metadata dump

Bug: 6243944
Change-Id: Ib769ae2d40b9c4bfa456c812fd7ee2e426fd86df
Camera: Update autofocus- and triggering-related metadata fields

- Add trigger IDs for precapture and autofocus to dynamic control
  metadata
- Add enums for AE, AWB, AF algorithm state

Bug: 6243944
Change-Id: I04ce7709a4f1bdbfa39540059dbaf11fadc68f9c
Camera: Add methods for read-only access to metadata.

- Define a read-only version of camera_metadata_entry_t
- Support finding with read-only output
- Add const to clone method input camera_metadata_t.

Bug: 6243944
Change-Id: Icd581e48f5fafaa6da22ca25e872bf3ede192222
Revert "Camera: Add methods for read-only access to metadata."

Needs a third change that's not yet done with review.

This reverts commit ad0c0c836d0276079bf8fe1bfb0bef25d4bce601

Change-Id: Id4325fe93b43a447eded5ae50e8f7faa70fd9140
Camera: Add methods for read-only access to metadata.

- Define a read-only version of camera_metadata_entry_t
- Support finding with read-only output
- Add const to clone method input camera_metadata_t.

Bug: 6243944
Change-Id: I1bf37a4c8c8935711e803d7477393fe2c01f8216
Camera: Add request type and input streams metadata tags.

Bug: 6243944

Change-Id: I6fbf445ac8a6bb9dff916a17c051e7e911dd4a3f
Camera2: Separate AE/AWB locks from AE/AWB modes.

With AE/AWB modes including the LOCKED state, it was not possible for
the HAL to determine the current flash state, or to report fixed AWB
modes properly. Break out the locks into separate controls.

Bug: 6243944
Change-Id: I1b2d844420b8c4e06be32ea644e052f222ed825b
Camera: Add android.jpeg.size field.

When the camera is producing JPEG buffers, need a field to provide the
final buffer size.

Bug: 7108816
Change-Id: I67f27a3c1d69f32541402e516de9fb4b61ffd352
Camera: Add scene mode override and quirks fields.

To provide scene mode override information while preview is disabled,
need more static metadata from the HAL.

In addition, add a quirks section to allow for temporary workarounds
for incomplete HAL behavior. Any quirks added will be deprecated as
soon as possible.

Bug: 7159577
Bug: 7172543
Change-Id: Icadb6baa4132bf20ad82b2c549ac2b9a0c6618de
Camera: Add quirk for metering regions to ignore crop region

If the HAL already takes into account the crop region when
consuming a{ewf}Region or producing face detection rectangles,
then it should set this quirk to 1.

Bug: 7246065
Change-Id: Ib77788b2fced1509d60a7fd1e2a4411e9c8f19dc