# androidx.core.os

*** ** * ** ***

## Interfaces

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/os/CancellationSignal.OnCancelListener` | **This interface is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/kotlin/androidx/core/os/OutcomeReceiverCompat` | Callback interface intended for use when an asynchronous operation may result in a failure. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ParcelableCompatCreatorCallbacks` | **This interface is deprecated.** Use `https://developer.android.com/reference/android/os/Parcelable.ClassLoaderCreator.html` directly. <br /> |

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/os/BufferFillPolicy` |   |
| `https://developer.android.com/reference/kotlin/androidx/core/os/BundleCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/CancellationSignal` | **This class is deprecated.** This class was added to the platform in SDK 16, which is below Jetpack's minimum SDK requirement. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ConfigurationCompat` | Helper class which allows access to properties of `https://developer.android.com/reference/android/content/res/Configuration.html` in a backward compatible fashion. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/EnvironmentCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/Environment.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ExecutorCompat` | Helper for accessing features in `https://developer.android.com/reference/java/util/concurrent/Executor.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/HandlerCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/Handler.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/HeapProfileRequestBuilder` | Request builder to create a request for a heap profile from `https://developer.android.com/reference/android/os/ProfilingManager.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/JavaHeapDumpRequestBuilder` | Request builder to create a request for a java heap dump from `https://developer.android.com/reference/android/os/ProfilingManager.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/LocaleListCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/LocaleList.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/MessageCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/Message.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ParcelCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/Parcel.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ParcelableCompat` | **This class is deprecated.** Use `https://developer.android.com/reference/android/os/Parcelable.ClassLoaderCreator.html` directly. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ProcessCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/Process.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ProfilingRequest` | Profiling request class containing data to submit a profiling request. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/ProfilingRequestBuilder` | Base class for request builders. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/StackSamplingRequestBuilder` | Request builder to create a request for stack sampling from `https://developer.android.com/reference/android/os/ProfilingManager.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/SystemTraceRequestBuilder` | Request builder to create a request for a system trace from `https://developer.android.com/reference/android/os/ProfilingManager.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/TraceCompat` | **This class is deprecated.** TraceCompat is deprecated in favor of androidx.tracing.Trace. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/core/os/UserHandleCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/UserHandle.html` in a backwards compatible fashion. |
| `https://developer.android.com/reference/kotlin/androidx/core/os/UserManagerCompat` | Helper for accessing features in `https://developer.android.com/reference/android/os/UserManager.html` in a backwards compatible fashion. |

## Exceptions

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/os/OperationCanceledException` | An exception type that is thrown when an operation in progress is canceled. |

## Objects

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/os/BuildCompat` | This class contains additional platform version checking methods for targeting pre-release versions of Android. |

## Annotations

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/os/BuildCompat.PrereleaseSdkCheck` | Experimental feature set for pre-release SDK checks. |

## Top-level functions summary

|---|---|
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#bundleOf()()` Returns a new empty `https://developer.android.com/reference/android/os/Bundle.html`. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `[bundleOf](https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#bundleOf(kotlin.Array))(vararg pairs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>)` **This function is deprecated.** This method does not provide type safety at compile time. |
| `https://developer.android.com/reference/android/os/PersistableBundle.html` | `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#persistableBundleOf()()` Returns a new empty `https://developer.android.com/reference/android/os/PersistableBundle.html`. |
| `https://developer.android.com/reference/android/os/PersistableBundle.html` | `[persistableBundleOf](https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#persistableBundleOf(kotlin.Array))(vararg pairs: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-pair/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>)` **This function is deprecated.** This method does not provide type safety at compile time. |
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://developer.android.com/reference/android/os/ProfilingResult.html>` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(api = 35) https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#registerForAllProfilingResults(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Obtain a flow to be called with all profiling results for this UID. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(api = 35) https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#registerForAllProfilingResults(android.content.Context,java.util.concurrent.Executor,java.util.function.Consumer)( context: https://developer.android.com/reference/android/content/Context.html, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, listener: https://developer.android.com/reference/java/util/function/Consumer.html<https://developer.android.com/reference/android/os/ProfilingResult.html> )` Register a listener to be called with all profiling results for this UID. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(api = 35) https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#requestProfiling(android.content.Context,androidx.core.os.ProfilingRequest,java.util.concurrent.Executor,java.util.function.Consumer)( context: https://developer.android.com/reference/android/content/Context.html, profilingRequest: https://developer.android.com/reference/kotlin/androidx/core/os/ProfilingRequest, executor: https://developer.android.com/reference/java/util/concurrent/Executor.html?, listener: https://developer.android.com/reference/java/util/function/Consumer.html<https://developer.android.com/reference/android/os/ProfilingResult.html>? )` Request profiling using a `https://developer.android.com/reference/kotlin/androidx/core/os/ProfilingRequest` generated by one of the provided builders. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> [trace](https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#trace(kotlin.String,kotlin.Function0))(sectionName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, block: () -> T)` **This function is deprecated.** Use androidx.tracing.Trace instead |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(api = 35) https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#unregisterForAllProfilingResults(android.content.Context,java.util.function.Consumer)( context: https://developer.android.com/reference/android/content/Context.html, listener: https://developer.android.com/reference/java/util/function/Consumer.html<https://developer.android.com/reference/android/os/ProfilingResult.html> )` Unregister a listener that was to be called for all profiling results. |

