SetSchemaRequest
public
final
class
SetSchemaRequest
extends Object
java.lang.Object | |
↳ | android.app.appsearch.SetSchemaRequest |
Encapsulates a request to update the schema of an AppSearchSession
database.
The schema is composed of a collection of AppSearchSchema
objects, each of which
defines a unique type of data.
The first call to SetSchemaRequest will set the provided schema and store it within the AppSearchSession
database.
Subsequent calls will compare the provided schema to the previously saved schema, to determine how to treat existing documents.
The following types of schema modifications are always safe and are made without deleting any existing documents:
- Addition of new
AppSearchSchema
types - Addition of new properties to an existing
AppSearchSchema
type - Changing the cardinality of a property to be less restrictive
The following types of schema changes are not backwards compatible:
- Removal of an existing
AppSearchSchema
type - Removal of a property from an existing
AppSearchSchema
type - Changing the data type of an existing property
- Changing the cardinality of a property to be more restrictive
Providing a schema with incompatible changes, will throw an AppSearchException
, with a message describing the
incompatibility. As a result, the previously set schema will remain unchanged.
Backward incompatible changes can be made by :
- setting
SetSchemaRequest.Builder.setForceOverride
method totrue
. This deletes all documents that are incompatible with the new schema. The new schema is then saved and persisted to disk. - Add a
Migrator
for each incompatible type and make no deletion. The migrator will migrate documents from its old schema version to the new version. Migrated types will be set into bothSetSchemaResponse.getIncompatibleTypes()
andSetSchemaResponse.getMigratedTypes()
. See the migration section below.
Summary
Nested classes | |
---|---|
class |
SetSchemaRequest.Builder
Builder for |
Public methods | |
---|---|
Map<String, Migrator>
|
getMigrators()
Returns the map of |
Map<String, PackageIdentifier>
|
getPubliclyVisibleSchemas()
Returns a mapping of publicly visible schemas to the |
Map<String, Set<Set<Integer>>>
|
getRequiredPermissionsForSchemaTypeVisibility()
Returns a mapping of schema types to the Map of |
Set<AppSearchSchema>
|
getSchemas()
Returns the |
Set<String>
|
getSchemasNotDisplayedBySystem()
Returns all the schema types that are opted out of being displayed and visible on any system UI surface. |
Map<String, Set<SchemaVisibilityConfig>>
|
getSchemasVisibleToConfigs()
Returns a mapping of schema types to the set of |
Map<String, Set<PackageIdentifier>>
|
getSchemasVisibleToPackages()
Returns a mapping of schema types to the set of packages that have access to that schema type. |
int
|
getVersion()
Returns the database overall schema version. |
boolean
|
isForceOverride()
Returns whether this request will force the schema to be overridden. |
Inherited methods | |
---|---|
Constants
READ_ASSISTANT_APP_SEARCH_DATA
public static final int READ_ASSISTANT_APP_SEARCH_DATA
The Manifest.permission.READ_ASSISTANT_APP_SEARCH_DATA
AppSearch supported in
SetSchemaRequest.Builder.addRequiredPermissionsForSchemaTypeVisibility
Constant Value: 6 (0x00000006)
READ_CALENDAR
public static final int READ_CALENDAR
The Manifest.permission.READ_CALENDAR
AppSearch supported in SetSchemaRequest.Builder.addRequiredPermissionsForSchemaTypeVisibility(String, Set)
Constant Value: 2 (0x00000002)
READ_CONTACTS
public static final int READ_CONTACTS
The Manifest.permission.READ_CONTACTS
AppSearch supported in SetSchemaRequest.Builder.addRequiredPermissionsForSchemaTypeVisibility(String, Set)
Constant Value: 3 (0x00000003)
READ_EXTERNAL_STORAGE
public static final int READ_EXTERNAL_STORAGE
The Manifest.permission.READ_EXTERNAL_STORAGE
AppSearch supported in SetSchemaRequest.Builder.addRequiredPermissionsForSchemaTypeVisibility(String, Set)
Constant Value: 4 (0x00000004)
READ_HOME_APP_SEARCH_DATA
public static final int READ_HOME_APP_SEARCH_DATA
The Manifest.permission.READ_HOME_APP_SEARCH_DATA
AppSearch supported in
SetSchemaRequest.Builder.addRequiredPermissionsForSchemaTypeVisibility
Constant Value: 5 (0x00000005)
READ_SMS
public static final int READ_SMS
The Manifest.permission.READ_SMS
AppSearch supported in SetSchemaRequest.Builder.addRequiredPermissionsForSchemaTypeVisibility(String, Set)
Constant Value: 1 (0x00000001)
Public methods
getMigrators
public Map<String, Migrator> getMigrators ()
Returns the map of Migrator
, the key will be the schema type of the Migrator
associated with.
Returns | |
---|---|
Map<String, Migrator> |
This value cannot be null . |
getPubliclyVisibleSchemas
public Map<String, PackageIdentifier> getPubliclyVisibleSchemas ()
Returns a mapping of publicly visible schemas to the PackageIdentifier
specifying the
package the schemas are from.
Returns | |
---|---|
Map<String, PackageIdentifier> |
This value cannot be null . |
getRequiredPermissionsForSchemaTypeVisibility
public Map<String, Set<Set<Integer>>> getRequiredPermissionsForSchemaTypeVisibility ()
Returns a mapping of schema types to the Map of Manifest.permission
combinations that querier must hold to access that 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.
It\u2019s inefficient to call this method repeatedly.
Returns | |
---|---|
Map<String, Set<Set<Integer>>> |
The map contains schema type and all combinations of required permission for querier
to access it. The supported Permission are SetSchemaRequest.READ_SMS , READ_CALENDAR , SetSchemaRequest.READ_CONTACTS , READ_EXTERNAL_STORAGE , READ_HOME_APP_SEARCH_DATA and READ_ASSISTANT_APP_SEARCH_DATA .
This value cannot be null . |
getSchemas
public Set<AppSearchSchema> getSchemas ()
Returns the AppSearchSchema
types that are part of this request.
Returns | |
---|---|
Set<AppSearchSchema> |
This value cannot be null . |
getSchemasNotDisplayedBySystem
public Set<String> getSchemasNotDisplayedBySystem ()
Returns all the schema types that are opted out of being displayed and visible on any system UI surface.
Returns | |
---|---|
Set<String> |
This value cannot be null . |
getSchemasVisibleToConfigs
public Map<String, Set<SchemaVisibilityConfig>> getSchemasVisibleToConfigs ()
Returns a mapping of schema types to the set of SchemaVisibilityConfig
that have
access to that schema type.
It\u2019s inefficient to call this method repeatedly.
Returns | |
---|---|
Map<String, Set<SchemaVisibilityConfig>> |
This value cannot be null . |
getSchemasVisibleToPackages
public Map<String, Set<PackageIdentifier>> getSchemasVisibleToPackages ()
Returns a mapping of schema types to the set of packages that have access to that schema type.
It\u2019s inefficient to call this method repeatedly.
Returns | |
---|---|
Map<String, Set<PackageIdentifier>> |
This value cannot be null . |
getVersion
public int getVersion ()
Returns the database overall schema version.
Returns | |
---|---|
int |
Value is 1 or greater |
isForceOverride
public boolean isForceOverride ()
Returns whether this request will force the schema to be overridden.
Returns | |
---|---|
boolean |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-12-18 UTC.
pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier! Saves Data!
--- a PPN by Garber Painting Akron. With Image Size Reduction included!
Fetched URL: http://developer.android.com/reference/android/app/appsearch/SetSchemaRequest
Alternative Proxies: