SchemaVisibilityConfig.Builder


public final class SchemaVisibilityConfig.Builder


The builder class of SchemaVisibilityConfig.

Summary

Public constructors

Creates a Builder for a SchemaVisibilityConfig.

Public methods

@NonNull SchemaVisibilityConfig.Builder

Add PackageIdentifier of packages which has access to this schema.

@NonNull SchemaVisibilityConfig.Builder
addRequiredPermissions(@NonNull Set<Integer> visibleToPermissions)

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

@NonNull SchemaVisibilityConfig

Build a SchemaVisibilityConfig

@NonNull SchemaVisibilityConfig.Builder

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

@NonNull SchemaVisibilityConfig.Builder

Clears all required permissions combinations set to this SchemaVisibilityConfig.

@NonNull SchemaVisibilityConfig.Builder

Specify that this schema should be publicly available, to the same packages that have visibility to the package passed as a parameter.

Public constructors

Builder

Added in 1.1.0-alpha06
public Builder()

Creates a Builder for a SchemaVisibilityConfig.

Public methods

addAllowedPackage

Added in 1.1.0-alpha06
public @NonNull SchemaVisibilityConfig.Builder addAllowedPackage(@NonNull PackageIdentifier packageIdentifier)

Add PackageIdentifier of packages which has access to this schema.

addRequiredPermissions

Added in 1.1.0-alpha06
public @NonNull SchemaVisibilityConfig.Builder addRequiredPermissions(@NonNull Set<Integer> visibleToPermissions)

Adds a set of required Android 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 getRequiredPermissions.

See also
addRequiredPermissionsForSchemaTypeVisibility

for supported Permissions.

clearAllowedPackages

Added in 1.1.0-alpha06
public @NonNull SchemaVisibilityConfig.Builder clearAllowedPackages()

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

clearRequiredPermissions

Added in 1.1.0-alpha06
public @NonNull SchemaVisibilityConfig.Builder clearRequiredPermissions()

Clears all required permissions combinations set to this SchemaVisibilityConfig.

setPubliclyVisibleTargetPackage

Added in 1.1.0-alpha06
public @NonNull SchemaVisibilityConfig.Builder setPubliclyVisibleTargetPackage(
    @Nullable 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 canPackageQuery.

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
@Nullable PackageIdentifier packageIdentifier

the PackageIdentifier of the package that will be used as the target package in a call to canPackageQuery to determine which packages can access this publicly visible schema.