## Extension functions summary

|---|---|
| `https://developer.android.com/reference/android/os/OutcomeReceiver.html<R, E>` | `@https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi(value = 31) <R : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, E : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-throwable/index.html> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-continuation/index.html<R>.https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(kotlin.coroutines.Continuation).asOutcomeReceiver()()` Returns an `https://developer.android.com/reference/android/os/OutcomeReceiver.html` that will resume this `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-continuation/index.html` when an outcome is reported. |
| `inline https://developer.android.com/reference/java/lang/Runnable.html` | `https://developer.android.com/reference/android/os/Handler.html.https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(android.os.Handler).postAtTime(kotlin.Long,kotlin.Any,kotlin.Function0)( uptimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, token: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, crossinline action: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Version of `https://developer.android.com/reference/android/os/Handler.html#postAtTime(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses. |
| `inline https://developer.android.com/reference/java/lang/Runnable.html` | `https://developer.android.com/reference/android/os/Handler.html.https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(android.os.Handler).postDelayed(kotlin.Long,kotlin.Any,kotlin.Function0)( delayInMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html, token: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?, crossinline action: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html )` Version of `https://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses. |
| `https://developer.android.com/reference/android/os/PersistableBundle.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?>.https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(kotlin.collections.Map).toPersistableBundle()()` Covert this map to a `https://developer.android.com/reference/android/os/PersistableBundle.html` with the key/value pairs as elements. |
| `inline T` | `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/android/os/Parcel.html.https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(android.os.Parcel).use(kotlin.Function1)(block: (https://developer.android.com/reference/android/os/Parcel.html) -> T)` Executes the given `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(android.os.Parcel).use(kotlin.Function1)` function on `https://developer.android.com/reference/android/os/Parcel.html` resource and then `https://developer.android.com/reference/android/os/Parcel.html#recycle()`. |

## Top-level functions

### bundleOf

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Bundle.kt+function:bundleOf) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
fun bundleOf(): Bundle
```

Returns a new empty `https://developer.android.com/reference/android/os/Bundle.html`.

### bundleOf

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Bundle.kt+function:bundleOf)

```
fun [bundleOf](https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#bundleOf(kotlin.Array))(vararg pairs: Pair<String, Any?>): Bundle
```

> [!CAUTION]
> **This function is deprecated.**   
> This method does not provide type safety at compile time. Use the platform \`Bundle\` class directly instead.

Returns a new `https://developer.android.com/reference/android/os/Bundle.html` with the given key/value pairs as elements.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | When a value is not a supported type of `https://developer.android.com/reference/android/os/Bundle.html`. |

### persistableBundleOf

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/PersistableBundle.kt+function:persistableBundleOf) Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/core#1.8.0)

```
fun persistableBundleOf(): PersistableBundle
```

Returns a new empty `https://developer.android.com/reference/android/os/PersistableBundle.html`.

### persistableBundleOf

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/PersistableBundle.kt+function:persistableBundleOf)

```
fun [persistableBundleOf](https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#persistableBundleOf(kotlin.Array))(vararg pairs: Pair<String, Any?>): PersistableBundle
```

> [!CAUTION]
> **This function is deprecated.**   
> This method does not provide type safety at compile time. Use the platform \`PersistableBundle\` class directly instead.

Returns a new `https://developer.android.com/reference/android/os/PersistableBundle.html` with the given key/value pairs as elements.

Supported value types are `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html`, and `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` and arrays of these types.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | When a value is not a supported type of `https://developer.android.com/reference/android/os/PersistableBundle.html`. |

### registerForAllProfilingResults

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Profiling.kt+function:registerForAllProfilingResults) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
@RequiresApi(api = 35)
fun registerForAllProfilingResults(context: Context): Flow<ProfilingResult>
```

Obtain a flow to be called with all profiling results for this UID.

```kotlin
val flow = registerForAllProfilingResults(context)

flow
    .flowOn(Dispatchers.IO) // Consume files on a background thread
    .collect { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }
```

### registerForAllProfilingResults

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Profiling.kt+function:registerForAllProfilingResults) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
@RequiresApi(api = 35)
fun registerForAllProfilingResults(
    context: Context,
    executor: Executor,
    listener: Consumer<ProfilingResult>
): Unit
```

