This method of the PermissionUtils Class compares two sets of flags that represent inclusive access to resources. The flags to be compared are selected by a bitmask and are compared as a unit. A clear flag means that access to resources can be granted; a set flag means that more resources will be granted. Typically, this comparator is only used when the possession of the permission itself has meaning, because it becomes impossible to determine DISJOINT or EMPTY permissions after use of this comparator.
public static int compareInclusiveFlags(int flags1, int flags2, int mask, int prevcmp);
Returns a new comparison result, merged with the previous comparison result using mergeComparisonResults.
flags1 & mask | flags2 & mask | Result before merging |
nonzero | nonzero | SetComparison.EQUAL |
nonzero | zero | SetComparison.SUPERSET |
zero | nonzero | SetComparison.SUBSET |
zero | zero | SetComparison.EQUAL |
flags1 | The flags that specify the type of access to the resource in the first permission. If bits are clear, access to the resource is not denied; if bits are set, more privileged access to the resource is granted. |
flags2 | The flags that specify the type of access to the resource in the second permission. If bits are clear, access to the resource is not denied; if bits are set, more privileged access to the resource is granted. |
mask | A bitmask that is combined with the flags (using the logical AND operator (&)) to determine which resources to compare as a unit. |
prevcmp | A previous comparison result for other resources of the permissions. For the first resource of a permission, this is typically SetComparison.EMPTY. |