# Configurator

Summary:[Methods](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#)  

# Configurator

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
Configurator
`  
`

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


``


`

|---|-----------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.test.uiautomator.Configurator |

<br />

*** ** * ** ***

Allows you to set key parameters for running uiautomator tests. The new settings take effect immediately and can be changed any time during a test run. To modify parameters using Configurator, first obtain an instance by calling[getInstance()](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getInstance()). As a best practice, make sure you always save the original value of any parameter that you are modifying. After running your tests with the modified parameters, make sure to also restore the original parameter values, otherwise this will impact other tests cases.

## Summary

|                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` long`                                                                                                         | ` `[getActionAcknowledgmentTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getActionAcknowledgmentTimeout())`() ` Gets the current timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses.         |
| ` static `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | ` `[getInstance](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getInstance())`() ` Retrieves a singleton instance of Configurator.                                                                                                                                          |
| ` long`                                                                                                         | ` `[getKeyInjectionDelay](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getKeyInjectionDelay())`() ` Gets the current delay between key presses when injecting text input.                                                                                                  |
| ` long`                                                                                                         | ` `[getScrollAcknowledgmentTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getScrollAcknowledgmentTimeout())`() ` Gets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action.                                                          |
| ` int`                                                                                                          | ` `[getToolType](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getToolType())`() ` Gets the current tool type to use for motion events.                                                                                                                                     |
| ` int`                                                                                                          | ` `[getUiAutomationFlags](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getUiAutomationFlags())`() ` Gets the current flags that are used to obtain a[ERROR(/UiAutomation)](https://developer.android.com/)instance.                                                        |
| ` long`                                                                                                         | ` `[getWaitForIdleTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getWaitForIdleTimeout())`() ` Gets the current timeout used for waiting for the user interface to go into an idle state.                                                                           |
| ` long`                                                                                                         | ` `[getWaitForSelectorTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#getWaitForSelectorTimeout())`() ` Gets the current timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector.                           |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setActionAcknowledgmentTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setActionAcknowledgmentTimeout(long))`(long timeout) ` Sets the timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses. |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setKeyInjectionDelay](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setKeyInjectionDelay(long))`(long delay) ` Sets a delay between key presses when injecting text input.                                                                                              |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setScrollAcknowledgmentTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setScrollAcknowledgmentTimeout(long))`(long timeout) ` Sets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action.                                          |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setToolType](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setToolType(int))`(int toolType) ` Sets the current tool type to use for motion events.                                                                                                                      |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setUiAutomationFlags](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setUiAutomationFlags(int))`(int flags) ` Sets the flags to use when obtaining a[ERROR(/UiAutomation)](https://developer.android.com/)instance.                                                      |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setWaitForIdleTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForIdleTimeout(long))`(long timeout) ` Sets the timeout for waiting for the user interface to go into an idle state before starting a uiautomator action.                                   |
| ` `[Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)        | ` `[setWaitForSelectorTimeout](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForSelectorTimeout(long))`(long timeout) ` Sets the timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector.                   |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#)From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object.html)` ` |-------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                                | | ` boolean`                                                                          | ` equals(`[Object](https://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                             | ` finalize() `                                                                             | | ` final `[Class](https://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                             | | ` int`                                                                              | ` hashCode() `                                                                             | | ` final void`                                                                       | ` notify() `                                                                               | | ` final void`                                                                       | ` notifyAll() `                                                                            | | ` `[String](https://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                             | | ` final void`                                                                       | ` wait(long arg0, int arg1) `                                                              | | ` final void`                                                                       | ` wait(long arg0) `                                                                        | | ` final void`                                                                       | ` wait() `                                                                                 | ||

## Public methods

### getActionAcknowledgmentTimeout

```
long getActionAcknowledgmentTimeout ()
```

Gets the current timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses. The acknowledgment is an[AccessibilityEvent](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html), corresponding to an action, that lets the framework determine if the action was successful. Generally, this timeout should not be modified. See[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)

<br />

|                    Returns                     ||
|--------|----------------------------------------|
| `long` | current timeout in milliseconds <br /> |

### getInstance

```
Configurator getInstance ()
```

Retrieves a singleton instance of Configurator.

<br />

|                                                               Returns                                                               ||
|-------------------------------------------------------------------------------------------------------|------------------------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | Configurator instance <br /> |

### getKeyInjectionDelay

```
long getKeyInjectionDelay ()
```

Gets the current delay between key presses when injecting text input. See[setText(String)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#setText(java.lang.String))

<br />

|                   Returns                    ||
|--------|--------------------------------------|
| `long` | current delay in milliseconds <br /> |

### getScrollAcknowledgmentTimeout

```
long getScrollAcknowledgmentTimeout ()
```

Gets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action. The acknowledgment is an[AccessibilityEvent](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html), corresponding to the scroll action, that lets the framework determine if the scroll action was successful. Generally, this timeout should not be modified. See[UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable)

<br />

|                    Returns                     ||
|--------|----------------------------------------|
| `long` | current timeout in milliseconds <br /> |

### getToolType

```
int getToolType ()
```

Gets the current tool type to use for motion events.

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

**See also:**

- [getToolType(int)](https://developer.android.com/https://developer.android.com/reference/android/view/MotionEvent#getToolType(int))  

### getUiAutomationFlags

```
int getUiAutomationFlags ()
```

Gets the current flags that are used to obtain a[ERROR(/UiAutomation)](https://developer.android.com/)instance.

<br />

|                Returns                ||
|-------|--------------------------------|
| `int` | The UiAutomation flags. <br /> |

**See also:**

- [ERROR(/Instrumentation#getUiAutomation(int))](https://developer.android.com/)
- [ERROR(/UiAutomation#FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES)](https://developer.android.com/)  

### getWaitForIdleTimeout

```
long getWaitForIdleTimeout ()
```

Gets the current timeout used for waiting for the user interface to go into an idle state. By default, all core uiautomator objects except[UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)will perform this wait before starting to search for the widget specified by the object's[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector). Once the idle state is detected or the timeout elapses (whichever occurs first), the object will start to wait for the selector to find a match. See[setWaitForSelectorTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForSelectorTimeout(long))

<br />

|                       Returns                        ||
|--------|----------------------------------------------|
| `long` | Current timeout value in milliseconds <br /> |

### getWaitForSelectorTimeout

```
long getWaitForSelectorTimeout ()
```

Gets the current timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector. Because user interface content is dynamic, sometimes a widget may not be visible immediately and won't be detected by a selector. This timeout allows the uiautomator framework to wait for a match to be found, up until the timeout elapses.

<br />

|                       Returns                        ||
|--------|----------------------------------------------|
| `long` | Current timeout value in milliseconds <br /> |

### setActionAcknowledgmentTimeout

```
Configurator setActionAcknowledgmentTimeout (long timeout)
```

Sets the timeout for waiting for an acknowledgment of generic uiautomator actions, such as clicks, text setting, and menu presses. The acknowledgment is an[AccessibilityEvent](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html), corresponding to an action, that lets the framework determine if the action was successful. Generally, this timeout should not be modified. See[UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)

<br />

|                       Parameters                        ||
|-----------|----------------------------------------------|
| `timeout` | `long`: Timeout value in milliseconds <br /> |

|                                                      Returns                                                       ||
|-------------------------------------------------------------------------------------------------------|-------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | self <br /> |

### setKeyInjectionDelay

```
Configurator setKeyInjectionDelay (long delay)
```

Sets a delay between key presses when injecting text input. See[setText(String)](https://developer.android.com/reference/android/support/test/uiautomator/UiObject#setText(java.lang.String))

<br />

|                     Parameters                      ||
|---------|--------------------------------------------|
| `delay` | `long`: Delay value in milliseconds <br /> |

|                                                      Returns                                                       ||
|-------------------------------------------------------------------------------------------------------|-------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | self <br /> |

### setScrollAcknowledgmentTimeout

```
Configurator setScrollAcknowledgmentTimeout (long timeout)
```

Sets the timeout for waiting for an acknowledgement of an uiautomtor scroll swipe action. The acknowledgment is an[AccessibilityEvent](http://developer.android.com/reference/android/view/accessibility/AccessibilityEvent.html), corresponding to the scroll action, that lets the framework determine if the scroll action was successful. Generally, this timeout should not be modified. See[UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable)

<br />

|                       Parameters                        ||
|-----------|----------------------------------------------|
| `timeout` | `long`: Timeout value in milliseconds <br /> |

|                                                      Returns                                                       ||
|-------------------------------------------------------------------------------------------------------|-------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | self <br /> |

### setToolType

```
Configurator setToolType (int toolType)
```

Sets the current tool type to use for motion events.

<br />

|        Parameters        ||
|------------|--------------|
| `toolType` | `int` <br /> |

|                                                    Returns                                                    ||
|-------------------------------------------------------------------------------------------------------|--------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | <br /> |

**See also:**

- [getToolType(int)](https://developer.android.com/https://developer.android.com/reference/android/view/MotionEvent#getToolType(int))  

### setUiAutomationFlags

```
Configurator setUiAutomationFlags (int flags)
```

Sets the flags to use when obtaining a[ERROR(/UiAutomation)](https://developer.android.com/)instance.

<br />

|                      Parameters                       ||
|---------|----------------------------------------------|
| `flags` | `int`: The UiAutomation flags to use. <br /> |

|                                                                  Returns                                                                  ||
|-------------------------------------------------------------------------------------------------------|------------------------------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | A reference to this object. <br /> |

**See also:**

- [ERROR(/Instrumentation#getUiAutomation(int))](https://developer.android.com/)
- [ERROR(/UiAutomation#FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES)](https://developer.android.com/)  

### setWaitForIdleTimeout

```
Configurator setWaitForIdleTimeout (long timeout)
```

Sets the timeout for waiting for the user interface to go into an idle state before starting a uiautomator action. By default, all core uiautomator objects except[UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)will perform this wait before starting to search for the widget specified by the object's[UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector). Once the idle state is detected or the timeout elapses (whichever occurs first), the object will start to wait for the selector to find a match. See[setWaitForSelectorTimeout(long)](https://developer.android.com/reference/android/support/test/uiautomator/Configurator#setWaitForSelectorTimeout(long))

<br />

|                       Parameters                        ||
|-----------|----------------------------------------------|
| `timeout` | `long`: Timeout value in milliseconds <br /> |

|                                                      Returns                                                       ||
|-------------------------------------------------------------------------------------------------------|-------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | self <br /> |

### setWaitForSelectorTimeout

```
Configurator setWaitForSelectorTimeout (long timeout)
```

Sets the timeout for waiting for a widget to become visible in the user interface so that it can be matched by a selector. Because user interface content is dynamic, sometimes a widget may not be visible immediately and won't be detected by a selector. This timeout allows the uiautomator framework to wait for a match to be found, up until the timeout elapses.

<br />

|                        Parameters                        ||
|-----------|-----------------------------------------------|
| `timeout` | `long`: Timeout value in milliseconds. <br /> |

|                                                      Returns                                                       ||
|-------------------------------------------------------------------------------------------------------|-------------|
| [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator) | self <br /> |

-

  ## Interfaces

  - [IAutomationSupport](https://developer.android.com/reference/android/support/test/uiautomator/IAutomationSupport)
  - [UiWatcher](https://developer.android.com/reference/android/support/test/uiautomator/UiWatcher)
-

  ## Classes

  - [By](https://developer.android.com/reference/android/support/test/uiautomator/By)
  - [BySelector](https://developer.android.com/reference/android/support/test/uiautomator/BySelector)
  - [Configurator](https://developer.android.com/reference/android/support/test/uiautomator/Configurator)
  - [EventCondition](https://developer.android.com/reference/android/support/test/uiautomator/EventCondition)
  - [SearchCondition](https://developer.android.com/reference/android/support/test/uiautomator/SearchCondition)
  - [UiAutomatorInstrumentationTestRunner](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorInstrumentationTestRunner)
  - [UiAutomatorTestCase](https://developer.android.com/reference/android/support/test/uiautomator/UiAutomatorTestCase)
  - [UiCollection](https://developer.android.com/reference/android/support/test/uiautomator/UiCollection)
  - [UiDevice](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice)
  - [UiObject](https://developer.android.com/reference/android/support/test/uiautomator/UiObject)
  - [UiObject2](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2)
  - [UiObject2Condition](https://developer.android.com/reference/android/support/test/uiautomator/UiObject2Condition)
  - [UiScrollable](https://developer.android.com/reference/android/support/test/uiautomator/UiScrollable)
  - [UiSelector](https://developer.android.com/reference/android/support/test/uiautomator/UiSelector)
  - [Until](https://developer.android.com/reference/android/support/test/uiautomator/Until)
-

  ## Enums

  - [Direction](https://developer.android.com/reference/android/support/test/uiautomator/Direction)
-

  ## Exceptions

  - [StaleObjectException](https://developer.android.com/reference/android/support/test/uiautomator/StaleObjectException)
  - [UiObjectNotFoundException](https://developer.android.com/reference/android/support/test/uiautomator/UiObjectNotFoundException)