Register a listener to be called with all profiling results for this UID.

```kotlin
val listener =
    Consumer<ProfilingResult> { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }

registerForAllProfilingResults(
    context,
    Dispatchers.IO.asExecutor(), // Your choice of executor for the callback to occur on.
    listener,
)
```

### requestProfiling

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Profiling.kt+function:requestProfiling) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
@RequiresApi(api = 35)
fun requestProfiling(
    context: Context,
    profilingRequest: ProfilingRequest,
    executor: Executor?,
    listener: Consumer<ProfilingResult>?
): Unit
```

Request profiling using a `https://developer.android.com/reference/kotlin/androidx/core/os/ProfilingRequest` generated by one of the provided builders.

If the executor and/or listener are null, and if no global listener and executor combinations are registered using `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#registerForAllProfilingResults(android.content.Context)`, the request will be dropped.

Requests will be rate limited and are not guaranteed to be filled.

There might be a delay before profiling begins. For continuous profiling types (system tracing, stack sampling, and heap profiling), we recommend starting the collection early and stopping it with cancellationSignal, set on the `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#requestProfiling(android.content.Context,androidx.core.os.ProfilingRequest,java.util.concurrent.Executor,java.util.function.Consumer)` builder, immediately after the area of interest to ensure that the section you want profiled is captured. For heap dumps, we recommend testing locally to ensure that the heap dump is collected at the proper time.

```kotlin
val listener =
    Consumer<ProfilingResult> { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }

requestProfiling(
    context,
    JavaHeapDumpRequestBuilder()
        .setBufferSizeKb(123 /* Requested buffer size in KB */)
        .setTag("tag" /* Caller supplied tag for identification */)
        .build(),
    Dispatchers.IO.asExecutor(), // Your choice of executor for the callback to occur on.
    listener,
)
```

```kotlin
val listener =
    Consumer<ProfilingResult> { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }

val cancellationSignal = CancellationSignal()

requestProfiling(
    context,
    HeapProfileRequestBuilder()
        .setBufferSizeKb(1000 /* Requested buffer size in KB */)
        .setDurationMs(5 * 1000 /* Requested profiling duration in milliseconds */)
        .setTrackJavaAllocations(true)
        .setSamplingIntervalBytes(100 /* Requested sampling interval in bytes */)
        .setTag("tag" /* Caller supplied tag for identification */)
        .setCancellationSignal(cancellationSignal)
        .build(),
    Dispatchers.IO.asExecutor(), // Your choice of executor for the callback to occur on.
    listener,
)

// Optionally, wait for something interesting to happen and then stop the profiling to receive
// the result as is.
cancellationSignal.cancel()
```

```kotlin
val listener =
    Consumer<ProfilingResult> { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }

val cancellationSignal = CancellationSignal()

requestProfiling(
    context,
    StackSamplingRequestBuilder()
        .setBufferSizeKb(1000 /* Requested buffer size in KB */)
        .setDurationMs(10 * 1000 /* Requested profiling duration in millisconds */)
        .setSamplingFrequencyHz(100 /* Requested sampling frequency */)
        .setTag("tag" /* Caller supplied tag for identification */)
        .setCancellationSignal(cancellationSignal)
        .build(),
    Dispatchers.IO.asExecutor(), // Your choice of executor for the callback to occur on.
    listener,
)

// Optionally, wait for something interesting to happen and then stop the profiling to receive
// the result as is.
cancellationSignal.cancel()
```

```kotlin
val listener =
    Consumer<ProfilingResult> { profilingResult ->
        if (profilingResult.errorCode == ProfilingResult.ERROR_NONE) {
            doSomethingWithMyFile(profilingResult.resultFilePath)
        } else {
            doSomethingWithFailure(profilingResult.errorCode, profilingResult.errorMessage)
        }
    }

val cancellationSignal = CancellationSignal()

requestProfiling(
    context,
    SystemTraceRequestBuilder()
        .setBufferSizeKb(1000 /* Requested buffer size in KB */)
        .setDurationMs(60 * 1000 /* Requested profiling duration in millisconds */)
        .setBufferFillPolicy(BufferFillPolicy.RING_BUFFER /* Buffer fill policy */)
        .setTag("tag" /* Caller supplied tag for identification */)
        .setCancellationSignal(cancellationSignal)
        .build(),
    Dispatchers.IO.asExecutor(), // Your choice of executor for the callback to occur on.
    listener,
)

// Optionally, wait for something interesting to happen and then stop the profiling to receive
// the result as is.
cancellationSignal.cancel()
```

### trace

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Trace.kt+function:trace) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0) Deprecated in [1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)

```
inline fun <T : Any?> [trace](https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#trace(kotlin.String,kotlin.Function0))(sectionName: String, block: () -> T): T
```

