shadows/framework/src/main/java/org/robolectric/shadows/ShadowDevicePolicyManager.java
public void grantPolicy(@NonNull ComponentName admin, int usesPolicy) {
    enforceActiveAdmin(admin);
    Set<Integer> policyGrantedSet = adminPolicyGrantedMap.get(admin);
    if (policyGrantedSet == null) {
      policyGrantedSet = new HashSet<>();
      policyGrantedSet.add(usesPolicy);
      adminPolicyGrantedMap.put(admin, policyGrantedSet);
    } else {
      policyGrantedSet.add(usesPolicy);
    }
  }
public void grantPolicy(@NonNull ComponentName admin, int usesPolicy) {
    enforceActiveAdmin(admin);
    Set<Integer> policyGrantedSet = adminPolicyGrantedMap.get(admin);
    if (policyGrantedSet == null) {
      policyGrantedSet = new HashSet<>();
      policyGrantedSet.add(usesPolicy);
      adminPolicyGrantedMap.put(admin, policyGrantedSet);
    } else {
      policyGrantedSet.add(usesPolicy);
    }
  }
public void grantPolicy ( @ NonNull ComponentName admin , int usesPolicy ) { enforceActiveAdmin ( admin ) ; Set < Integer > policyGrantedSet = adminPolicyGrantedMap . get ( admin ) ; if ( policyGrantedSet == null ) { policyGrantedSet = new HashSet <> ( ) ; policyGrantedSet . add ( usesPolicy ) ; adminPolicyGrantedMap . put ( admin , policyGrantedSet ) ; } else { policyGrantedSet . add ( usesPolicy ) ; } }
Grants a particular device policy for an active ComponentName.

@param admin the ComponentName which DeviceAdminReceiver this request is associated with. Must
be an active administrator, or an exception will be thrown. This value must never be null.
@param usesPolicy the uses-policy to check
Grants a particular device policy for an active ComponentName .