Search code examples
androidandroid-permissionsroot

Is there anyway to grant my app the READ_VOICEMAIL permission on a rooted phone?


I have an app that needs to be able to read all the voicemail on the device, which requires the com.android.voicemail.permission.READ_VOICEMAIL permission. It's a system-level permission, and I can't figure out a way to grant that permission to my app.

I already had my app successfully get root access, and I can run commands as "su", but when I try to run pm grant com.my.app com.android.voicemail.permission.READ_VOICEMAIL, I still get an error. Is there anyway to get this done?

Alternatively, I know that moving my app to the /system/priv-app/MyApp/MyApp.apk should solve this problem, but I'm having issues doing that on Android 13. I tried doing it on LineageOS 20, and after rebooting, it would boot-loop (until I started in Recovery, and manually deleted the APK from the system partition). There used to be a Magisk module called App Systemizer that would do this cleanly, but it's my understanding that it no longer works on Android 12 or 13


Solution

  • I still don't know how to do this using any root commands, but I figured out how to properly move my app to /system/priv-app, which automatically gives it all system permissions.

    In addition to just moving the APK there, you need to also create a permissions file with your app package name in /system/etc/permissions. Here's an example of my com.my.app.xml:

    <?xml version="1.0" encoding="utf-8"?>
    <permissions>
        <privapp-permissions package="com.my.app">
            <permission name="com.android.voicemail.permission.ADD_VOICEMAIL"/>
            <permission name="com.android.voicemail.permission.READ_VOICEMAIL"/>
            <permission name="com.android.voicemail.permission.WRITE_VOICEMAIL"/>
        </privapp-permissions>
    </permissions>