libstagefright: Fix to handle corrupted .m4a clips

- Some m4a clips with corrupted header causes native crash
  in mediaserver.
- This is due to a wrong sample size which had to read from the clip.
- Fixed this by checking for the sample size extracted from the clip
  against the mediabuffer size.

Change-Id: I0e8694c4860f0d32c5aca14e583be8a654f5a98f
CRs-fixed: 298469
libstagefright: Fix to handle corrupted AAC clips

- AAC decoder was returning SUCCESS by default unless
  the state is changed to ERROR.
- For some cases, where the clip is corrupted, it will
  return SUCCESS even though it has not decoded anything.
- Fixed this by initializing the state to -1.

Change-Id: I6eb8ff3cac75435e355680b4e5fe148348d57a16
CRs-Fixed: 284827, 285631
libstagefright: Redesigning ADIF buffer management

- ADIF buffer management logic is redesigned and will take care of the
  issues mentioned below
- ADIF clips, when put on repeat mode fails to play 2nd time onwards
- This is because same decoder object is used in repeat mode.
  So need to clear all the flags and buffer, that are used to store
  info regarding the temp buffer, after clip plays completely in
  ADIF mode.
- When seek was done on ADIF clips, the progress bar was getting stuck
  after seek. This was happening because seek was not acknowledge after
  it was completed, in case when the clips was not seek-able.
- Some ADTS clips were not playing in repeat mode, the reason was that
  some flags were not been reset once the clip finishes playing.
  Resetting the flags resolves the issue.

CRs-Fixed: 321527
CRs-Fixed: 321708
CRs-Fixed: 321728

Conflicts:

	media/libstagefright/codecs/aacdec/SoftAAC.cpp
	media/libstagefright/codecs/aacdec/SoftAAC.h

Change-Id: I4b1fa11a59c71fba91abb1a9f3cc36fff7e763b8
Properly identify how much metadata we need to cache in order to instantiate

the extractor without blocking (and therefore be able to abort).

related-to-bug: 5666532

Conflicts:

	media/libstagefright/AwesomePlayer.cpp
	media/libstagefright/MPEG4Extractor.cpp
	media/libstagefright/SampleTable.cpp

Change-Id: Id2acdde897e02baaeabadae70b7c95b66c9041b3
frameworks: base: Added CAF copyright.

Change-Id: I66f88f4ffab2463c8870ce5c3c5ce1fcd87de615
SurfaceFlinger: Invalidate HWC Geometry on buffer validity change

HWC layer's flags and properties need to be updated whenever the
properties of the layer change. This change adds support to update
the flag when layer's buffer validity changes.

CRs-Fixed: 334664

Change-Id: Ia785f58c8d89ebd18867c78d93f1733c82694435
(cherry picked from commit 242fc135f91e6967d0a37f6de78e6090643fa35d)
Draft implementation of adding torch as a default lock target
Ifdef Qualcomm camera components in frameworks

Conflicts:

	core/java/android/hardware/Camera.java
	include/camera/CameraParameters.h
	libs/camera/CameraParameters.cpp
	media/jni/android_media_MediaProfiles.cpp
	media/libmedia/MediaProfiles.cpp
Surfaceflinger: Modify setFormat() API to set 3D format.

setFormat() API is modified to accept 3D formats from applications.
This change is required for 3D game usecase so each layer can be
marked as 3D and can be sent to overlay for rendering.

Change-Id: I9266d9ab367c5eccb8fb182f3f517234415a9897
SurfaceTexture: Initialize S3D format member variable to 0

Without initialization mS3DFormat may hold garbage value, and
may corrupt the format calculations in libQcomUI.

This change is done to fix UI corruption.

Change-Id: I55491ce82a49f69eb290bc4a078f7995589335f3
Surfaceflinger: Compose UI in S3D format

The new member of LayerBase takes care of identifying layer for 3d
composition. When 3D composition is required the Layer takes care
of drawing in 3D format

Change-Id: I55c99a3cb612c6dd7a22d346a5b9a88c056c835d
SurfaceFlinger: Skip composition when rotation is not completed

When rotating, each layer's buffer is already changed to
new orientation before SurfaceFlinger gets the signal from
Window Manager. If the orientations of all the buffers are
changed to new orientation, then that's fine. But, sometimes,
only one buffer is changed and others remain the same.
In this case, skip composition.

Change-Id: I850fe8ee6d806e21833e6811f95878fcfb6f7c40
CRs-fixed: 338034
SurfaceFlinger: Prevent screencap command from failure

For secure windows, screen capture fails, and the screencap command
falls back to reading from the framebuffer directly.

Instead, draw a black screen on the framebuffer object if there is a
secure session, so that secure layers cannot be captured.

Change-Id: Ic14ee3f119f622b41f1af3861237204805fb3ca2
CRs-Fixed: 338570
SurfaceFlinger: notify HWC when layer is in asynchronous mode

When the layer is in asynchronous mode the HWC may choose a
different composition method.

CRs-Fixed: 335498
Change-Id: Ifa4658338e98e80e9a673bdf10ae388f0ad3ae9f
libRS: Correct the screen freezing issue

This fixes a timing issue where it could calculate a delay of 0
(indicating wait forever) when it has no pending commands to actually
execute. In such cases, it should just break out of the playback loop.
This also fixes a small issue with returning whether or not to redraw.
(Provided by Stephen Hines <srhines@google.com>)

CRs-Fixed: 330352

Change-Id: If3c880e1546105279d286ae76cc41e8b8f193ec1
SurfaceTextureClient: Add support for external only usage flags.

Add support for GRALLOC_USAGE_EXTERNAL_ONLY and
GRALLOC_USAGE_EXTERNAL_BLOCK to be set as a part of usage flags.
These flags if present will be cached by SurfaceTextureClient.
Incoming usage flags will be ORed with these, if present.

(cherry picked from commit dcbd475319bae2f5d0613bf62d8324169e6ab79d)

Change-Id: I366f6a664805e8944663600dc3b1f82530275873
performance: Add Performance class

New Performance class to allow system CPU control

Change-Id: Ie476aefcec7fc20cab8d747ef7c3994b26fcbb62
Add cpuSetOptions API to org.codeaurora.Performance class

Change-Id: I66f7e910f4fee0a9d443356b00b452872628d3f0
QCOM-related cleanups

* Hide qcom-specific methods from the API
* Disable service classes
* Fix media-recorder start/stop for non-qcoms

Change-Id: I42b1acb5c732182663fea89039f57e775afb3ebe

Conflicts:

	core/java/android/os/Power.java
	media/java/android/media/MediaRecorder.java
	services/java/com/android/server/SystemServer.java
Add customized parameters for qcom camera features.

Squashed commit of the following submissions to CAF:

camera: add custom camera parameters to hardware java file.

Change-Id: Ic2b363df6d25a0c3a49aed30e717d10874f533ae

Camera: Add support for wavelet denoise

Change-Id: I97be72615fe5909987ac430034bbdc16f2d20509

Camera : Add support for histogram in frameworks

Change-Id: Ibf751c3b2d488f4be0afaaa3e994372bafeffbe7

Camera: Add ZSL support in framework.

Change-Id: I4e863020d7d407d9c3936beb83dc7abf385c4654

Camera: Add touch AF/AEC support in ICS framework

In, ICS the old touch AF/AEC functions getTouchIndexAf(),
setTouchIndexAf() etc  are no longer valid. Added new functions  to get
the center of touched area.

Change-Id: I37d00040f895cd8a4de2e2a438971aa2d9c1a045

Camera: Add support for Red eye reduction

Change-Id: Iada280ac33aee8b1114dc40d8d79e0e47ad5c2fd

Conflicts:

	api/current.txt

Camera: Enable streaming texture and YV12 feature

Change-Id: I814c92b469e0f25baef0ce80338761d1e6443085

Camera: Add frameworks support for high frame rate

Change-Id: I9722e9b7e61433651ab5f76f76208853eb1fd849

Camera: Simplify ASD menu and best mode menu.

Change-Id: Ia7a1eca9268eec021a6e2c3f7ce2a932e8819d50

Camera : Macro definition change. PIXEL_FORMAT_YV12 to "yuv420p"

Why: CTS testcase is expecting "yuv420p" as the format string for YV12 mode.

CRs-Fixed: 328252
(cherry picked from commit 0a263f67b75497e4b95b9de8c370ed9496ab59ef)

Change-Id: I66f418a52775a969d81bcb332bbe500370e3ab7c

Camera: Changes for face detection

Change-Id: I7b2172e8690d6e23762e42f5888fecbfda15ba61

Camera: Add support for burst count

Change-Id: I4488a5eac1eebb0b5c8e2cc7cbbe7be0c7301be7

Camera: enable HDR feature

(cherry picked from commit e40770bbdadd925fc1e07a08249a15981b961570)

Change-Id: Ie9ca3066e8e53710bf292d047a3724aefc029854

Camera : Add API to find fullsize liveshot support

Change-Id: I3c2fc3578decbe5cf87fded5362f317df0b40b5e
(cherry picked from commit 65d80f04892776eec1c19c844eacb8c454b4bd1a)

Camera: Set default camera area string

The default invalid value for KEY_FOCUS_AREA and
KEY_METERING_AREA is changed to "(0,0,0,0,0)"
CRs-fixed: 334934

Change-Id: I354802c8611ee5c00a591b96b1a1ca04926969cb

Camera: Change the scenemode names in framework

To comply with ICS API Specification,
SCENE_MODE_AUTO changed to SCENE_MODE_ASD
SCENE_MODE_OFF changed to SCENE_MODE_AUTO

Change-Id: I8e744f10c728f469923b09f69d6d64bc5c7c6850

Camera : Framework changes for camcorder UI menu

Change-Id: Iff9e9021da44b67f81a24c828b960113ee249248

Camera : Remove unwanted video resolution in Framework

- FWVGA, WQVGA resolution UI options are removed for camcorder.

Change-Id: If621140966b01dbc8c30a4d161e6771528b8adda

Camera : Enable FWVGA and WQVGA resolutions in camcorder media profiles

Change-Id: Iad9cc33f7b6d8eb7de21df372c016edeef0b99ba

Unlock camera AWB lock only when white-balance is changed.

bug:5633546
Change-Id: I90bb4b5b445daedf38a64e2f8fb980fc0f0aaa81

Change-Id: Ie3cc15132489502e64321776d49d96846b5705d6

Conflicts:

	core/java/android/hardware/Camera.java
	core/jni/android_hardware_Camera.cpp
	include/camera/CameraParameters.h
	libs/camera/CameraParameters.cpp
	media/libmedia/MediaProfiles.cpp
	services/camera/libcameraservice/CameraService.cpp