audio :Close HotWord audio source if it is already opened

- HotWord GTS test tries to record using second instance
  of HotWord Audio Source while one is already active.
  AudioPolicyManagerALSA is not closing the previous audio
  input before starting the second input.
- AudioHardwareALSA::openInputStream rejects opening
  of the second instance of audio input.
- HotWordAudioSource GTS test case fails due to above
  reasons.
- Fix is to enable the code that closes the previous
  input before starting the second audio input.
- Remove the code in openInputStream that is restricting
  the second record client. This is not needed now as it
  is already done in startInput of AudioPolicyManagerALSA

Change-Id: I63cd5061e23bef6c1f7c52cadd65833778e34018
CRs-Fixed: 591788
mm-audio: Fix openmax encoder hang during flush

Flush issued by command thread should unblock the read/write calls
in openmax component.
There is race condition between input/output thread and command
thread in openmax component due to which read/write is not unblocked
which results in a hang.
This change makes command thread to issue multiple flush when it is
wait for ack to avoid a hang.

Change-Id: Ia4486f2e53f56a8413c2115b7f418b29b4bc54c5
CRs-fixed: 466764
Merge "Merge "audio : Mute FM when ringtone is played from settings""
Merge "Merge "Merge "audio : Mute FM when ringtone is played from settings"""
Merge "audio :Close HotWord audio source if it is already opened"
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""
Merge "Merge "Merge "audio :Close HotWord audio source if it is already opened"""
Merge "Merge "audio :Close HotWord audio source if it is already opened""