On Sony devices up to Android 6, phone conversations were recorded with the MediaRecorder.AudioSource.VOICE_CALL recording source after updating to Android 6, the recording cannot be made from the line. The logs says that you need permission android.permission.CAPTURE_AUDIO_OUTPUT , but it can not be obtained for third-party applications. A message from the logs when trying to record from the line:
[ 05-10 15:33:46.729 375: 4179 E/ ] Request requires android.permission.CAPTURE_AUDIO_OUTPUT This problem can somehow be circumvented. several apps on Google Play did this without using Root rights.
From the logs, I found out that these applications first start recording from the source of the recording MediaRecorder.AudioSource.Mic (from the microphone) and then switch the recording source to MediaRecorder.AudioSource.VOICE_CALL (to the line):
Log message (setting the recording source to Mic):
D/audio_hw_primary: in_set_parameters: enter: kvpairs=input_source=1;routing=-2147483644 The message in the logs (setting the recording source on VOICE_CALL):
D/audio_hw_primary: in_set_parameters: enter: kvpairs=input_source=4;routing=-2147483584;format=1 I assume that they do it with native code. I could not do this using standard methods. I tried to set parameters via AudioManager :
AudioManager aManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); aManager.setParameters("kvpairs=input_source=4;routing=-2147483584;format=1"); but in the logs I see that the function adev_set_parameters is being called and not in_set_parameters :
05-12 11:41:02.462 375-17526/? D/audio_hw_primary: adev_set_parameters: enter: kvpairs=input_source=4;routing=-2147483584;format=1 On the Internet, found the source of this file: https://android.googlesource.com/platform/hardware/qcom/audio/+/7c57a3a8ab8d526c074bcc373e8cba2fa06b4f23/hal/audio_hw.c
I have suggestions how to solve this issue, but I’m not sure: you can add audio_hw.c to the application and use it via NDK (call the function in_set_parameters ).
Original question : https://bitbucket.org/ViktorDegtDev/cvrecorder/issues/1/sony-android-6