As listed with AudioPlaybackCapture API here to prevent capture of audio by third party apps and system apps we should
set the capture policy to ALLOW_CAPTURE_BY_NONE.
but system app was able to record audio.
tried add android:allowAudioPlaybackCaputure="false"
but did not solve problem
tried change audio attributes
com.google.android.exoplayer2.audio.AudioAttributes.Builder()
.setAllowedCapturePolicy(ALLOW_CAPTURE_BY_NONE)
.setUsage(USAGE_VOICE_COMMUNICATION)
.build().also {
videoController.player?.audioComponent?.setAudioAttributes(it, true)
}
but did not solve problem
Update 2 works, but must be added after initialize player.