TranslationCapability


public final class TranslationCapability
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.translation.TranslationCapability


Capability class holding information for a pair of TranslationSpecs.

Holds information and limitations on how to create a TranslationContext which can be used by TranslationManager#createOnDeviceTranslator(TranslationContext, Executor, Consumer).

Summary

Constants

int STATE_AVAILABLE_TO_DOWNLOAD

The translation service supports translation between the source and target specs, and it is ready to be downloaded onto the device.

int STATE_DOWNLOADING

The translation service supports translation between the source and target specs, and it is being downloaded onto the device currently.

int STATE_NOT_AVAILABLE

The translation service does not support translation between the source and target specs.

int STATE_ON_DEVICE

The translation service supports translation between the source and target specs, and it is downloaded and ready to use on device.

Inherited constants

Fields

public static final Creator<TranslationCapability> CREATOR

Public methods

int describeContents()

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

TranslationSpec getSourceSpec()

TranslationSpec describing the source data specs for this capability.

int getState()

The state of translation readiness between mSourceSpec and mTargetSpec.

int getSupportedTranslationFlags()

Translation flags for settings that are supported by the translation service between the TranslationSpecs provided in this capability.

TranslationSpec getTargetSpec()

TranslationSpec describing the target data specs for this capability.

boolean isUiTranslationEnabled()

Whether ui translation for the source-target TranslationSpecs is enabled.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Flatten this object in to a Parcel.

Inherited methods

Constants

STATE_AVAILABLE_TO_DOWNLOAD

Added in API level 31
public static final int STATE_AVAILABLE_TO_DOWNLOAD

The translation service supports translation between the source and target specs, and it is ready to be downloaded onto the device.
Value is STATE_AVAILABLE_TO_DOWNLOAD, STATE_DOWNLOADING, STATE_ON_DEVICE, STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Constant Value: 1 (0x00000001)

STATE_DOWNLOADING

Added in API level 31
public static final int STATE_DOWNLOADING

The translation service supports translation between the source and target specs, and it is being downloaded onto the device currently.
Value is STATE_AVAILABLE_TO_DOWNLOAD, STATE_DOWNLOADING, STATE_ON_DEVICE, STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Constant Value: 2 (0x00000002)

STATE_NOT_AVAILABLE

Added in API level 31
public static final int STATE_NOT_AVAILABLE

The translation service does not support translation between the source and target specs.

Note: This state is not returned from calling TranslationManager#getOnDeviceTranslationCapabilities. This state will only appear as part of capability updates from TranslationManager#addOnDeviceTranslationCapabilityUpdateListener if existing support was dropped.


Value is STATE_AVAILABLE_TO_DOWNLOAD, STATE_DOWNLOADING, STATE_ON_DEVICE, STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Constant Value: 4 (0x00000004)

STATE_ON_DEVICE

Added in API level 31
public static final int STATE_ON_DEVICE

The translation service supports translation between the source and target specs, and it is downloaded and ready to use on device.
Value is STATE_AVAILABLE_TO_DOWNLOAD, STATE_DOWNLOADING, STATE_ON_DEVICE, STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

Constant Value: 3 (0x00000003)

Fields

CREATOR

Added in API level 31
public static final Creator<TranslationCapability> CREATOR

Public methods

describeContents

Added in API level 31
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

getSourceSpec

Added in API level 31
public TranslationSpec getSourceSpec ()

TranslationSpec describing the source data specs for this capability.

Returns
TranslationSpec This value cannot be null.

getState

Added in API level 31
public int getState ()

The state of translation readiness between mSourceSpec and mTargetSpec.

Returns
int Value is STATE_AVAILABLE_TO_DOWNLOAD, STATE_DOWNLOADING, STATE_ON_DEVICE, STATE_NOT_AVAILABLE, or android.view.translation.TranslationCapability.STATE_REMOVED_AND_AVAILABLE

getSupportedTranslationFlags

Added in API level 31
public int getSupportedTranslationFlags ()

Translation flags for settings that are supported by the translation service between the TranslationSpecs provided in this capability.

Returns
int Value is either 0 or a combination of TranslationContext.FLAG_LOW_LATENCY, TranslationContext.FLAG_TRANSLITERATION, and TranslationContext.FLAG_DEFINITIONS

getTargetSpec

Added in API level 31
public TranslationSpec getTargetSpec ()

TranslationSpec describing the target data specs for this capability.

Returns
TranslationSpec This value cannot be null.

isUiTranslationEnabled

Added in API level 31
public boolean isUiTranslationEnabled ()

Whether ui translation for the source-target TranslationSpecs is enabled.

Translation service will still support translation requests for this capability.

Returns
boolean

toString

Added in API level 31
public String toString ()

Returns a string representation of the object.

Returns
String a string representation of the object.

writeToParcel

Added in API level 31
public void writeToParcel (Parcel dest, 
                int flags)

Flatten this object in to a Parcel.

Parameters
dest 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