You can revoke permission from the ADB command line. if you decide to write a shell script and do it all programmatically, then YES, otherwise NO
Permits for Issuance and Cancellation
You can use the new ADB package manager (pm) commands to grant and revoke permissions to the installed application. This feature may be useful for automated testing.
To grant permission, use the grant manager command of the package manager:
$ adb shell pm grant <package_name> <permission_name>
For example, to grant permission to the com.example.myapp package to record sound, use the following command:
$ adb shell pm grant com.example.myapp android.permission.RECORD_AUDIO
To revoke permission, use the package manager revocation command:
$ adb shell pm revoke <package_name> <permission_name>
source share