Audio policy / flinger: updates to recording callback and record stop

Do not trigger the callback for recording events when the patch
  handle is NONE, the patch handle will be updated for the
  recording session later.
When stopping recording, only stop the record thread if the
  track is not active, not if it's not the first one.

Test: cts-tradefed run cts-dev -m CtsMediaTestCases -t android.media.cts.AudioRecordingConfigurationTest
Bug: 36569938

Change-Id: I1b7445ef4115d6337ba7b926f7e6b068361926a7
2 files changed