# SurfaceControlCallback

Artifact: [androidx.car.app:app-automotive](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/activity/renderer/surface/SurfaceControlCallback.java+class:androidx.car.app.activity.renderer.surface.SurfaceControlCallback) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

*** ** * ** ***


```
interface SurfaceControlCallback
```

<br />

*** ** * ** ***

A host-side interface for reporting to an off-process renderer events affecting the `https://developer.android.com/reference/android/view/SurfaceView.html` it renders content on.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/activity/renderer/surface/SurfaceControlCallback#onError(java.lang.String,java.lang.Throwable)(msg: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, e: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html)` Notifies when there is an error. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/activity/renderer/surface/SurfaceControlCallback#onKeyEvent(android.view.KeyEvent)(event: https://developer.android.com/reference/android/view/KeyEvent.html)` Notifies when `https://developer.android.com/reference/android/view/SurfaceView.html` receives a new key event. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/activity/renderer/surface/SurfaceControlCallback#onTouchEvent(android.view.MotionEvent)(event: https://developer.android.com/reference/android/view/MotionEvent.html)` Notifies when `https://developer.android.com/reference/android/view/SurfaceView.html` receives a new touch event. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/activity/renderer/surface/SurfaceControlCallback#onWindowFocusChanged(boolean,boolean)(hasFocus: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html, isInTouchMode: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Notifies when the window focus changes. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/activity/renderer/surface/SurfaceControlCallback#setSurfaceWrapper(androidx.car.app.activity.renderer.surface.SurfaceWrapper)(surfaceWrapper: https://developer.android.com/reference/kotlin/androidx/car/app/activity/renderer/surface/SurfaceWrapper)` Notifies when the underlying surface changes. |

## Public functions

### onError

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
fun onError(msg: String, e: Throwable): Unit
```

Notifies when there is an error. Provide default implementation for easier transition.

### onKeyEvent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
fun onKeyEvent(event: KeyEvent): Unit
```

Notifies when `https://developer.android.com/reference/android/view/SurfaceView.html` receives a new key event.

### onTouchEvent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
fun onTouchEvent(event: MotionEvent): Unit
```

Notifies when `https://developer.android.com/reference/android/view/SurfaceView.html` receives a new touch event.

### onWindowFocusChanged

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
fun onWindowFocusChanged(hasFocus: Boolean, isInTouchMode: Boolean): Unit
```

Notifies when the window focus changes.

### setSurfaceWrapper

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

```
fun setSurfaceWrapper(surfaceWrapper: SurfaceWrapper): Unit
```

Notifies when the underlying surface changes.