androidaudio-recordingplayback

Policy of AudioPlaybackCapture API not work


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.

Update 1

tried add android:allowAudioPlaybackCaputure="false" but did not solve problem

Update 2

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


Solution

  • Update 2 works, but must be added after initialize player.