SchemaVisibilityConfig.Builder

public static final class SchemaVisibilityConfig.Builder extends Object

The builder class of SchemaVisibilityConfig.

Public Constructor Summary

Public Method Summary

SchemaVisibilityConfig.Builder
addAllowedPackage(PackageIdentifier packageIdentifier)
Add PackageIdentifier of packages which has access to this schema.
SchemaVisibilityConfig.Builder
addRequiredPermissions(Set<Integer> visibleToPermissions)
Adds a set of required Android Manifest.permission combination a package needs to hold to access the schema this SchemaVisibilityConfig represents.
SchemaVisibilityConfig
SchemaVisibilityConfig.Builder
clearAllowedPackages()
Clears the list of packages which have access to this schema.
SchemaVisibilityConfig.Builder
clearRequiredPermissions()
Clears all required permissions combinations set to this SchemaVisibilityConfig.
SchemaVisibilityConfig.Builder
setPubliclyVisibleTargetPackage(PackageIdentifier packageIdentifier)
Specify that this schema should be publicly available, to the same packages that have visibility to the package passed as a parameter.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public SchemaVisibilityConfig.Builder addAllowedPackage (PackageIdentifier packageIdentifier)

Add PackageIdentifier of packages which has access to this schema.

public SchemaVisibilityConfig.Builder addRequiredPermissions (Set<Integer> visibleToPermissions)

Adds a set of required Android Manifest.permission combination a package needs to hold to access the schema this SchemaVisibilityConfig represents.

If the querier holds ALL of the required permissions in this combination, they will have access to read GenericDocument objects of the given schema type.

You can call this method repeatedly to add multiple permission combinations, and the querier will have access if they holds ANY of the combinations.

Merged Set available from SchemaVisibilityConfig.getRequiredPermissions().

public SchemaVisibilityConfig.Builder clearAllowedPackages ()

Clears the list of packages which have access to this schema.

public SchemaVisibilityConfig.Builder clearRequiredPermissions ()

Clears all required permissions combinations set to this SchemaVisibilityConfig.

public SchemaVisibilityConfig.Builder setPubliclyVisibleTargetPackage (PackageIdentifier packageIdentifier)

Specify that this schema should be publicly available, to the same packages that have visibility to the package passed as a parameter. This visibility is determined by the result of PackageManager.canPackageQuery(String, String).

It is possible for the packageIdentifier parameter to be different from the package performing the indexing. This might happen in the case of an on-device indexer processing information about various packages. The visibility will be the same regardless of which package indexes the document, as the visibility is based on the packageIdentifier parameter.

Calling this with packageIdentifier set to null is valid, and will remove public visibility for the schema.

Parameters
packageIdentifier the PackageIdentifier of the package that will be used as the target package in a call to PackageManager.canPackageQuery(String, String) to determine which packages can access this publicly visible schema.