GetSchemaResponse.Builder
public final class GetSchemaResponse.Builder
Builder for GetSchemaResponse
objects.
Summary
Public constructors |
---|
Builder() Creates a new |
@ExperimentalAppSearchApi Creates a new |
Public methods |
|
---|---|
@NonNull GetSchemaResponse.Builder |
addSchema(@NonNull AppSearchSchema schema) Adds one |
@NonNull GetSchemaResponse.Builder |
addSchemaTypeNotDisplayedBySystem(@NonNull String schemaType) Sets whether or not documents from the provided |
@NonNull GetSchemaResponse |
build() Builds a |
@NonNull GetSchemaResponse.Builder |
@ExperimentalAppSearchApi 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. |
@NonNull GetSchemaResponse.Builder |
@ExperimentalAppSearchApi Clears the set of required |
@NonNull 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. |
@NonNull GetSchemaResponse.Builder |
Clears the |
@NonNull GetSchemaResponse.Builder |
Clears the set of packages that can read the given schema type. |
@NonNull GetSchemaResponse.Builder |
Clears all |
@NonNull GetSchemaResponse.Builder |
setPubliclyVisibleSchema( Specify that the schema should be publicly available, to packages which already have visibility to |
@NonNull GetSchemaResponse.Builder |
setRequiredPermissionsForSchemaTypeVisibility( Sets a set of required |
@NonNull GetSchemaResponse.Builder |
setSchemaTypeVisibleToConfigs( Sets the documents from the provided |
@NonNull GetSchemaResponse.Builder |
setSchemaTypeVisibleToPackages( Sets whether or not documents from the provided |
@NonNull GetSchemaResponse.Builder |
setVersion(@IntRange(from = 0) int version) Sets the database overall schema version. |
@NonNull GetSchemaResponse.Builder |
setVisibilitySettingSupported(boolean visibilitySettingSupported) Method to set visibility setting. |
Public constructors
Builder
@ExperimentalAppSearchApi
public Builder(@NonNull GetSchemaResponse getSchemaResponse)
Creates a new Builder
from the given GetSchemaResponse
.
Public methods
addSchema
public @NonNull GetSchemaResponse.Builder addSchema(@NonNull AppSearchSchema schema)
Adds one AppSearchSchema
to the schema list.
addSchemaTypeNotDisplayedBySystem
public @NonNull GetSchemaResponse.Builder addSchemaTypeNotDisplayedBySystem(@NonNull String schemaType)
Sets whether or not documents from the provided schemaType
will be displayed and visible on any system UI surface.
Parameters | |
---|---|
@NonNull String schemaType |
The name of an |
build
public @NonNull GetSchemaResponse build()
Builds a GetSchemaResponse
object.
clearPubliclyVisibleSchema
@ExperimentalAppSearchApi
public @NonNull GetSchemaResponse.Builder clearPubliclyVisibleSchema(@NonNull String schemaType)
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.
See also | |
---|---|
setPubliclyVisibleSchema |
clearRequiredPermissionsForSchemaTypeVisibility
@ExperimentalAppSearchApi
public @NonNull GetSchemaResponse.Builder clearRequiredPermissionsForSchemaTypeVisibility(
@NonNull String schemaType
)
Clears the set of required android.Manifest.permission
combinations to read the given schema type.
clearSchemaTypeNotDisplayedBySystem
@ExperimentalAppSearchApi
public @NonNull GetSchemaResponse.Builder clearSchemaTypeNotDisplayedBySystem(@NonNull String schemaType)
Clears the visibility setting for the given schema type that prevents the schema from being displayed and visible on any system UI surface.
See also | |
---|---|
addSchemaTypeNotDisplayedBySystem |
clearSchemaTypeVisibleToConfigs
@ExperimentalAppSearchApi
public @NonNull GetSchemaResponse.Builder clearSchemaTypeVisibleToConfigs(@NonNull String schemaType)
Clears the SchemaVisibilityConfig
s for the given schema type which allow visibility to the schema if the caller matches ALL visibility requirements of ANY SchemaVisibilityConfig
.
See also | |
---|---|
setSchemaTypeVisibleToConfigs |
clearSchemaTypeVisibleToPackages
@ExperimentalAppSearchApi
public @NonNull GetSchemaResponse.Builder clearSchemaTypeVisibleToPackages(@NonNull String schemaType)
Clears the set of packages that can read the given schema type.
See also | |
---|---|
setSchemaTypeVisibleToPackages |
clearSchemas
@ExperimentalAppSearchApi
public @NonNull GetSchemaResponse.Builder clearSchemas()
Clears all AppSearchSchema
s from the list of schemas.
setPubliclyVisibleSchema
public @NonNull GetSchemaResponse.Builder setPubliclyVisibleSchema(
@NonNull String schemaType,
@NonNull PackageIdentifier packageIdentifier
)
Specify that the schema should be publicly available, to packages which already have visibility to packageIdentifier
.
Parameters | |
---|---|
@NonNull String schemaType |
the schema to make publicly accessible. |
@NonNull PackageIdentifier packageIdentifier |
the package from which the document schema is from. |
See also | |
---|---|
setPubliclyVisibleSchema |
setRequiredPermissionsForSchemaTypeVisibility
public @NonNull GetSchemaResponse.Builder setRequiredPermissionsForSchemaTypeVisibility(
@NonNull String schemaType,
@NonNull Set<Set<Integer>> visibleToPermissionSets
)
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.
setSchemaTypeVisibleToConfigs
public @NonNull GetSchemaResponse.Builder setSchemaTypeVisibleToConfigs(
@NonNull String schemaType,
@NonNull Set<SchemaVisibilityConfig> visibleToConfigs
)
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 SchemaVisibilityConfig
s
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 | |
---|---|
@NonNull String schemaType |
The schema type to set visibility on. |
@NonNull Set<SchemaVisibilityConfig> visibleToConfigs |
The |
setSchemaTypeVisibleToPackages
public @NonNull GetSchemaResponse.Builder setSchemaTypeVisibleToPackages(
@NonNull String schemaType,
@NonNull Set<PackageIdentifier> packageIdentifiers
)
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 | |
---|---|
@NonNull String schemaType |
The schema type to set visibility on. |
@NonNull Set<PackageIdentifier> packageIdentifiers |
Represents the package that has access to the given schema type. |
setVersion
public @NonNull GetSchemaResponse.Builder setVersion(@IntRange(from = 0) int version)
Sets the database overall schema version.
Default version is 0
setVisibilitySettingSupported
public @NonNull GetSchemaResponse.Builder setVisibilitySettingSupported(boolean visibilitySettingSupported)
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 | |
---|---|
boolean visibilitySettingSupported |
whether supported |