# PackageManager.ComponentEnabledSetting

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

# ComponentEnabledSetting

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/content/pm/PackageManager.ComponentEnabledSetting "View this page in Java")  

```
class ComponentEnabledSetting : Parcelable
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                         ||
| ↳ | [android.content.pm.PackageManager.ComponentEnabledSetting](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#) |

The class containing the enabled setting of a package component.

This is used by the[setComponentEnabledSettings(java.util.List)](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#setComponentEnabledSettings(kotlin.collections.MutableList))to support the batch updates of the enabled settings of components.

## Summary

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                                                                                                                           Public constructors                                                                                                                                                                                                                                                                                                            ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [ComponentEnabledSetting](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#ComponentEnabledSetting(android.content.ComponentName,%20kotlin.Int,%20kotlin.Int))`(`componentName:` `[ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)`, `newState:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Create an instance of the ComponentEnabledSetting for the component level's enabled setting update. |

|                                                                                                                                                                                                                                             Public methods                                                                                                                                                                                                                                              ||
|------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                           | [describeContents](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#describeContents())`()` <br />                                                                                                                                                                                                                                        |
| [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)? | [getComponentName](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#getComponentName())`()` The component name of the application to enable the setting.                                                                                                                                                                                  |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                           | [getEnabledFlags](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#getEnabledFlags())`()` The optional behavior flag                                                                                                                                                                                                                      |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                           | [getEnabledState](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#getEnabledState())`()` The new enabled state                                                                                                                                                                                                                           |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                         | [writeToParcel](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Flatten this object in to a Parcel. |

|                                                                                                                                                                                                                Properties                                                                                                                                                                                                                ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[PackageManager.ComponentEnabledSetting](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager.ComponentEnabledSetting#CREATOR:android.os.Parcelable.Creator) <br /> |

## Public constructors

### ComponentEnabledSetting

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

```
ComponentEnabledSetting(
    componentName: ComponentName, 
    newState: Int, 
    flags: Int)
```

Create an instance of the ComponentEnabledSetting for the component level's enabled setting update.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `componentName` | [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#):The component name to update the enabled setting. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `newState`      | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The new enabled state. Value is[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DEFAULT](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DEFAULT:kotlin.Int),[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_ENABLED](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_ENABLED:kotlin.Int),[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DISABLED:kotlin.Int),[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER:kotlin.Int), or[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:kotlin.Int) |
| `flags`         | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):The optional behavior flags. Value is either`0`or a combination of[android.content.pm.PackageManager#DONT_KILL_APP](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#DONT_KILL_APP:kotlin.Int), and[android.content.pm.PackageManager#SYNCHRONOUS](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#SYNCHRONOUS:kotlin.Int)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

## Public methods

### describeContents

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

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### getComponentName

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

```
fun getComponentName(): ComponentName?
```

The component name of the application to enable the setting.

|                                                             Return                                                             ||
|------------------------------------------------------------------------------------------------------|--------------------------|
| [ComponentName](https://developer.android.com/reference/kotlin/android/content/ComponentName.html#)? | This value may be`null`. |

### getEnabledFlags

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

```
fun getEnabledFlags(): Int
```

The optional behavior flag

|                                                                                                                                                                                                                   Return                                                                                                                                                                                                                   ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is either`0`or a combination of[android.content.pm.PackageManager#DONT_KILL_APP](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#DONT_KILL_APP:kotlin.Int), and[android.content.pm.PackageManager#SYNCHRONOUS](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#SYNCHRONOUS:kotlin.Int) |

### getEnabledState

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

```
fun getEnabledState(): Int
```

The new enabled state

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Return                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ||
|----------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DEFAULT](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DEFAULT:kotlin.Int),[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_ENABLED](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_ENABLED:kotlin.Int),[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DISABLED:kotlin.Int),[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DISABLED_USER:kotlin.Int), or[android.content.pm.PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED](https://developer.android.com/reference/kotlin/android/content/pm/PackageManager#COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED:kotlin.Int) |

### writeToParcel

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

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

Flatten this object in to a Parcel.

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#):This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

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

```
static val CREATOR: Parcelable.Creator<PackageManager.ComponentEnabledSetting!>
```