private static boolean allValuesGranted ( Object [ ] values , HashMap < Permission , Result > resultMap ) { if ( values instanceof Permission [ ] ) { Set < Permission > valueSet = new HashSet <> ( Arrays . asList ( ( Permission [ ] ) values ) ) ; if ( resultMap . keySet ( ) . containsAll ( valueSet ) ) { for ( Object value : values ) { if ( Result . GRANTED != resultMap . get ( ( Permission ) value ) ) { mLog . i ( TAG , "denied - " + value . toString ( ) ) ; return false ; } } return true ; } } else if ( values instanceof String [ ] ) { Set < String > valueSet = new HashSet <> ( Arrays . asList ( ( String [ ] ) values ) ) ; Set < String > permission = new HashSet <> ( ) ; for ( Permission perm : resultMap . keySet ( ) ) { permission . add ( perm . toString ( ) ) ; } if ( permission . containsAll ( valueSet ) ) { for ( Object value : values ) { if ( Result . GRANTED != resultMap . get ( Permission . get ( String . valueOf ( value ) ) ) ) { mLog . i ( TAG , "denied - " + value ) ; return false ; } } return true ; } } return false ; }
Check if annotated result permissions contains all values from annotated array . Then it also check if all permissions in annotated method value array are granted .