Builder


class Builder
kotlin.Any
   ↳ android.app.appsearch.SchemaVisibilityConfig.Builder

The builder class of SchemaVisibilityConfig.

Summary

Public constructors

Creates a Builder for a SchemaVisibilityConfig.

Public methods
SchemaVisibilityConfig.Builder

Add PackageIdentifier of packages which has access to this schema.

SchemaVisibilityConfig.Builder
addRequiredPermissions(visibleToPermissions: MutableSet<Int!>)

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

SchemaVisibilityConfig

Build a SchemaVisibilityConfig

SchemaVisibilityConfig.Builder

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

SchemaVisibilityConfig.Builder

Clears all required permissions combinations set to this SchemaVisibilityConfig.

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

Builder()

Creates a Builder for a SchemaVisibilityConfig.

Public methods

addAllowedPackage

fun addAllowedPackage(packageIdentifier: PackageIdentifier): SchemaVisibilityConfig.Builder

Add PackageIdentifier of packages which has access to this schema.

Parameters
packageIdentifier PackageIdentifier: This value cannot be null.
Return
SchemaVisibilityConfig.Builder This value cannot be null.

addRequiredPermissions

fun addRequiredPermissions(visibleToPermissions: MutableSet<Int!>): SchemaVisibilityConfig.Builder

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().

Parameters
visibleToPermissions MutableSet<Int!>: This value cannot be null.
Return
SchemaVisibilityConfig.Builder This value cannot be null.

build

fun build(): SchemaVisibilityConfig

Build a SchemaVisibilityConfig

Return
SchemaVisibilityConfig This value cannot be null.

clearAllowedPackages

fun clearAllowedPackages(): SchemaVisibilityConfig.Builder

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

Return
SchemaVisibilityConfig.Builder This value cannot be null.

clearRequiredPermissions

fun clearRequiredPermissions(): SchemaVisibilityConfig.Builder

Clears all required permissions combinations set to this SchemaVisibilityConfig.

Return
SchemaVisibilityConfig.Builder This value cannot be null.

setPubliclyVisibleTargetPackage

fun setPubliclyVisibleTargetPackage(packageIdentifier: PackageIdentifier?): SchemaVisibilityConfig.Builder

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 android.content.pm.PackageManager#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
packageIdentifier PackageIdentifier?: the PackageIdentifier of the package that will be used as the target package in a call to android.content.pm.PackageManager#canPackageQuery to determine which packages can access this publicly visible schema. This value may be null.