I was able to create a system app to capture the audio of other apps in an Android 10 system using the Android playback capture API. It failed to capture sound of some apps with target SDK of 28 however (it will work once I upgrade those apps to target SDK 29).
It's puzzling because according to the Android official document and also this blog, system app by default should be able to capture the sound of other apps unless it was forbidden by the app intentionally (not in my case).
Thanks to the help from my coworker, my app worked after my
The #2 above is the key that eluded me during my last failed try.