# AccessibilityService.MagnificationController

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

# MagnificationController

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController "View this page in Java")  

```
class MagnificationController
```

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

Used to control and query the state of display magnification.

## Summary

|                                                                                                                     Nested classes                                                                                                                      ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| abstract | [OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener) Listener for changes in the state of magnification. |

|                                                                                                                                                                                                                                                                                                                                                                                                                      Public methods                                                                                                                                                                                                                                                                                                                                                                                                                      ||
|-------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                            | [addListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#addListener(android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener))`(`listener:` `[AccessibilityService.MagnificationController.OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener)`)` Adds the specified change listener to the list of magnification change listeners.                                                                                                                         |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                            | [addListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#addListener(android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener,%20android.os.Handler))`(`listener:` `[AccessibilityService.MagnificationController.OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener)`, `handler:` `[Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)?`)` Adds the specified change listener to the list of magnification change listeners. |
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                                          | [getCenterX](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getCenterX())`()` Returns the unscaled screen-relative X coordinate of the focal center of the magnified region.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                                          | [getCenterY](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getCenterY())`()` Returns the unscaled screen-relative Y coordinate of the focal center of the magnified region.                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [Region](https://developer.android.com/reference/kotlin/android/graphics/Region.html#)                                  | [getCurrentMagnificationRegion](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getCurrentMagnificationRegion())`()` Returns the region of the screen currently active for magnification if the controlling magnification is[MagnificationConfig.MAGNIFICATION_MODE_FULLSCREEN](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN:kotlin.Int).                                                                                                                                                                                                                             |
| [MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig)? | [getMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())`()` Gets the[MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig)of the controlling magnifier on the display.                                                                                                                                                                                                                                                                                                                                                                      |
| [Region](https://developer.android.com/reference/kotlin/android/graphics/Region.html#)                                  | [getMagnificationRegion](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationRegion())`()` Returns the region of the screen currently active for magnification.                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)                                          | [getScale](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getScale())`()` Returns the current magnification scale.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                      | [removeListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#removeListener(android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener))`(`listener:` `[AccessibilityService.MagnificationController.OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener)`)` Removes the specified change listener from the list of magnification change listeners.                                                                                                              |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                      | [reset](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#reset(kotlin.Boolean))`(`animate:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Resets magnification scale and center to their default (e.g. no magnification) values.                                                                                                                                                                                                                                                                                                                                                                               |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                      | [resetCurrentMagnification](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#resetCurrentMagnification(kotlin.Boolean))`(`animate:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Resets magnification scale and center of the controlling magnification to their default (e.g. no magnification) values.                                                                                                                                                                                                                                                                                                      |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                      | [setCenter](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setCenter(kotlin.Float,%20kotlin.Float,%20kotlin.Boolean))`(`centerX:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `centerY:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `animate:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets the center of the magnified viewport.                                                                                                                                                                                         |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                      | [setMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20kotlin.Boolean))`(`config:` `[MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig)`, `animate:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets the[MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig).                                                                                                            |
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)                                      | [setScale](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setScale(kotlin.Float,%20kotlin.Boolean))`(`scale:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`, `animate:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Sets the magnification scale.                                                                                                                                                                                                                                                                                                                       |

## Public methods

### addListener

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

```
fun addListener(listener: AccessibilityService.MagnificationController.OnMagnificationChangedListener): Unit
```

Adds the specified change listener to the list of magnification change listeners. The callback will occur on the service's main thread.

|                                                                                                                                         Parameters                                                                                                                                         ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `listener` | [AccessibilityService.MagnificationController.OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener):the listener to add, must be non-`null` |

### addListener

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

```
fun addListener(
    listener: AccessibilityService.MagnificationController.OnMagnificationChangedListener, 
    handler: Handler?
): Unit
```

Adds the specified change listener to the list of magnification change listeners. The callback will occur on the specified[Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)'s thread, or on the service's main thread if the handler is`null`.

|                                                                                                                                        Parameters                                                                                                                                        ||
|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `listener` | [AccessibilityService.MagnificationController.OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener):the listener to add, must be non-null |
| `handler`  | [Handler](https://developer.android.com/reference/kotlin/android/os/Handler.html#)?:the handler on which the callback should execute, or`null`to execute on the service's main thread                                                                                        |

### getCenterX

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

```
fun getCenterX(): Float
```

**Deprecated:** *Use[getMagnificationConfig()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())instead*

Returns the unscaled screen-relative X coordinate of the focal center of the magnified region. This is the point around which zooming occurs and is guaranteed to lie within the magnified region.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will return a default value of`0.0f`.

**Note:** This legacy API gets the center position of full-screen magnification. To get the magnification center of the current controlling magnifier, use[getMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())instead.

|                                                                             Return                                                                              ||
|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | the unscaled screen-relative X coordinate of the center of the magnified region |

### getCenterY

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

```
fun getCenterY(): Float
```

**Deprecated:** *Use[getMagnificationConfig()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())instead*

Returns the unscaled screen-relative Y coordinate of the focal center of the magnified region. This is the point around which zooming occurs and is guaranteed to lie within the magnified region.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will return a default value of`0.0f`.

**Note:** This legacy API gets the center position of full-screen magnification. To get the magnification center of the current controlling magnifier, use[getMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())instead.

|                                                                             Return                                                                              ||
|--------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | the unscaled screen-relative Y coordinate of the center of the magnified region |

### getCurrentMagnificationRegion

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

```
fun getCurrentMagnificationRegion(): Region
```

Returns the region of the screen currently active for magnification if the controlling magnification is[MagnificationConfig.MAGNIFICATION_MODE_FULLSCREEN](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN:kotlin.Int). Returns the region of screen projected on the magnification window if the controlling magnification is[MagnificationConfig.MAGNIFICATION_MODE_WINDOW](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_WINDOW:kotlin.Int).

If the controlling mode is[MagnificationConfig.MAGNIFICATION_MODE_FULLSCREEN](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN:kotlin.Int), the returned region will be empty if the magnification is not active. And the magnification is active if magnification gestures are enabled or if a service is running that can control magnification.

If the controlling mode is[MagnificationConfig.MAGNIFICATION_MODE_WINDOW](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_WINDOW:kotlin.Int), the returned region will be empty if the magnification is not activated.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will return an empty region.

|                                                                                         Return                                                                                          ||
|----------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
| [Region](https://developer.android.com/reference/kotlin/android/graphics/Region.html#) | the magnification region of the currently controlling magnification This value cannot be`null`. |

### getMagnificationConfig

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

```
fun getMagnificationConfig(): MagnificationConfig?
```

Gets the[MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig)of the controlling magnifier on the display.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will return null.

|                                                                                   Return                                                                                    ||
|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------|
| [MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig)? | the magnification config that the service controls |

### getMagnificationRegion

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

```
fun getMagnificationRegion(): Region
```

**Deprecated:** *Use[getCurrentMagnificationRegion()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getCurrentMagnificationRegion())instead*

Returns the region of the screen currently active for magnification. Changes to magnification scale and center only affect this portion of the screen. The rest of the screen, for example input methods, cannot be magnified. This region is relative to the unscaled screen and is independent of the scale and center point.

The returned region will be empty if magnification is not active. Magnification is active if magnification gestures are enabled or if a service is running that can control magnification.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will return an empty region.

**Note:** This legacy API gets the magnification region of full-screen magnification. To get the magnification region of the current controlling magnifier, use[getCurrentMagnificationRegion()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getCurrentMagnificationRegion())instead.

|                                                                                                               Return                                                                                                                ||
|----------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------|
| [Region](https://developer.android.com/reference/kotlin/android/graphics/Region.html#) | the region of the screen currently active for magnification, or an empty region if magnification is not active. This value cannot be`null`. |

### getScale

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

```
fun getScale(): Float
```

**Deprecated:** *Use[getMagnificationConfig()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())instead*

Returns the current magnification scale.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will return a default value of`1.0f`.

**Note:** This legacy API gets the scale of full-screen magnification. To get the scale of the current controlling magnifier, use[getMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig())instead.

|                                                     Return                                                      ||
|--------------------------------------------------------------------------------|---------------------------------|
| [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html) | the current magnification scale |

### removeListener

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

```
fun removeListener(listener: AccessibilityService.MagnificationController.OnMagnificationChangedListener): Boolean
```

Removes the specified change listener from the list of magnification change listeners.

|                                                                                                                                         Parameters                                                                                                                                          ||
|------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `listener` | [AccessibilityService.MagnificationController.OnMagnificationChangedListener](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener):the listener to remove, must be non-null |

|                                                                 Return                                                                 ||
|------------------------------------------------------------------------------------|----------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`if the listener was removed,`false`otherwise |

### reset

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

```
fun reset(animate: Boolean): Boolean
```

Resets magnification scale and center to their default (e.g. no magnification) values.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will have no effect and return`false`.

**Note:** This legacy API reset full-screen magnification. To reset the current controlling magnifier, use[resetCurrentMagnification(boolean)](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#resetCurrentMagnification(kotlin.Boolean))()} instead.

|                                                                                             Parameters                                                                                              ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `animate` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`to animate from the current scale and center or`false`to reset the scale and center immediately |

|                                                         Return                                                         ||
|------------------------------------------------------------------------------------|------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`on success,`false`on failure |

### resetCurrentMagnification

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

```
fun resetCurrentMagnification(animate: Boolean): Boolean
```

Resets magnification scale and center of the controlling magnification to their default (e.g. no magnification) values.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will have no effect and return`false`.

|                                                                                             Parameters                                                                                              ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `animate` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`to animate from the current scale and center or`false`to reset the scale and center immediately |

|                                                         Return                                                         ||
|------------------------------------------------------------------------------------|------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`on success,`false`on failure |

### setCenter

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

```
fun setCenter(
    centerX: Float, 
    centerY: Float, 
    animate: Boolean
): Boolean
```

**Deprecated:** *Use[setMagnificationConfig(android.accessibilityservice.MagnificationConfig,boolean)](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20kotlin.Boolean))instead*

Sets the center of the magnified viewport.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will have no effect and return`false`.

**Note:** This legacy API sets the center of full-screen magnification. To set the center of the specified magnifier, use[setMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20kotlin.Boolean))instead.

|                                                                                       Parameters                                                                                       ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `centerX` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):the unscaled screen-relative X coordinate on which to center the viewport                    |
| `centerY` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):the unscaled screen-relative Y coordinate on which to center the viewport                    |
| `animate` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`to animate from the current viewport center or`false`to set the center immediately |

|                                                         Return                                                         ||
|------------------------------------------------------------------------------------|------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`on success,`false`on failure |

### setMagnificationConfig

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

```
fun setMagnificationConfig(
    config: MagnificationConfig, 
    animate: Boolean
): Boolean
```

Sets the[MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig). The service controls the magnification by setting the config.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will have no effect and return`false`.

|                                                                                       Parameters                                                                                       ||
|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `config`  | [MagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/MagnificationConfig):the magnification config This value cannot be`null`. |
| `animate` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`to animate from the current spec or`false`to set the spec immediately              |

|                                                         Return                                                         ||
|------------------------------------------------------------------------------------|------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`on success,`false`on failure |

### setScale

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

```
fun setScale(
    scale: Float, 
    animate: Boolean
): Boolean
```

**Deprecated:** *Use[setMagnificationConfig(android.accessibilityservice.MagnificationConfig,boolean)](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20kotlin.Boolean))instead*

Sets the magnification scale.

**Note:** If the service is not yet connected (e.g.[AccessibilityService.onServiceConnected()](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService#onServiceConnected())has not yet been called) or the service has been disconnected, this method will have no effect and return`false`.

**Note:** This legacy API sets the scale of full-screen magnification. To set the scale of the specified magnifier, use[setMagnificationConfig](https://developer.android.com/reference/kotlin/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20kotlin.Boolean))instead.

|                                                                                 Parameters                                                                                  ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `scale`   | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):the magnification scale to set, must be \>= 1 and \<= 8                           |
| `animate` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):`true`to animate from the current scale or`false`to set the scale immediately |

|                                                         Return                                                         ||
|------------------------------------------------------------------------------------|------------------------------------|
| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true`on success,`false`on failure |