Fix voice communication audio playback capture
This change fixes the CTS failure in AudioPlaybackCaptureTest caused by
ag/10111312 and ag/10111311.
It contains the following fixes/changes:
- Capturing of voice communication is only allowed when the caller is
explicitly asking for an attribute match USAGE_VOICE_COMMUNICATION.
If an app adds that match rule, then the permission check for
CAPTURE_VOICE_COMMUNICATION_OUTPUT will take place. For all other
rules (like UID), the caller will receive silenced audio for voice
communication.
- Capture of voice communication will be only allowed for privileged
capture. Hence other then CAPTURE_VOICE_COMMUNUCATION_OUTPUT, the
calling app is also assume to have CAPTURE_MEDIA_OUTPUT.
- Code cleanup, mainly in AudioService.java
This change is accompanied by ag/10242954 on the native side.
Bug: 148559127
Test: Manually
Test: atest PlaybackCaptureTest (with the version prior to ag/10220852)
Test: atest com.google.android.gts.audio.AudioHostTest
Change-Id: I1077db2e0f3c4133fca97d7b461f673bac693676
5 files changed