# TracingConfig.Builder

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

# Builder

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/webkit/TracingConfig.Builder "View this page in Java")  

```
open class Builder
```

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

Builder used to create[TracingConfig](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig)objects.

Examples:  

```kotlin
// Create a configuration with default options: <code><a docref="android.webkit.TracingConfig$CATEGORIES_NONE">#CATEGORIES_NONE</a></code>,
    // <code><a docref="android.webkit.TracingConfig$RECORD_CONTINUOUSLY">#RECORD_CONTINUOUSLY</a></code>.
    <code>new TracingConfig.Builder().build()</code>// Record trace events from the "web developer" predefined category sets.
    // Uses a ring buffer (the default <code><a docref="android.webkit.TracingConfig$RECORD_CONTINUOUSLY">#RECORD_CONTINUOUSLY</a></code>mode) for
    // internal storage during tracing.
    <code>new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER).build()</code>// Record trace events from the "rendering" and "input latency" predefined
    // category sets.
    <code>new TracingConfig.Builder().addCategories(CATEGORIES_RENDERING,
                                      CATEGORIES_INPUT_LATENCY).build()</code>// Record only the trace events from the "browser" category.
    <code>new TracingConfig.Builder().addCategories("browser").build()</code>// Record only the trace events matching the "blink*" and "renderer*" patterns
    // (e.g. "blink.animations", "renderer_host" and "renderer.scheduler" categories).
    <code>new TracingConfig.Builder().addCategories("blink*","renderer*").build()</code>// Record events from the "web developer" predefined category set and events from
    // the "disabled-by-default-v8.gc" category to understand where garbage collection
    // is being triggered. Uses a limited size buffer for internal storage during tracing.
    <code>new TracingConfig.Builder().addCategories(CATEGORIES_WEB_DEVELOPER)
                               .addCategories("disabled-by-default-v8.gc")
                               .setTracingMode(RECORD_UNTIL_FULL).build()</code>
```

## Summary

|                                                               Public constructors                                                                ||
|-----------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#Builder())`()` Default constructor for Builder. |

|                                                                                                                                                                                                                                                                         Public methods                                                                                                                                                                                                                                                                         ||
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | [addCategories](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#addCategories(kotlin.Int))`(`vararg` `predefinedCategories:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Adds predefined sets of categories to be included in the trace output.                                                                                                                     |
| open[TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | [addCategories](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#addCategories(kotlin.String))`(`vararg` `categories:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` Adds custom categories to be included in trace output.                                                                                                                                     |
| open[TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | [addCategories](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#addCategories(kotlin.collections.MutableCollection))`(`categories:` `[MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!>!`)` Adds custom categories to be included in trace output. |
| open[TracingConfig](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig)!                  | [build](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#build())`()` Build[TracingConfig](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig)using the current settings.                                                                                                                                                                                                      |
| open[TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | [setTracingMode](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#setTracingMode(kotlin.Int))`(`tracingMode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Sets the tracing mode for this configuration.                                                                                                                                                              |

## Public constructors

### Builder

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

```
Builder()
```

Default constructor for Builder.

## Public methods

### addCategories

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

```
open fun addCategories(vararg predefinedCategories: Int): TracingConfig.Builder!
```

Adds predefined sets of categories to be included in the trace output. A predefined category set can be one of[CATEGORIES_NONE](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_NONE:kotlin.Int),[CATEGORIES_ALL](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_ALL:kotlin.Int),[CATEGORIES_ANDROID_WEBVIEW](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_ANDROID_WEBVIEW:kotlin.Int),[CATEGORIES_WEB_DEVELOPER](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_WEB_DEVELOPER:kotlin.Int),[CATEGORIES_INPUT_LATENCY](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_INPUT_LATENCY:kotlin.Int),[CATEGORIES_RENDERING](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_RENDERING:kotlin.Int),[CATEGORIES_JAVASCRIPT_AND_RENDERING](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_JAVASCRIPT_AND_RENDERING:kotlin.Int)or[CATEGORIES_FRAME_VIEWER](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_FRAME_VIEWER:kotlin.Int).

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ||
|------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `predefinedCategories` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):A list or bitmask of predefined category sets. Value is either`0`or a combination of[android.webkit.TracingConfig#CATEGORIES_NONE](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_NONE:kotlin.Int),[android.webkit.TracingConfig#CATEGORIES_ALL](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_ALL:kotlin.Int),[android.webkit.TracingConfig#CATEGORIES_ANDROID_WEBVIEW](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_ANDROID_WEBVIEW:kotlin.Int),[android.webkit.TracingConfig#CATEGORIES_WEB_DEVELOPER](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_WEB_DEVELOPER:kotlin.Int),[android.webkit.TracingConfig#CATEGORIES_INPUT_LATENCY](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_INPUT_LATENCY:kotlin.Int),[android.webkit.TracingConfig#CATEGORIES_RENDERING](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_RENDERING:kotlin.Int),[android.webkit.TracingConfig#CATEGORIES_JAVASCRIPT_AND_RENDERING](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_JAVASCRIPT_AND_RENDERING:kotlin.Int), and[android.webkit.TracingConfig#CATEGORIES_FRAME_VIEWER](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#CATEGORIES_FRAME_VIEWER:kotlin.Int) |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | The builder to facilitate chaining. |

### addCategories

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

```
open fun addCategories(vararg categories: String!): TracingConfig.Builder!
```

Adds custom categories to be included in trace output. Note that the categories are defined by the currently-in-use version of WebView. They live in chromium code and are not part of the Android API. See[chromium documentation on tracing](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool)for more details.

|                                                                                                               Parameters                                                                                                               ||
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `categories` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!:A list of category patterns. A category pattern can contain wildcards, e.g. "blink\*" or full category name e.g. "renderer.scheduler". |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | The builder to facilitate chaining. |

### addCategories

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

```
open fun addCategories(categories: MutableCollection<String!>!): TracingConfig.Builder!
```

Adds custom categories to be included in trace output. Same as[addCategories(java.lang.String...)](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#addCategories(kotlin.String))but allows to pass a Collection as a parameter.

|                                                                                                                      Parameters                                                                                                                      ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `categories` | [MutableCollection](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-collection/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>!:A list of category patterns. |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | The builder to facilitate chaining. |

### build

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

```
open fun build(): TracingConfig!
```

Build[TracingConfig](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig)using the current settings.

|                                                                                                          Return                                                                                                          ||
|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [TracingConfig](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig)! | The[TracingConfig](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig)with the current settings. |

### setTracingMode

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

```
open fun setTracingMode(tracingMode: Int): TracingConfig.Builder!
```

Sets the tracing mode for this configuration. When tracingMode is not set explicitly, the default is[RECORD_CONTINUOUSLY](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#RECORD_CONTINUOUSLY:kotlin.Int).

|                                                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                                                            ||
|---------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `tracingMode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The tracing mode to use, one of[RECORD_UNTIL_FULL](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#RECORD_UNTIL_FULL:kotlin.Int)or[RECORD_CONTINUOUSLY](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#RECORD_CONTINUOUSLY:kotlin.Int). Value is[android.webkit.TracingConfig#RECORD_UNTIL_FULL](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#RECORD_UNTIL_FULL:kotlin.Int), or[android.webkit.TracingConfig#RECORD_CONTINUOUSLY](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig#RECORD_CONTINUOUSLY:kotlin.Int) |

|                                                                       Return                                                                        ||
|----------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [TracingConfig.Builder](https://developer.android.com/reference/kotlin/android/webkit/TracingConfig.Builder#)! | The builder to facilitate chaining. |