I want to detect which application is using the microphone.
Suppose two applications have access to the microphone. For an application to use the microphone, it should have android.permission.RECORD_AUDIO.
With the lsof command, we can detect the microphone is being used, but not the application name that is using it. So we can list down all the currently running applications, then we can check which application has android.permission.RECORD_AUDIO permission, but here is the problem:
Suppose we have two applications named "A" and "B". A can only record voice while B has an option to record voice and maintain network status. As both can record voice, both will have android.permission.RECORD_AUDIO permission. So we can know that both A and B can use the mic, but at present, which one is using the mic? How can I avoid such confusion?