AudioService: hearing aid volume updates for voice vs media

Fix interactions between hearing aid volume control and Sound
Settings and Slice UIs with the following changes:

  When receiving volume change, only change the hearing aid volume
if the device is hearing aid and the stream type to change matches
the stream type returned by AudioService.getHearingAidStreamType().

  Modify AudioService.getHearingAidStreamType() to rely on the
audio mode OR the activity of the VOICE_COMMUNICATION* usage.

  Add a listener of audio playback activity to monitor the start
and end of the use of VOICE_COMMUNICATION* to reset the hearing
aid volume to that of media.
Do this only when HEARING_AID device is connected: register/unregister
callback for playback activity according to hearing aid connections.

Bug: 129163231
Test: use Sound Settings UI to control voice vol outside of call, verify
volume is unchanged when listening to media later.

Change-Id: I7af9554d04139e1a3929efa53cdcb04e37878571
2 files changed