# SecurityStateManagerCompat

Artifact: [androidx.security:security-state](https://developer.android.com/jetpack/androidx/releases/security) [View Source](https://cs.android.com/search?q=file:androidx/security/state/SecurityStateManagerCompat.kt+class:androidx.security.state.SecurityStateManagerCompat) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/security#1.0.0)

*** ** * ** ***


```
open class SecurityStateManagerCompat
```

<br />

*** ** * ** ***

This class is a wrapper around AOSP `https://developer.android.com/reference/android/os/SecurityStateManager.html` service API added in SDK 35. Support for features on older SDKs is provided on a best effort basis.

Manages the retrieval and storage of security patch levels and module information for an Android device. This class provides methods to fetch the current security state of the system, including patch levels for the system, vendor, and kernel as well as module updates available through Android's update system.

It utilizes Android's PackageManager and other system services to retrieve detailed security-related information, which is crucial for maintaining the security integrity of the device.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#KEY_KERNEL_VERSION()` The kernel version key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#KEY_SYSTEM_SPL()` The system SPL key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#KEY_SYSTEM_SUPPLEMENTAL_PATCHES()` The system supplemental patches key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#KEY_VENDOR_SPL()` The vendor SPL key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#KEY_VENDOR_SUPPLEMENTAL_PATCHES()` The vendor supplemental patches key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#SecurityStateManagerCompat(android.content.Context,kotlin.Array,kotlin.Array)( context: https://developer.android.com/reference/android/content/Context.html, systemSupplementalPatchConfigFiles: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html>, vendorSupplementalPatchConfigFiles: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html> )` |

| ### Public functions |
|---|---|
| `open https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/security/state/SecurityStateManagerCompat#getGlobalSecurityState(kotlin.String)(moduleMetadataProviderPackageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Retrieves the global security state of the device, compiling various security patch levels and module information into a Bundle. |

## Constants

### KEY_KERNEL_VERSION

```
const val KEY_KERNEL_VERSION: String
```

The kernel version key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}.

The value is a {@code String} representing the kernel version in "X.X.XX" format.

### KEY_SYSTEM_SPL

```
const val KEY_SYSTEM_SPL: String
```

The system SPL key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}.

The value is a {@code String} representing the security patch level in "YYYY-MM-DD" format.

### KEY_SYSTEM_SUPPLEMENTAL_PATCHES

```
const val KEY_SYSTEM_SUPPLEMENTAL_PATCHES: String
```

The system supplemental patches key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}.

The value is a {@code String\[\]} containing CVE IDs.

### KEY_VENDOR_SPL

```
const val KEY_VENDOR_SPL: String
```

The vendor SPL key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}.

The value is a {@code String} representing the security patch level in "YYYY-MM-DD" format.

### KEY_VENDOR_SUPPLEMENTAL_PATCHES

```
const val KEY_VENDOR_SUPPLEMENTAL_PATCHES: String
```

The vendor supplemental patches key returned as part of the {@code Bundle} from {@code getGlobalSecurityState}.

The value is a {@code String\[\]} containing CVE IDs.

## Public constructors

### SecurityStateManagerCompat

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/security#1.1.0)

```
SecurityStateManagerCompat(
    context: Context,
    systemSupplementalPatchConfigFiles: Array<String> = SYSTEM_SUPPLEMENTAL_PATCH_CONFIG_FILES,
    vendorSupplementalPatchConfigFiles: Array<String> = VENDOR_SUPPLEMENTAL_PATCH_CONFIG_FILES
)
```

## Public functions

### getGlobalSecurityState

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/security#1.0.0)

```
open fun getGlobalSecurityState(
    moduleMetadataProviderPackageName: String = ANDROID_MODULE_METADATA_PROVIDER
): Bundle
```

Retrieves the global security state of the device, compiling various security patch levels and module information into a Bundle. This method can optionally use Google's module metadata providers to enhance the data returned.

| Parameters |
|---|---|
| `moduleMetadataProviderPackageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html = ANDROID_MODULE_METADATA_PROVIDER` | Specifies package name for system modules metadata. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | A Bundle containing keys and values representing the security state of the system, vendor, and kernel. |