Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#nestedclasses) \| [Methods](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#inhmethods)

# AccessibilityService.MagnificationController

*** ** * ** ***

` public static final class AccessibilityService.MagnificationController `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.accessibilityservice.AccessibilityService.MagnificationController |

<br />

*** ** * ** ***

Used to control and query the state of display magnification.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener` Listener for changes in the state of magnification. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#addListener(android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener,%20android.os.Handler)(https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener listener, https://developer.android.com/reference/android/os/Handler handler) ` Adds the specified change listener to the list of magnification change listeners. |
| ` void` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#addListener(android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener)(https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener listener) ` Adds the specified change listener to the list of magnification change listeners. |
| ` float` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getCenterX()() ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead* |
| ` float` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getCenterY()() ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead* |
| ` https://developer.android.com/reference/android/graphics/Region` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getCurrentMagnificationRegion()() ` Returns the region of the screen currently active for magnification if the controlling magnification is `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN`. |
| ` https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()() ` Gets the `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig` of the controlling magnifier on the display. |
| ` https://developer.android.com/reference/android/graphics/Region` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationRegion()() ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getCurrentMagnificationRegion()` instead* |
| ` float` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getScale()() ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead* |
| ` boolean` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#removeListener(android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener)(https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController.OnMagnificationChangedListener listener) ` Removes the specified change listener from the list of magnification change listeners. |
| ` boolean` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#reset(boolean)(boolean animate) ` Resets magnification scale and center to their default (e.g. no magnification) values. |
| ` boolean` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#resetCurrentMagnification(boolean)(boolean animate) ` Resets magnification scale and center of the controlling magnification to their default (e.g. no magnification) values. |
| ` boolean` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setCenter(float,%20float,%20boolean)(float centerX, float centerY, boolean animate) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)` instead* |
| ` boolean` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)(https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig config, boolean animate) ` Sets the `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig`. |
| ` boolean` | ` https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setScale(float,%20boolean)(float scale, boolean animate) ` *This method was deprecated in API level 33. Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)` instead* |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public methods

### addListener

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

```
public void addListener (AccessibilityService.MagnificationController.OnMagnificationChangedListener listener, 
                Handler handler)
```

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

<br />

| Parameters ||
|---|---|
| `listener` | `AccessibilityService.MagnificationController.OnMagnificationChangedListener`: the listener to add, must be non-null <br /> |
| `handler` | `Handler`: the handler on which the callback should execute, or `null` to execute on the service's main thread <br /> |

### addListener

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

```
public void addListener (AccessibilityService.MagnificationController.OnMagnificationChangedListener listener)
```

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

<br />

| Parameters ||
|---|---|
| `listener` | `AccessibilityService.MagnificationController.OnMagnificationChangedListener`: the listener to add, must be non-`null` <br /> |

### getCenterX

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

```
public float getCenterX ()
```

<br />

**This method was deprecated in API level 33.**   

Use `https://developer.android.com/reference/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. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead.

<br />

<br />

| Returns ||
|---|---|
| `float` | the unscaled screen-relative X coordinate of the center of the magnified region <br /> |

### getCenterY

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

```
public float getCenterY ()
```

<br />

**This method was deprecated in API level 33.**   

Use `https://developer.android.com/reference/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. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead.

<br />

<br />

| Returns ||
|---|---|
| `float` | the unscaled screen-relative Y coordinate of the center of the magnified region <br /> |

### getCurrentMagnificationRegion

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

```
public Region getCurrentMagnificationRegion ()
```

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

If the controlling mode is `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_FULLSCREEN`, 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 `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig#MAGNIFICATION_MODE_WINDOW`, the returned region will be empty if the magnification is not activated.

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

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Region` | the magnification region of the currently controlling magnification. This value cannot be `null`. <br /> |

### getMagnificationConfig

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

```
public MagnificationConfig getMagnificationConfig ()
```

Gets the `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig` of the controlling magnifier on the display.

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

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig` | the magnification config that the service controls <br /> |

### getMagnificationRegion

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

```
public Region getMagnificationRegion ()
```

