# UpdatePolicy.Builder

Summary:[Ctors](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#pubctors)\|[Methods](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#)  

# UpdatePolicy.Builder

`
public
static


class
UpdatePolicy.Builder
`  
`

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


``


`

|---|-------------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | com.google.android.things.update.UpdatePolicy.Builder |

<br />

*** ** * ** ***

The Builder is used to construct new UpdatePolicy objects.

## Summary

|                                                                 ### Public constructors                                                                 ||
|------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#UpdatePolicy.Builder())`() ` |

|                                                                                                                                                                                                                                                            ### Public methods                                                                                                                                                                                                                                                             ||
|--------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[UpdatePolicy](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy)                 | ` `[build](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#build())`() ` Builds an[UpdatePolicy](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy)with the parameters that have been set on this[UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder)object. |
| ` `[UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder) | ` `[setApplyDeadline](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#setApplyDeadline(long, java.util.concurrent.TimeUnit))`(long deadline, `[TimeUnit](https://developer.android.com/reference/java/util/concurrent/TimeUnit)` unit) ` Set the deadline by which an update must be applied and rebooted into.                                                   |
| ` `[UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder) | ` `[setPolicy](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#setPolicy(int))`(int policy) ` Sets the base policy to be used by this UpdatePolicy.                                                                                                                                                                                                               |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder#)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, int))`(long millis, int nanos) ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long millis) ` Causes the current thread to wait until either another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object, or a specified amount of time has elapsed.                                                                 | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until another thread invokes the[notify()](https://developer.android.com/reference/java/lang/Object.html#notify())method or the[notifyAll()](https://developer.android.com/reference/java/lang/Object.html#notifyAll())method for this object.                                                                                                                                  | ||

## Public constructors

### UpdatePolicy.Builder

```
UpdatePolicy.Builder ()
```

<br />

<br />

## Public methods

### build

```
UpdatePolicy build ()
```

Builds an[UpdatePolicy](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy)with the parameters that have been set on this[UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder)object.

<br />

|                                                                 Returns                                                                  ||
|-------------------------------------------------------------------------------------------------------|-----------------------------------|
| [UpdatePolicy](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy) | A new UpdatePolicy object. <br /> |

|                                                                        Throws                                                                        ||
|--------------------------------------------------------------------------------------------------------|----------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if all the required fields have not been set |

### setApplyDeadline

```
UpdatePolicy.Builder setApplyDeadline (long deadline, 
                TimeUnit unit)
```

Set the deadline by which an update must be applied and rebooted into.

<br />

|                           Parameters                            ||
|------------|-----------------------------------------------------|
| `deadline` | `long`: The deadline. <br />                        |
| `unit`     | `TimeUnit`: The time units for the deadline. <br /> |

|                                                                  Returns                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------|---------------------|
| [UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder) | This builder <br /> |

|                                                                    Throws                                                                     ||
|--------------------------------------------------------------------------------------------------------|---------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the deadline is not greater than 0 |

### setPolicy

```
UpdatePolicy.Builder setPolicy (int policy)
```

Sets the base policy to be used by this UpdatePolicy.

<br />

|                      Parameters                      ||
|----------|--------------------------------------------|
| `policy` | `int`: The update policy to follow. <br /> |

|                                                                   Returns                                                                   ||
|-----------------------------------------------------------------------------------------------------------------------|----------------------|
| [UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder) | This builder. <br /> |

|                                                                   Throws                                                                   ||
|--------------------------------------------------------------------------------------------------------|------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if the value for policy is invalid |

**See also:**

- [POLICY_APPLY_AND_REBOOT](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy#POLICY_APPLY_AND_REBOOT)
- [POLICY_APPLY_ONLY](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy#POLICY_APPLY_ONLY)
- [POLICY_CHECKS_ONLY](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy#POLICY_CHECKS_ONLY)  
-

  ## Interfaces

  - [StatusListener](https://developer.android.com/reference/com/google/android/things/update/StatusListener)
-

  ## Classes

  - [PendingUpdateInfo](https://developer.android.com/reference/com/google/android/things/update/PendingUpdateInfo)
  - [UpdateManager](https://developer.android.com/reference/com/google/android/things/update/UpdateManager)
  - [UpdateManagerStatus](https://developer.android.com/reference/com/google/android/things/update/UpdateManagerStatus)
  - [UpdatePolicy](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy)
  - [UpdatePolicy.Builder](https://developer.android.com/reference/com/google/android/things/update/UpdatePolicy.Builder)
  - [VersionInfo](https://developer.android.com/reference/com/google/android/things/update/VersionInfo)