GetSchemaResponse.Builder


class GetSchemaResponse.Builder


Builder for GetSchemaResponse objects.

Summary

Public constructors

Creates a new Builder

Creates a new Builder from the given GetSchemaResponse.

Public functions

GetSchemaResponse.Builder

Adds one AppSearchSchema to the schema list.

GetSchemaResponse.Builder

Sets whether or not documents from the provided schemaType will be displayed and visible on any system UI surface.

GetSchemaResponse

Builds a GetSchemaResponse object.

GetSchemaResponse.Builder

Clears the visibility setting that specifies that the given schema type should be publicly available to packages which already have visibility to a specified package.

GetSchemaResponse.Builder

Clears the set of required android.Manifest.permission combinations to read the given schema type.

GetSchemaResponse.Builder

Clears the visibility setting for the given schema type that prevents the schema from being displayed and visible on any system UI surface.

GetSchemaResponse.Builder

Clears the SchemaVisibilityConfigs for the given schema type which allow visibility to the schema if the caller matches ALL visibility requirements of ANY SchemaVisibilityConfig.

GetSchemaResponse.Builder

Clears the set of packages that can read the given schema type.

GetSchemaResponse.Builder

Clears all AppSearchSchemas from the list of schemas.

GetSchemaResponse.Builder
setPubliclyVisibleSchema(
    schemaType: String,
    packageIdentifier: PackageIdentifier
)

Specify that the schema should be publicly available, to packages which already have visibility to packageIdentifier.

GetSchemaResponse.Builder
setRequiredPermissionsForSchemaTypeVisibility(
    schemaType: String,
    visibleToPermissionSets: (Mutable)Set<(Mutable)Set<Int!>!>
)

Sets a set of required android.Manifest.permission combinations to the given schema type.

GetSchemaResponse.Builder
setSchemaTypeVisibleToConfigs(
    schemaType: String,
    visibleToConfigs: (Mutable)Set<SchemaVisibilityConfig!>
)

Sets the documents from the provided schemaType can be read by the caller if they match the ALL visibility requirements set in SchemaVisibilityConfig.

GetSchemaResponse.Builder
setSchemaTypeVisibleToPackages(
    schemaType: String,
    packageIdentifiers: (Mutable)Set<PackageIdentifier!>
)

Sets whether or not documents from the provided schemaType can be read by the specified package.

GetSchemaResponse.Builder
setVersion(version: @IntRange(from = 0) Int)

Sets the database overall schema version.

GetSchemaResponse.Builder
setVisibilitySettingSupported(visibilitySettingSupported: Boolean)

Method to set visibility setting.

Public constructors

Builder

Added in 1.1.0-alpha07
Builder()

Creates a new Builder

Builder

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
Builder(getSchemaResponse: GetSchemaResponse)

Creates a new Builder from the given GetSchemaResponse.

Public functions

addSchema

Added in 1.1.0-alpha07
fun addSchema(schema: AppSearchSchema): GetSchemaResponse.Builder

Adds one AppSearchSchema to the schema list.

addSchemaTypeNotDisplayedBySystem

Added in 1.1.0-alpha07
fun addSchemaTypeNotDisplayedBySystem(schemaType: String): GetSchemaResponse.Builder

Sets whether or not documents from the provided schemaType will be displayed and visible on any system UI surface.

Parameters
schemaType: String

The name of an AppSearchSchema within the same GetSchemaResponse, which won't be displayed by system.

build

Added in 1.1.0-alpha07
fun build(): GetSchemaResponse

Builds a GetSchemaResponse object.

clearPubliclyVisibleSchema

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun clearPubliclyVisibleSchema(schemaType: String): GetSchemaResponse.Builder

Clears the visibility setting that specifies that the given schema type should be publicly available to packages which already have visibility to a specified package.

clearRequiredPermissionsForSchemaTypeVisibility

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun clearRequiredPermissionsForSchemaTypeVisibility(schemaType: String): GetSchemaResponse.Builder

Clears the set of required android.Manifest.permission combinations to read the given schema type.

clearSchemaTypeNotDisplayedBySystem

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun clearSchemaTypeNotDisplayedBySystem(schemaType: String): GetSchemaResponse.Builder

Clears the visibility setting for the given schema type that prevents the schema from being displayed and visible on any system UI surface.

clearSchemaTypeVisibleToConfigs

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun clearSchemaTypeVisibleToConfigs(schemaType: String): GetSchemaResponse.Builder

Clears the SchemaVisibilityConfigs for the given schema type which allow visibility to the schema if the caller matches ALL visibility requirements of ANY SchemaVisibilityConfig.

clearSchemaTypeVisibleToPackages

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun clearSchemaTypeVisibleToPackages(schemaType: String): GetSchemaResponse.Builder