<br />

**This method was deprecated in API level 33.**   

Use `https://developer.android.com/reference/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. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getCurrentMagnificationRegion()` instead.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/Region` | the region of the screen currently active for magnification, or an empty region if magnification is not active. This value cannot be `null`. <br /> |

### getScale

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

```
public float getScale ()
```

<br />

**This method was deprecated in API level 33.**   

Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead

Returns the current magnification scale.

**Note:** If the service is not yet connected (e.g. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#getMagnificationConfig()` instead.

<br />

<br />

| Returns ||
|---|---|
| `float` | the current magnification scale <br /> |

### removeListener

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

```
public boolean removeListener (AccessibilityService.MagnificationController.OnMagnificationChangedListener listener)
```

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

<br />

| Parameters ||
|---|---|
| `listener` | `AccessibilityService.MagnificationController.OnMagnificationChangedListener`: the listener to remove, must be non-null <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the listener was removed, `false` otherwise <br /> |

### reset

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

```
public boolean reset (boolean animate)
```

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

**Note:** If the service is not yet connected (e.g. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#resetCurrentMagnification(boolean)` ()} instead.

<br />

<br />

| Parameters ||
|---|---|
| `animate` | `boolean`: `true` to animate from the current scale and center or `false` to reset the scale and center immediately <br /> |

| Returns ||
|---|---|
| `boolean` | `true` on success, `false` on failure <br /> |

### resetCurrentMagnification

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

```
public boolean resetCurrentMagnification (boolean animate)
```

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. `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService#onServiceConnected()` has not yet been called) or the service has been disconnected, this method will have no effect and return `false`.

<br />

<br />

| Parameters ||
|---|---|
| `animate` | `boolean`: `true` to animate from the current scale and center or `false` to reset the scale and center immediately <br /> |

| Returns ||
|---|---|
| `boolean` | `true` on success, `false` on failure <br /> |

### setCenter

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

```
public boolean setCenter (float centerX, 
                float centerY, 
                boolean animate)
```

<br />

**This method was deprecated in API level 33.**   

Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)` instead

Sets the center of the magnified viewport.

**Note:** If the service is not yet connected (e.g. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)` instead.

<br />

<br />

| Parameters ||
|---|---|
| `centerX` | `float`: the unscaled screen-relative X coordinate on which to center the viewport <br /> |
| `centerY` | `float`: the unscaled screen-relative Y coordinate on which to center the viewport <br /> |
| `animate` | `boolean`: `true` to animate from the current viewport center or `false` to set the center immediately <br /> |

| Returns ||
|---|---|
| `boolean` | `true` on success, `false` on failure <br /> |

### setMagnificationConfig

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

```
public boolean setMagnificationConfig (MagnificationConfig config, 
                boolean animate)
```

Sets the `https://developer.android.com/reference/android/accessibilityservice/MagnificationConfig`. The service controls the magnification by setting the config.

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

<br />

<br />

| Parameters ||
|---|---|
| `config` | `MagnificationConfig`: the magnification config. This value cannot be `null`. <br /> |
| `animate` | `boolean`: `true` to animate from the current spec or `false` to set the spec immediately <br /> |

| Returns ||
|---|---|
| `boolean` | `true` on success, `false` on failure <br /> |

### setScale

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

```
public boolean setScale (float scale, 
                boolean animate)
```

<br />

**This method was deprecated in API level 33.**   

Use `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)` instead

Sets the magnification scale.

**Note:** If the service is not yet connected (e.g. `https://developer.android.com/reference/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 `https://developer.android.com/reference/android/accessibilityservice/AccessibilityService.MagnificationController#setMagnificationConfig(android.accessibilityservice.MagnificationConfig,%20boolean)` instead.

<br />

<br />

| Parameters ||
|---|---|
| `scale` | `float`: the magnification scale to set, must be \>= 1 and \<= 8 <br /> |
| `animate` | `boolean`: `true` to animate from the current scale or `false` to set the scale immediately <br /> |

| Returns ||
|---|---|
| `boolean` | `true` on success, `false` on failure <br /> |