Added in API level 34

GrammaticalInflectionManager


open class GrammaticalInflectionManager
kotlin.Any
   ↳ android.app.GrammaticalInflectionManager

This class allow applications to control granular grammatical inflection settings (such as per-app grammatical gender).

Summary

Public methods
open Int

Returns the current grammatical gender for the calling app.

open Int

Allows privileged preloaded applications to get the system grammatical gender when set.

open Unit

Sets the current grammatical gender for the calling app (keyed by package name and user ID retrieved from the calling pid).

Public methods

getApplicationGrammaticalGender

Added in API level 34
open fun getApplicationGrammaticalGender(): Int

Returns the current grammatical gender for the calling app. A new value can be requested via setRequestedApplicationGrammaticalGender(int) and will be updated with a new configuration change. The method always returns the value received with the last received configuration change.

Return
Int the value of grammatical gender Value is android.content.res.Configuration#GRAMMATICAL_GENDER_NOT_SPECIFIED, android.content.res.Configuration#GRAMMATICAL_GENDER_NEUTRAL, android.content.res.Configuration#GRAMMATICAL_GENDER_FEMININE, or android.content.res.Configuration#GRAMMATICAL_GENDER_MASCULINE

getSystemGrammaticalGender

open fun getSystemGrammaticalGender(): Int

Allows privileged preloaded applications to get the system grammatical gender when set.
Requires android.Manifest.permission.READ_SYSTEM_GRAMMATICAL_GENDER

Return
Int The value of system grammatical gender only if the calling app has the permission, otherwise throwing an exception. Value is android.content.res.Configuration#GRAMMATICAL_GENDER_NOT_SPECIFIED, android.content.res.Configuration#GRAMMATICAL_GENDER_NEUTRAL, android.content.res.Configuration#GRAMMATICAL_GENDER_FEMININE, or android.content.res.Configuration#GRAMMATICAL_GENDER_MASCULINE
Exceptions
java.lang.SecurityException If the caller does not have the required permission.

setRequestedApplicationGrammaticalGender

Added in API level 34
open fun setRequestedApplicationGrammaticalGender(grammaticalGender: Int): Unit

Sets the current grammatical gender for the calling app (keyed by package name and user ID retrieved from the calling pid).

Note: Changes to app grammatical gender will result in a configuration change (and potentially an Activity re-creation) being applied to the specified application. For more information, see the section on handling configuration changes. The set grammatical gender are persisted across application restarts; they are backed up if the user has enabled Backup & Restore.`

Parameters
grammaticalGender Int: the terms of address the user preferred in an application. Value is android.content.res.Configuration#GRAMMATICAL_GENDER_NOT_SPECIFIED, android.content.res.Configuration#GRAMMATICAL_GENDER_NEUTRAL, android.content.res.Configuration#GRAMMATICAL_GENDER_FEMININE, or android.content.res.Configuration#GRAMMATICAL_GENDER_MASCULINE