Clears the set of packages that can read the given schema type.

clearSchemas

Added in 1.1.0-alpha07
@ExperimentalAppSearchApi
fun clearSchemas(): GetSchemaResponse.Builder

Clears all AppSearchSchemas from the list of schemas.

setPubliclyVisibleSchema

Added in 1.1.0-alpha07
fun setPubliclyVisibleSchema(
    schemaType: String,
    packageIdentifier: PackageIdentifier
): GetSchemaResponse.Builder

Specify that the schema should be publicly available, to packages which already have visibility to packageIdentifier.

Parameters
schemaType: String

the schema to make publicly accessible.

packageIdentifier: PackageIdentifier

the package from which the document schema is from.

setRequiredPermissionsForSchemaTypeVisibility

Added in 1.1.0-alpha07
fun setRequiredPermissionsForSchemaTypeVisibility(
    schemaType: String,
    visibleToPermissionSets: (Mutable)Set<(Mutable)Set<Int!>!>
): GetSchemaResponse.Builder

Sets a set of required android.Manifest.permission combinations to the given schema type.

The querier could read the GenericDocument objects under the schemaType if they holds ALL required permissions of ANY of the individual value sets.

For example, if the Map contains {{permissionA, PermissionB}, {PermissionC, PermissionD}, {PermissionE}}.

  • A querier holds both PermissionA and PermissionB has access.
  • A querier holds both PermissionC and PermissionD has access.
  • A querier holds only PermissionE has access.
  • A querier holds both PermissionA and PermissionE has access.
  • A querier holds only PermissionA doesn't have access.
  • A querier holds both PermissionA and PermissionC doesn't have access.
Parameters
schemaType: String

The schema type to set visibility on.

visibleToPermissionSets: (Mutable)Set<(Mutable)Set<Int!>!>

The Sets of Android permissions that will be required to access the given schema.

setSchemaTypeVisibleToConfigs

Added in 1.1.0-alpha07
fun setSchemaTypeVisibleToConfigs(
    schemaType: String,
    visibleToConfigs: (Mutable)Set<SchemaVisibilityConfig!>
): GetSchemaResponse.Builder

Sets the documents from the provided schemaType can be read by the caller if they match the ALL visibility requirements set in SchemaVisibilityConfig.

The requirements in a SchemaVisibilityConfig is "AND" relationship. A caller must match ALL requirements to access the schema. For example, a caller must hold required permissions AND it is a specified package.

The querier could have access if they match ALL requirements in ANY of the given SchemaVisibilityConfigs

For example, if the Set contains {{PackageA and Permission1}, {PackageB and Permission2}}.

  • A querier from packageA could read if they holds Permission1.
  • A querier from packageA could NOT read if they only holds Permission2 instead of Permission1.
  • A querier from packageB could read if they holds Permission2.
  • A querier from packageC could never read.
  • A querier holds both PermissionA and PermissionE has access.
Parameters
schemaType: String

The schema type to set visibility on.

visibleToConfigs: (Mutable)Set<SchemaVisibilityConfig!>

The SchemaVisibilityConfigs hold all requirements that a call must to match to access the schema.

setSchemaTypeVisibleToPackages

Added in 1.1.0-alpha07
fun setSchemaTypeVisibleToPackages(
    schemaType: String,
    packageIdentifiers: (Mutable)Set<PackageIdentifier!>
): GetSchemaResponse.Builder

Sets whether or not documents from the provided schemaType can be read by the specified package.

Each package is represented by a PackageIdentifier, containing a package name and a byte array of type CERT_INPUT_SHA256.

To opt into one-way data sharing with another application, the developer will need to explicitly grant the other application’s package name and certificate Read access to its data.

For two-way data sharing, both applications need to explicitly grant Read access to one another.

Parameters
schemaType: String

The schema type to set visibility on.

packageIdentifiers: (Mutable)Set<PackageIdentifier!>

Represents the package that has access to the given schema type.

setVersion

Added in 1.1.0-alpha07
fun setVersion(version: @IntRange(from = 0) Int): GetSchemaResponse.Builder

Sets the database overall schema version.

Default version is 0

setVisibilitySettingSupported

Added in 1.1.0-alpha07
fun setVisibilitySettingSupported(visibilitySettingSupported: Boolean): GetSchemaResponse.Builder

Method to set visibility setting. If this is called with false, getRequiredPermissionsForSchemaTypeVisibility, getSchemaTypesNotDisplayedBySystem}, and getSchemaTypesVisibleToPackages calls will throw an UnsupportedOperationException. If called with true, visibility information for all schemas will be cleared.

Parameters
visibilitySettingSupported: Boolean

whether supported ADD_PERMISSIONS_AND_GET_VISIBILITY by this backend/Android API level.