SchemaVisibilityConfig.Builder


public static final class SchemaVisibilityConfig.Builder
extends Object

java.lang.Object
   ↳ android.app.appsearch.SchemaVisibilityConfig.Builder


The builder class of SchemaVisibilityConfig.

Summary

Public constructors

Builder()

Creates a Builder for a SchemaVisibilityConfig.

Public methods

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

Build a 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 methods

Public constructors

Builder

Added in API level 35
public Builder ()

Creates a Builder for a SchemaVisibilityConfig.

Public methods

addAllowedPackage

Added in API level 35
public SchemaVisibilityConfig.Builder addAllowedPackage (PackageIdentifier packageIdentifier)

Add PackageIdentifier of packages which has access to this schema.

Parameters
packageIdentifier PackageIdentifier: This value cannot be null.

Returns
SchemaVisibilityConfig.Builder This value cannot be null.

addRequiredPermissions

Added in API level 35
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().

Parameters
visibleToPermissions Set: This value cannot be null.

Returns
SchemaVisibilityConfig.Builder This value cannot be null.

build

Added in API level 35
public SchemaVisibilityConfig build ()

Build a SchemaVisibilityConfig

Returns
SchemaVisibilityConfig This value cannot be null.

clearAllowedPackages

Added in API level 35
public SchemaVisibilityConfig.Builder clearAllowedPackages ()

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

Returns
SchemaVisibilityConfig.Builder This value cannot be null.

clearRequiredPermissions

Added in API level 35
public SchemaVisibilityConfig.Builder clearRequiredPermissions ()

Clears all required permissions combinations set to this SchemaVisibilityConfig.

Returns
SchemaVisibilityConfig.Builder This value cannot be null.

setPubliclyVisibleTargetPackage

Added in API level 35
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 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. This value may be null.

Returns
SchemaVisibilityConfig.Builder