> [!CAUTION]
> **This function is deprecated.**   
> Use androidx.tracing.Trace instead, use this instead:
>
> ```kotlin
> trace(sectionName, block)
> ```

Wrap the specified `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#trace(kotlin.String,kotlin.Function0)` in calls to `https://developer.android.com/reference/android/os/Trace.html#beginSection(java.lang.String)` (with the supplied `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#trace(kotlin.String,kotlin.Function0)`) and `https://developer.android.com/reference/android/os/Trace.html#endSection()`.

### unregisterForAllProfilingResults

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Profiling.kt+function:unregisterForAllProfilingResults) Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
@RequiresApi(api = 35)
fun unregisterForAllProfilingResults(
    context: Context,
    listener: Consumer<ProfilingResult>
): Unit
```

Unregister a listener that was to be called for all profiling results.

## Extension functions

### Continuation.asOutcomeReceiver

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/OutcomeReceiver.kt+function:asOutcomeReceiver)

```
@RequiresApi(value = 31)
fun <R : Any?, E : Throwable> Continuation<R>.asOutcomeReceiver(): OutcomeReceiver<R, E>
```

Returns an `https://developer.android.com/reference/android/os/OutcomeReceiver.html` that will resume this `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.coroutines/-continuation/index.html` when an outcome is reported.

Useful for writing `suspend` bindings to async Android platform methods that accept `https://developer.android.com/reference/android/os/OutcomeReceiver.html`:

```kotlin
public suspend fun FancinessManager.query(
    query: FancinessManager.Query
): FancinessManager.QueryResult = suspendCancellableCoroutine<QueryResult> { continuation ->

    // Any Android API that supports cancellation should be configured to propagate
    // coroutine cancellation as follows:
    val canceller = CancellationSignal()
    continuation.invokeOnCancellation { canceller.cancel() }

    // Invoke the FancinessManager#queryAsync method as follows:
    queryAsync(
        query,
        canceller,
        // Use a direct executor to avoid extra dispatch. Resuming the continuation will
        // handle getting to the right thread or pool via the ContinuationInterceptor.
        Runnable::run,
        continuation.asOutcomeReceiver()
    )
}
```

### Handler.postAtTime

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Handler.kt+function:postAtTime) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun Handler.postAtTime(
    uptimeMillis: Long,
    token: Any? = null,
    crossinline action: () -> Unit
): Runnable
```

Version of `https://developer.android.com/reference/android/os/Handler.html#postAtTime(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses.

```kotlin
handler.postAtTime(200) {
    doSomething()
}
```

| Parameters |
|---|---|
| `uptimeMillis: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | The absolute time at which the callback should run, using the android.os.SystemClock#uptimeMillis time-base. |
| `token: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html? = null` | An optional object with which the posted message will be associated. |
| `crossinline action: () -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | The action that will be executed. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Runnable.html` | the created Runnable |

### Handler.postDelayed

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Handler.kt+function:postDelayed) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun Handler.postDelayed(
    delayInMillis: Long,
    token: Any? = null,
    crossinline action: () -> Unit
): Runnable
```

Version of `https://developer.android.com/reference/android/os/Handler.html#postDelayed(java.lang.Runnable, java.lang.Object, long)` which re-orders the parameters, allowing the action to be placed outside of parentheses.

```kotlin
handler.postDelayed(200) {
    doSomething()
}
```

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/Runnable.html` | the created Runnable |

### Map.toPersistableBundle

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/PersistableBundle.kt+function:toPersistableBundle)

```
fun Map<String, Any?>.toPersistableBundle(): PersistableBundle
```

Covert this map to a `https://developer.android.com/reference/android/os/PersistableBundle.html` with the key/value pairs as elements.

Supported value types are `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html`, `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html`, and `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` and arrays of these types.

| Throws |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` | When a value is not a supported type of `https://developer.android.com/reference/android/os/PersistableBundle.html`. |

### Parcel.use

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/os/Parcel.kt+function:use) Added in [1.17.0](https://developer.android.com/jetpack/androidx/releases/core#1.17.0)

```
inline fun <T : Any?> Parcel.use(block: (Parcel) -> T): T
```

Executes the given `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(android.os.Parcel).use(kotlin.Function1)` function on `https://developer.android.com/reference/android/os/Parcel.html` resource and then `https://developer.android.com/reference/android/os/Parcel.html#recycle()`.

| Parameters |
|---|---|
| `block: (https://developer.android.com/reference/android/os/Parcel.html) -> T` | a function to process this `https://developer.android.com/reference/android/os/Parcel.html` resource. |

| Returns |
|---|---|
| `T` | the result of `https://developer.android.com/reference/kotlin/androidx/core/os/package-summary#(android.os.Parcel).use(kotlin.Function1)` function invoked on `https://developer.android.com/reference/android/os/Parcel.html` resource. |