Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.app.admin.FactoryResetProtectionPolicy.Builder](https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#) |

Builder class for `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy` objects.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#Builder()()` Initialize a new Builder to construct a `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy`. |

| Public methods ||
|---|---|
| open [FactoryResetProtectionPolicy](https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy) | `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#build()()` Combines all of the attributes that have been set on this `Builder` |
| open [FactoryResetProtectionPolicy.Builder](https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#) | `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#setFactoryResetProtectionAccounts(kotlin.collections.MutableList)(factoryResetProtectionAccounts: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Sets which accounts can unlock a device that has been factory reset. |
| open [FactoryResetProtectionPolicy.Builder](https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#) | `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#setFactoryResetProtectionEnabled(kotlin.Boolean)(factoryResetProtectionEnabled: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)` Sets whether factory reset protection is enabled or not. |

## Public constructors

### Builder

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder()
```

Initialize a new Builder to construct a `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy`.

## Public methods

### build

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun build(): FactoryResetProtectionPolicy
```

Combines all of the attributes that have been set on this `Builder`

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy` | a new `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy` object. This value cannot be `null`. |

### setFactoryResetProtectionAccounts

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setFactoryResetProtectionAccounts(factoryResetProtectionAccounts: MutableList<String!>): FactoryResetProtectionPolicy.Builder
```

Sets which accounts can unlock a device that has been factory reset.

Once set, the consumer unlock flow will be disabled and only accounts in this list can unlock factory reset protection after untrusted factory reset.

It's up to the FRP management agent to interpret the `String` as account it supports. Please consult their relevant documentation for details.

| Parameters ||
|---|---|
| `factoryResetProtectionAccounts` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: list of accounts. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#` | the same Builder instance. This value cannot be `null`. |

### setFactoryResetProtectionEnabled

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun setFactoryResetProtectionEnabled(factoryResetProtectionEnabled: Boolean): FactoryResetProtectionPolicy.Builder
```

Sets whether factory reset protection is enabled or not.

Once disabled, factory reset protection will not kick in all together when the device goes through untrusted factory reset. This applies to both the consumer unlock flow and the admin account overrides via `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#setFactoryResetProtectionAccounts(kotlin.collections.MutableList)`. By default, factory reset protection is enabled.

| Parameters ||
|---|---|
| `factoryResetProtectionEnabled` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html): Whether the policy is enabled or not. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/app/admin/FactoryResetProtectionPolicy.Builder#` | the same Builder instance. This value cannot be `null`. |