private void checkPermissions ( String ... permissions ) { if ( sAppPermissions == null ) sAppPermissions = getManifestPermissions ( mSource . getContext ( ) ) ; if ( permissions . length == 0 ) { throw new IllegalArgumentException ( "Please enter at least one permission." ) ; } for ( String p : permissions ) { if ( ! sAppPermissions . contains ( p ) ) { if ( ! ( Permission . ADD_VOICEMAIL . equals ( p ) && sAppPermissions . contains ( Permission . ADD_VOICEMAIL_MANIFEST ) ) ) { throw new IllegalStateException ( String . format ( "The permission %1$s is not registered in manifest.xml" , p ) ) ; } } } }
Check if the permissions are valid and each permission has been registered in manifest . xml . This method will throw a exception if permissions are invalid or there is any permission which is not registered in manifest . xml .