Added in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#inhmethods)

# PccSandboxManager

*** ** * ** ***


`
public

final

class
PccSandboxManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.app.privatecompute.PccSandboxManager |

<br />

*** ** * ** ***

Manager for interacting with the Private Compute Core (PCC) sandbox.

## Summary

| ### Public methods ||
|---|---|
| ` <T extends https://developer.android.com/reference/android/app/privatecompute/EgressResponse> void` | ` https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#egressData(android.app.privatecompute.EgressRequest<T>,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<T,android.app.privatecompute.PccEgressException>)(https://developer.android.com/reference/android/app/privatecompute/EgressRequest<T> request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/OutcomeReceiver<T, https://developer.android.com/reference/android/app/privatecompute/PccEgressException> callback) ` Initiates an egress request from a PCC process. |
| ` boolean` | ` https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#isPccTrustedSystemComponent(int,%20java.lang.String)(int uid, https://developer.android.com/reference/java/lang/String packageName) ` Returns whether the given package is considered a "Trusted System Component" by the framework. |
| ` boolean` | ` https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#isPrivateComputeServicesUid(int)(int uid) ` Returns whether the given UID belongs to a Private Compute Services (PCS) package. |
| ` void` | ` https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#startNonPccProcessForDataMigration(java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.privatecompute.MigrationRequestResult,android.app.privatecompute.MigrationException>)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/os/OutcomeReceiver<https://developer.android.com/reference/android/app/privatecompute/MigrationRequestResult, https://developer.android.com/reference/android/app/privatecompute/MigrationException> callback) ` Requests the framework to start the non-PCC migration service of the calling application. |
| ` void` | ` https://developer.android.com/reference/android/app/privatecompute/PccSandboxManager#writeToAuditLog(android.os.PersistableBundle)(https://developer.android.com/reference/android/os/PersistableBundle data) ` Writes data to the audit log, if audit mode is enabled. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Public methods

### egressData

Added in [version 37.2](https://developer.android.com/topic/libraries/support-library/revisions)

```
public void egressData (EgressRequest<T> request, 
                Executor executor, 
                OutcomeReceiver<T, PccEgressException> callback)
```

Initiates an egress request from a PCC process.

These requests may be subject to rate limits or user consent defined by the OS.
For exact details refer to the exact sub-class of the EgressRequest.

<br />

| Parameters ||
|---|---|
| `request` | `EgressRequest`: The base EgressRequest containing the payload and use-case. This value cannot be `null`. <br /> |
| `executor` | `Executor`: The Executor on which the callback should be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `OutcomeReceiver`: The callback to receive the EgressResponse containing the status. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If the `request` is invalid. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | If the request cannot be processed due to the current state of the system (e.g. rate limit exceeded). |
| `https://developer.android.com/reference/java/lang/NullPointerException` | If `request`, `executor`, or `callback` is `null`. |
| `https://developer.android.com/reference/java/lang/SecurityException` | If the calling UID is not running in a valid Private Compute Core sandbox or the underlying feature (such as Proactive Assistance) is disabled. |

### isPccTrustedSystemComponent

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

```
public boolean isPccTrustedSystemComponent (int uid, 
                String packageName)
```

Returns whether the given package is considered a "Trusted System Component" by the
framework. This also includes Private Compute Services apps, which are an extension to the
framework's trust boundary. Trusted System components are allowed two-way communication with
the PCC components.

<br />

| Parameters ||
|---|---|
| `uid` | `int`: The UID of the application. <br /> |
| `packageName` | `String`: The package name of the application. This can be null when a single packagename isn't available, e.g. for SYSTEM_UID. If non-null, this API checks whether `uid` corresponds to `packageName`, and returns `false` if it doesn't. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the app is a trusted system component, `false` otherwise. <br /> |

### isPrivateComputeServicesUid

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

```
public boolean isPrivateComputeServicesUid (int uid)
```

Returns whether the given UID belongs to a Private Compute Services (PCS) package. These are
packages that hold the `https://developer.android.com/reference/android/Manifest.permission#PROVIDE_PRIVATE_COMPUTE_SERVICES`.

<br />

| Parameters ||
|---|---|
| `uid` | `int`: The UID to check. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the UID belongs to a PCS package, `false` otherwise. <br /> |

### startNonPccProcessForDataMigration

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

```
public void startNonPccProcessForDataMigration (Executor executor, 
                OutcomeReceiver<MigrationRequestResult, MigrationException> callback)
```

Requests the framework to start the non-PCC migration service of the calling application.

This is intended for PCC components to trigger a process outside the PCC sandbox to
perform tasks like data migration. The system will look for a service extending `https://developer.android.com/reference/android/app/privatecompute/DataMigrationToPccService` in the application's manifest that is **not** marked as a PCC
component. If found, the non-PCC process is started and the service is invoked.

If the non-PCC process is already running, this ensures the migration service is
triggered. System unbinds from the service either when the service indicates it has
accepted/rejected the request, or failing that, after a timeout of `https://developer.android.com/reference/android/app/privatecompute/DataMigrationToPccService#MIGRATION_TIMEOUT_MS`.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: The executor on which the callback will be invoked. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `OutcomeReceiver`: The callback to receive the result of the migration request. This value cannot be `null`. <br /> |

### writeToAuditLog

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

```
public void writeToAuditLog (PersistableBundle data)
```

Writes data to the audit log, if audit mode is enabled. Otherwise, does nothing.

Nested Bundles are supported up to a depth of 100.

<br />

| Parameters ||
|---|---|
| `data` | `PersistableBundle`: The data to write to the audit log. This value cannot be `null`. <br /> |