# SchemaVisibilityConfig.Builder

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  
Summary:[Ctors](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#pubctors)\|[Methods](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#inhmethods)  

# SchemaVisibilityConfig.Builder

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/app/appsearch/SchemaVisibilityConfig.Builder "View this page in Kotlin")\|Java

`
public
static
final

class
SchemaVisibilityConfig.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.appsearch.SchemaVisibilityConfig.Builder |

<br />

*** ** * ** ***

The builder class of[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig).

## Summary

|                                                                                                                                                                      ### Public constructors                                                                                                                                                                      ||
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#Builder())`() ` Creates a[Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder)for a[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig). |

|                                                                                                                                                                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | ` `[addAllowedPackage](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#addAllowedPackage(android.app.appsearch.PackageIdentifier))`(`[PackageIdentifier](https://developer.android.com/reference/android/app/appsearch/PackageIdentifier)` packageIdentifier) ` Add[PackageIdentifier](https://developer.android.com/reference/android/app/appsearch/PackageIdentifier)of packages which has access to this schema.                                                                                                                                                                                                  |
| ` `[SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | ` `[addRequiredPermissions](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#addRequiredPermissions(java.util.Set<java.lang.Integer>))`(`[Set](https://developer.android.com/reference/java/util/Set)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`> visibleToPermissions) ` Adds a set of required Android[Manifest.permission](https://developer.android.com/reference/android/Manifest.permission)combination a package needs to hold to access the schema this[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig)represents. |
| ` `[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig)                 | ` `[build](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#build())`() ` Build a[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig)                                                                                                                                                                                                                                                                                                                                                                                                                       |
| ` `[SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | ` `[clearAllowedPackages](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#clearAllowedPackages())`() ` Clears the list of packages which have access to this schema.                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | ` `[clearRequiredPermissions](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#clearRequiredPermissions())`() ` Clears all required permissions combinations set to this[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig).                                                                                                                                                                                                                                                                                                                               |
| ` `[SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | ` `[setPubliclyVisibleTargetPackage](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder#setPubliclyVisibleTargetPackage(android.app.appsearch.PackageIdentifier))`(`[PackageIdentifier](https://developer.android.com/reference/android/app/appsearch/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 |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public Builder ()
```

Creates a[Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder)for a[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig).

<br />

## Public methods

### addAllowedPackage

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public SchemaVisibilityConfig.Builder addAllowedPackage (PackageIdentifier packageIdentifier)
```

Add[PackageIdentifier](https://developer.android.com/reference/android/app/appsearch/PackageIdentifier)of packages which has access to this schema.

<br />

|                                  Parameters                                  ||
|---------------------|---------------------------------------------------------|
| `packageIdentifier` | `PackageIdentifier`: This value cannot be`null`. <br /> |

|                                                                              Returns                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | This value cannot be`null`. <br /> |

### addRequiredPermissions

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public SchemaVisibilityConfig.Builder addRequiredPermissions (Set<Integer> visibleToPermissions)
```

Adds a set of required Android[Manifest.permission](https://developer.android.com/reference/android/Manifest.permission)combination a package needs to hold to access the schema this[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig)represents.

If the querier holds ALL of the required permissions in this combination, they will have access to read[GenericDocument](https://developer.android.com/reference/android/app/appsearch/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()](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig#getRequiredPermissions()).

<br />

|                            Parameters                             ||
|------------------------|-------------------------------------------|
| `visibleToPermissions` | `Set`: This value cannot be`null`. <br /> |

|                                                                              Returns                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | This value cannot be`null`. <br /> |

**See also:**

- [for supported
Permissions.](https://developer.android.com/reference/android/app/appsearch/SetSchemaRequest.Builder#addRequiredPermissionsForSchemaTypeVisibility(java.lang.String,%20java.util.Set<java.lang.Integer>))  

### build

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public SchemaVisibilityConfig build ()
```

Build a[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig)

<br />

|                                                                      Returns                                                                       ||
|----------------------------------------------------------------------------------------------------------------|------------------------------------|
| [SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig) | This value cannot be`null`. <br /> |

### clearAllowedPackages

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public SchemaVisibilityConfig.Builder clearAllowedPackages ()
```

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

<br />

|                                                                              Returns                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | This value cannot be`null`. <br /> |

### clearRequiredPermissions

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
public SchemaVisibilityConfig.Builder clearRequiredPermissions ()
```

Clears all required permissions combinations set to this[SchemaVisibilityConfig](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig).

<br />

|                                                                              Returns                                                                               ||
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | This value cannot be`null`. <br /> |

### setPubliclyVisibleTargetPackage

Added in[API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[T Extensions 13](https://developer.android.com/sdkExtensions)  

```
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)](https://developer.android.com/reference/android/content/pm/PackageManager#canPackageQuery(java.lang.String,%20java.lang.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.

<br />

|                                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                                 ||
|---------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `packageIdentifier` | `PackageIdentifier`: the[PackageIdentifier](https://developer.android.com/reference/android/app/appsearch/PackageIdentifier)of the package that will be used as the target package in a call to[PackageManager.canPackageQuery(String, String)](https://developer.android.com/reference/android/content/pm/PackageManager#canPackageQuery(java.lang.String,%20java.lang.String))to determine which packages can access this publicly visible schema. This value may be`null`. <br /> |

|                                                                Returns                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------|--------|
| [SchemaVisibilityConfig.Builder](https://developer.android.com/reference/android/app/appsearch/SchemaVisibilityConfig.Builder) | <br /> |