appop: reimplement OP_RECORD_AUDIO op check in mediaserver

Obtain the real package name for the calling app from the packagemanager binder and
link to client registry. Also block only openRecord and createEffect (which are the
methods used to record audio), and ignore the createTrack that is used also by
legacy audio apps and isn't related to audio recording.

Change-Id: Iedd6022fab1efab47a29da7bd07e922dcdeb294c
Signed-off-by: Jorge Ruesga <jorge@ruesga.com>
Camera: Add Samsung klte camera parameters

Change-Id: I3a30f901befc001a8be6788641226405c6d550ca
Merge "appop: reimplement OP_RECORD_AUDIO op check in mediaserver" into cm-11.0
video: Fix crash during video recording

In pause-resume scenario, MPEG4Writer::start is
called to resume recording, which also resets
start time for writer to -1. If this happens
between two tracks updating the writer start
time, it can end up having the larger of the
start time of the two tracks, which results in
crash later due to assert.

Added change to set mStartTimestampUs to -1 only
when writer is being started, and not resuming from
pause.

CRs-Fixed: 692122
Change-Id: Ia98656acfa3912876d01e92b36c5e06a8c84eb7b
StagefrightRecorder: correct the flow of resuming or stopping from pause

1. resume from pause: start the writer first, to avoid frames dropped by
writer due to writer is not started, which caused mosaic frames.

2. stop from pause:  don't start writer, just start encoders and sources,
to avoid unwanted frames are written into clips when stopping in
paused state.

3. recover the pause(dropping frames) in MPEG4Writer.

Change-Id: I4f8f275bce6ac7bc3d4f31f372cc86b362b6c587
CRs-Fixed: 695750 695745
libstagefright: fix issues in AH263Assembler

- if the received rtp packet belongs to the current
  candidate access unit but arrived later, this packet
  still needs to be inserted into this access unit before
  submitting it. Otherwise this incomplete unit would be
  sent to the decoder and cause some potential errors.

- move the functionality for checking the malformed packet
  and calculating the offset of the payload header to one
  function.

Crs-Fixed: 694476
Change-Id: Ie66524ac4b130c443c12bfb007593e5eb4a24019
frameworks/av: miscellaneous fixes

fixes for the following issues reported by KW

5978, 8879, 8880, 8881, 8882, 8883, 8889, 8890,
8892, 8893, 9200, 9201, 10210, 11223, 11224, 18001,
83677, 84525, 5897

Change-Id: I9bb98a07af97cbfc746b21738dfce7cd9e128c94
libstagefright: poke the udp hole twice for future incoming udp packets

- only firing off udp packets once to the source address or the endpoint
  could still be limited in some NAT network environment. As a result,
  client can't receive rtp packets over udp.

- send udp packets to both of the two addresses if they are available.

Change-Id: I7e8a0b36a82bcd85b307c9c15dcfee2bcd7e6030
rtsp: keep some damaged access unit to enhance fault tolerance

Make RTSPSource to accept some damaged access units of H263 to enhance
fault tolerance. Without this patch, damaged access can cause failure of
playback.

Change-Id: I905648f8b30fefa6ec8de18f943ede87641d7300
CRs-Fixed: 687252
disable camera sounds (3/3)

Change-Id: Iff4eb5ca7dd13038bf852a76d0c605814864497a
Signed-off-by: Jonathan Steadman <xxwhitehawk@gmail.com>
screenrecord: Add audio support

Adds audio recording to the screenrecord system. Note that
while recording, the audio is muted from the device output,
and that the audio volume is controlled separately (so make
sure to turn up your volume if you hear nothing).
Audio from the microphone can also be recorded by adding
--microphone to the command line.

Change-Id: I97dfcaf3d93b786c5466e1f4215549e3d015bcf0
screenrecord: Enable SUBMIX_IN as well and cleanup on exit

While on Nexus 5/Nexus 7 (AOSP QCOM audio), trying to turn on
SUBMIX_IN fails and is not needed, it is required on Find 5
and N1 (CAF QCOM audio), or otherwise SUBMIX_OUT won't turn
on.
We also now release the audio routing as it wouldn't revive
the audio speakers otherwise.

Change-Id: I0f80a232304733e0b0a834b188b8cfa5b88915f3