Search code examples
androidandroid-audiomanager

Android "Permission Failure"


I'm working on a system level app for Android (minSdk=20, targetSdk=22).

I need to grant the android.permission.MODIFY_AUDIO_ROUTING permission, which I add to my manifest. However, at runtime I get an error:

06-30 03:33:45.972 W/ServiceManager(  237): Permission failure: android.permission.MODIFY_AUDIO_ROUTING from uid=10004 pid=15076
06-30 03:33:45.972 E/empty   (  237): android.permission.MODIFY_AUDIO_ROUTING

I tried modifying the permission's android:protectionLevel to use signature|privileged as seen here, but that didn't compile. So I changed it to signatureOrSystem (which is the new API) described here. This builds, but still doesn't work. Is there some other magic I need to get this permission?


Solution

  • You need to reboot the device if you change a system level permission like this.