Fix GCC compatibility issues

Replace n with nn for GCC >= 4.7 to avoid collision with variable n in
lexical block within 'for' statement

Change-Id: Ia283b8867fb41df446b703c8d6558ce1d3ee4f02
MtpDevice remove dirty file if readObject fails

Summary:
Imported files(0KB) still exsit when plug bus-power hub with
connected MTP device and UMS after deleted the imported files.

Steps to Reproduce:
1.Plug hub with connected MTP device and UMS to DUT via OTG.
2.Unplug hub from OTG when importing pictures from MTP device.
3.Delete imported files.
4.Plug hub to DUT.

Expected Result:
Impotred files do not display in Gallary and only display MTP and UMS's pictures.

Actual Results:
1.Delete imported files still display in Gallary.
2.Files is 0 size.
3.The numbers of pictures is different from the numbers in Delete imported files sometimes.

Additional Info:
1.Reproducibility (Frequency): 3/5

Solution:
Remove dirty file if readObject fails to read all object data. Else
broken files will leave in filesystem.

Change-Id: I4ec78d4b6d91da9bb1b4e5971f6f5bcb28cdcdd9
Author: Du, Changbin <changbinx.du@intel.com>
Signed-off-by: Bo Huang <bo.b.huang@intel.com>
AudioTrack: Fix tombstone in AudioTrack::processAudioBuffer

This fixes the tombstone in AudioTrack::processAudioBuffer.
We should createTrack_l first and if we succeed, we create
the AudioTrackThread to run.
Otherwise tombstone happens with NULL mAudioTrack and NULL mCblk.

Signed-off-by: Arulselvan M <arulselvan.m@intel.com>
Signed-off-by: Jin Wei <wei.a.jin@intel.com>

Conflicts:
	media/libmedia/AudioTrack.cpp

Change-Id: I1350a1243c78abc63efa1663e289cf389453ac6e
Fix memory leak when filtering commands in insertCommand_l()

When AudioPolicyService::AudioCommandThread::insertCommand_l filters
a command from the queue, the AudioCommand* is removed from the
vector mAudioCommands by calling mAudioCommands.removeAt(). This will
destroy the pointer and compact the vector, but not delete the
AudioCommand object.

This patch adds code to delete a filtered out AudioCommand and its
data object mParam. However, mParam was void* and deleting a void
pointer is undefined behavior according to the C++
standard. Therefore, the data classes are modified to inherit
from an abstract base class with a virtual destructor.

The deletion of non-filtered commands in
AudioPolicyService::AudioCommandThread::threadLoop() was already
correct, as each case casts mParam to the proper type before
deleting.

This also fixes AOSP issue 36370.

Change-Id: I2b63838aff3608132aa496f964a929f78c4b6267
Fixup dupes for enhanced audio

Enhanced AV users will get build breakage in AC3/EAC3 cases

Change-Id: I1cf6b06c6f53a29fe3463b9531a37a194f370cad
Signed-off-by: Peter Carenza <pcarenza@gmail.com>
Merge remote-tracking branch 'th/kitkat' into kitkat