MagnificationConfig


public final class MagnificationConfig
extends Object implements Parcelable

java.lang.Object
   ↳ android.accessibilityservice.MagnificationConfig


This class describes the magnification config for AccessibilityService to control the magnification.

When the magnification config uses MAGNIFICATION_MODE_DEFAULT, AccessibilityService will be able to control the activated magnifier on the display. If there is no magnifier activated, it controls the last-activated magnification mode. If there is no magnifier activated before, it controls full-screen magnifier by default.

When the magnification config uses MAGNIFICATION_MODE_FULLSCREEN. AccessibilityService will be able to control full-screen magnifier on the display.

When the magnification config uses MAGNIFICATION_MODE_WINDOW and the platform supports PackageManager.FEATURE_WINDOW_MAGNIFICATION feature. AccessibilityService will be able to control window magnifier on the display.

If the other magnification configs, scale centerX and centerY, are not set by the Builder, the configs should be current values or default values. And the center position ordinarily is the center of the screen.

Summary

Nested classes

class MagnificationConfig.Builder

Builder for creating MagnificationConfig objects. 

Constants

int MAGNIFICATION_MODE_DEFAULT

The controlling magnification mode.

int MAGNIFICATION_MODE_FULLSCREEN

The controlling magnification mode.

int MAGNIFICATION_MODE_WINDOW

The controlling magnification mode.

Inherited constants

Fields

public static final Creator<MagnificationConfig> CREATOR

Public methods

int describeContents()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.

float getCenterX()

Returns the screen-relative X coordinate of the center of the magnification viewport.

float getCenterY()

Returns the screen-relative Y coordinate of the center of the magnification viewport.

int getMode()

Returns the magnification mode that is the current activated mode or the controlling mode of the config.

float getScale()

Returns the magnification scale of the controlling magnifier

boolean isActivated()

Returns the activated state of the controlling magnifier.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel parcel, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

MAGNIFICATION_MODE_DEFAULT

Added in API level 33
public static final int MAGNIFICATION_MODE_DEFAULT

The controlling magnification mode. It controls the activated magnifier.

Constant Value: 0 (0x00000000)

MAGNIFICATION_MODE_FULLSCREEN

Added in API level 33
public static final int MAGNIFICATION_MODE_FULLSCREEN

The controlling magnification mode. It controls full-screen magnifier.

Constant Value: 1 (0x00000001)

MAGNIFICATION_MODE_WINDOW

Added in API level 33
public static final int MAGNIFICATION_MODE_WINDOW

The controlling magnification mode. It is valid if the platform supports PackageManager.FEATURE_WINDOW_MAGNIFICATION feature.

Constant Value: 2 (0x00000002)

Fields

CREATOR

Added in API level 33
public static final Creator<MagnificationConfig> CREATOR

See also:

Public methods

describeContents

Added in API level 33
public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of writeToParcel(android.os.Parcel, int), the return value of this method must include the CONTENTS_FILE_DESCRIPTOR bit.

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or CONTENTS_FILE_DESCRIPTOR

getCenterX

Added in API level 33
public float getCenterX ()

Returns the screen-relative X coordinate of the center of the magnification viewport.

Returns
float The X coordinate

getCenterY

Added in API level 33
public float getCenterY ()

Returns the screen-relative Y coordinate of the center of the magnification viewport.

Returns
float The Y coordinate

getMode

Added in API level 33
public int getMode ()

Returns the magnification mode that is the current activated mode or the controlling mode of the config.

Returns
int The magnification mode

getScale

Added in API level 33
public float getScale ()

Returns the magnification scale of the controlling magnifier

Returns
float The magnification scale

isActivated

Added in API level 34
public boolean isActivated ()

Returns the activated state of the controlling magnifier. The controlling magnifier can be activated even if the scale returned by MagnificationConfig#getScale() equals to 1.0.

Returns
boolean true if the magnifier is activated and showing on screen, false otherwise.

toString

Added in API level 33
public String toString ()

Returns a string representation of the object.

Returns
String This value cannot be null.

writeToParcel

Added in API level 33
public void writeToParcel (Parcel parcel, 
                int flags)

Flatten this object in to a Parcel.

Parameters
parcel Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES