# LightsManager.LightsSession

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/hardware/lights/LightsManager.LightsSession#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/hardware/lights/LightsManager.LightsSession#inhmethods)  

# LightsManager.LightsSession

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/hardware/lights/LightsManager.LightsSession "View this page in Kotlin")\|Java

`
public
static

abstract
class
LightsManager.LightsSession
`  
`

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


``


implements

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


`

|---|-----------------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.hardware.lights.LightsManager.LightsSession |

<br />

*** ** * ** ***

Encapsulates a session that can be used to control device lights and represents the lifetime of the requests.

Any lights requests always live in a lights session which defines the lifecycle of the lights requests. A lights session is AutoCloseable that will get closed when leaving the session context.

Multiple sessions can make lights requests which contains same light. In the case the LightsManager implementation will arbitrate and honor one of the session's request. When the session hold the current light request closed, LightsManager implementation will choose another live session to honor its lights requests.

## Summary

|                                                                                                                                                                      ### Public methods                                                                                                                                                                      ||
|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void` | ` `[close](https://developer.android.com/reference/android/hardware/lights/LightsManager.LightsSession#close())`() ` Closes this resource, relinquishing any underlying resources.                                                                                                                                                         |
| ` abstract void` | ` `[requestLights](https://developer.android.com/reference/android/hardware/lights/LightsManager.LightsSession#requestLights(android.hardware.lights.LightsRequest))`(`[LightsRequest](https://developer.android.com/reference/android/hardware/lights/LightsRequest)` request) ` Sends a request to modify the states of multiple lights. |

| ### 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*.                                                                                             | ||
| From interface` `[java.lang.AutoCloseable](https://developer.android.com/reference/java/lang/AutoCloseable)` ` |------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract void` | ` `[close](https://developer.android.com/reference/java/lang/AutoCloseable#close())`() ` Closes this resource, relinquishing any underlying resources. | ||

## Public methods

### close

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

```
public abstract void close ()
```

Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the`try`-with-resources statement.

<br />

### requestLights

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

```
public abstract void requestLights (LightsRequest request)
```

Sends a request to modify the states of multiple lights.

<br />

|                                                Parameters                                                 ||
|-----------|------------------------------------------------------------------------------------------------|
| `request` | `LightsRequest`: the settings for lights that should change This value cannot be`null`. <br /> |