audio: Force route call on HAL during device disconnection

- When a wired accessory is connected/disconnected,
  setDeviceConnectionState updates the current device
  only for active outputs and also makes the corresponding
  route call on Audio HAL when the current device is not
  same as the previous device for the active outputs. As
  inactive outputs are not updated in this case, sometimes
  audio policy fails to notify device change to HAL.
  Specific scenario is mentioned below

- If headset is inserted when touch tones are disabled
  and music is in progress, LPA/tunnelled output is updated
  with headset as its current device and also respective
  route call is made on audio HAL. But low latency output
  still has speaker as its current device because it is not
  active. Later, if music is paused and headset is removed,
  setOutputDevice does not make route call on Audio HAL
  when touch tones are played. This is because the current
  device and previous device are same(speaker) for low
  latency output. So Audio HAL tries to play the touch tone
  on headset when headset is not connected.

- Fix is to force route call on HAL after every device
  disconnection irrespective of current and previous device
  being same for the specific output

Change-Id: I80d799718c980d0422d4e5f7015fcf16f001fda9
CRs-Fixed: 627903
audio: Close the file descriptor in error scenarios

 -In the scenario where the USB headset and proxy device
  sample rate dont match, error was returned without
  closing the file descriptor .So, the next time USB
  headset is inserted , the /proc entries are not created
  which results in the USB headset playback not started
  as the capabilities cannot be read.
 - Closing the file descriptor in the error scenario fixes
  the issue.

Change-Id: Ie45327f04cc7fff6dbcbe1268a7f34793e89641b
audio/msm7630: Introduce LowPowerAudio.

Change-Id: I77cadf3c028bc9dead0b0887c308f7394d4b14f2
audio/msm7630: Add support for audio effects for LPA clips

Add support for audio effects for LPA clips on msm7630

(cherry picked from commit 176dd4c4f0a926fd463cf2d4cf1051327a75598b)

Conflicts:

	msm7630/AudioHardware.cpp

Change-Id: Ibfa9376dae14bc772fa0cb90e2bae3309a684fc8
7x30 : Port heap mask change to ion

-mp3 clips fails to play intermittently.
-ION fails to register with the driver.
-Heap mask field passes as argument at allocation
time to specify ion heap.

CRs-Fixed: 444197

Change-Id: I35b7f162c906b856b7b4f5ee2270cd10256144bf
msm7x30: Add missing get_supported_devices in HW HAL

Change-Id: Idb90528899ae3d5a6d037f1af0544225faa02cc6
msm7x30: Fix routing for all AudioSessionOut types

 * Pass the new output device around so that we're not always just using
   the one in the base class. This was preventing proper routing for
   all output streams.

Change-Id: I07a6bf4cf15c7b6bea310c2cd593ca494a89ca5f
audio/msm7630: Add latency support for LPA

-Audio loss for few seconds on headset connection.
-Stream is unmute in checkDeviceMuteStrategies before device switch
occurs.
-Increase delay in tempMute to ensure unmuting happens after device
switch happens. Also change latency for LPA to correct value similar
to that of hpcm.

Change-Id: I539a4726f6b9d53bbfdc5f92a8801d5f14c360eb
CRs-Fixed: 448355
audio/msm7630 : Stability issue with LPA play back.

- ANR is observed during LPA playback when there is song switch for
  every few seconds
- The song switch does not happen when the song is played till the end
- Native crashes are observed during rapid seek, next and previous
  song switch operations. There is some race condition between write and
  flush which results in adding a buffer multiple times to empty queue.
  This tries to free the buffer multiple times during reset and results
  in native crash. Fix this issue by adding proper mutex in write and
  flush calls which synchronizes these operations and avoids crashes.
  After Pausetimeout, reset is called due to which EOS is posted
  to observer. This results in start or reset operation on a closed
  sink leading to crashes. Avoid posting EOS if reset is already
  called.

Change-Id: Ie171d86f39fc4484710002c4940496dc90fbb05a
CRs-Fixed: 463272
msm7x30: Update device API

Change-Id: I15bd511c3b753dc4ce076a482095e675f601c1ec
msm7x30: Fixup ifdefs so LPA playback works

Change-Id: Ia389f2c3905ba5062933912150b856e3464c2e13
Revert "msm7x30: Update device API"

 * Causes some routing issues, for example when using GEL
   and listening to music via headset, audio is routed to
   speaker when jumping to home screen from Apollo. Probably
   missing some additional changes, so revert this for now.

This reverts commit 75afa6a8a1a928f861280b640222f35e64929995.
msm7x30: Various routing fixes ported from msm8660

Change-Id: I1ef642bb565b8d4dd729800f976770da84ae6b79