Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 3](https://developer.android.com/sdkExtensions)  
Summary:[Nested Classes](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#nestedclasses)\|[Constants](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#constants)\|[Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#pubmethods)\|[Inherited Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#inhmethods)  

# SdkSandboxManager

`
public

final

class
SdkSandboxManager
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

<br />

*** ** * ** ***

Provides APIs to load[SDKs](https://developer.android.com/reference/android/content/pm/SharedLibraryInfo#TYPE_SDK_PACKAGE)into the SDK sandbox process, and then interact with them.

SDK sandbox is a java process running in a separate uid range. Each app may have its own SDK sandbox process.

The app first needs to declare SDKs it depends on in its manifest using the`<uses-sdk-library>`tag. Apps may only load SDKs they depend on into the SDK sandbox.  
**See also:**

- [SharedLibraryInfo.TYPE_SDK_PACKAGE](https://developer.android.com/reference/android/content/pm/SharedLibraryInfo#TYPE_SDK_PACKAGE)
- [SDK Runtime design proposal](https://developer.android.com/design-for-safety/ads/sdk-runtime)

## Summary

|                                                                                                                    ### Nested classes                                                                                                                     ||
|--------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [SdkSandboxManager.SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback) A callback for tracking events SDK sandbox death. |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ### Constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           ||
|--------------------------------------------------------------------| |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_DISPLAY_ID](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_DISPLAY_ID) The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should define the integer ID of the logical display to display the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).                                                                                                |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_HEIGHT_IN_PIXELS](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_HEIGHT_IN_PIXELS) The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should define the integer height of the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)in pixels.                                                                                                      |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_HOST_TOKEN](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_HOST_TOKEN) The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should present the token returned by[SurfaceView.getHostToken()](https://developer.android.com/reference/android/view/SurfaceView#getHostToken())once the[SurfaceView](https://developer.android.com/reference/android/view/SurfaceView)has been added to the view hierarchy.  |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_SURFACE_PACKAGE](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_SURFACE_PACKAGE) The name of key in the Bundle which is passed to the`onResult`function of the[OutcomeReceiver](https://developer.android.com/reference/android/os/OutcomeReceiver)which is field of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value presents the requested[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage). |
| [String](https://developer.android.com/reference/java/lang/String) | [EXTRA_WIDTH_IN_PIXELS](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_WIDTH_IN_PIXELS) The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should define the integer width of the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)in pixels.                                                                                                         |
| `int`                                                              | [LOAD_SDK_ALREADY_LOADED](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#LOAD_SDK_ALREADY_LOADED) SDK is already loaded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `int`                                                              | [LOAD_SDK_INTERNAL_ERROR](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#LOAD_SDK_INTERNAL_ERROR) Internal error while loading SDK.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `int`                                                              | [LOAD_SDK_NOT_FOUND](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#LOAD_SDK_NOT_FOUND) SDK not found.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `int`                                                              | [LOAD_SDK_SDK_DEFINED_ERROR](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#LOAD_SDK_SDK_DEFINED_ERROR) SDK error after being loaded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `int`                                                              | [LOAD_SDK_SDK_SANDBOX_DISABLED](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#LOAD_SDK_SDK_SANDBOX_DISABLED) SDK sandbox is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `int`                                                              | [REQUEST_SURFACE_PACKAGE_INTERNAL_ERROR](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#REQUEST_SURFACE_PACKAGE_INTERNAL_ERROR) Internal error while requesting a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `int`                                                              | [REQUEST_SURFACE_PACKAGE_SDK_NOT_LOADED](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#REQUEST_SURFACE_PACKAGE_SDK_NOT_LOADED) SDK is not loaded while requesting a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `int`                                                              | [SDK_SANDBOX_PROCESS_NOT_AVAILABLE](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#SDK_SANDBOX_PROCESS_NOT_AVAILABLE) SDK sandbox process is not available.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| [String](https://developer.android.com/reference/java/lang/String) | [SDK_SANDBOX_SERVICE](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#SDK_SANDBOX_SERVICE) Use with[Context#getSystemService(String)](https://developer.android.com/reference/android/content/Context#getSystemService(java.lang.String))to retrieve an[SdkSandboxManager](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager)for interacting with the SDKs belonging to this client application.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `int`                                                              | [SDK_SANDBOX_STATE_DISABLED](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#SDK_SANDBOX_STATE_DISABLED) SDK sandbox is disabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `int`                                                              | [SDK_SANDBOX_STATE_ENABLED_PROCESS_ISOLATION](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#SDK_SANDBOX_STATE_ENABLED_PROCESS_ISOLATION) SDK sandbox is enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ||
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| ` void`                                                                                                                                                                                                                | ` `[addSdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSdkSandboxProcessDeathCallback(java.util.concurrent.Executor,%20android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback))`(`[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` callbackExecutor, `[SdkSandboxManager.SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback)` callback) ` Adds a callback which gets registered for SDK sandbox lifecycle events, such as SDK sandbox death.                                                                                                                                                                                                                                                                                                                                                                             |
| ` void`                                                                                                                                                                                                                | ` `[addSyncedSharedPreferencesKeys](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSyncedSharedPreferencesKeys(java.util.Set<java.lang.String>))`(`[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`> keys) ` Adds keys to set of keys being synced from app's default[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences)to the SDK sandbox.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)`>` | ` `[getAppOwnedSdkSandboxInterfaces](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#getAppOwnedSdkSandboxInterfaces())`() ` Fetches a list of[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)registered for an app                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| ` `[List](https://developer.android.com/reference/java/util/List)`<`[SandboxedSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SandboxedSdk)`>`                               | ` `[getSandboxedSdks](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#getSandboxedSdks())`() ` Fetches information about SDKs that are loaded in the sandbox.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` static int`                                                                                                                                                                                                          | ` `[getSdkSandboxState](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#getSdkSandboxState())`() ` Returns the current state of the availability of the SDK sandbox feature.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` `[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>`                                                                                | ` `[getSyncedSharedPreferencesKeys](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#getSyncedSharedPreferencesKeys())`() ` Returns the set keys that are being synced from app's default[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences)to the SDK sandbox.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                                                                                                                                                | ` `[loadSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#loadSdk(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.sdksandbox.SandboxedSdk,android.app.sdksandbox.LoadSdkException>))`(`[String](https://developer.android.com/reference/java/lang/String)` sdkName, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` params, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` executor, `[OutcomeReceiver](https://developer.android.com/reference/android/os/OutcomeReceiver)`<`[SandboxedSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SandboxedSdk)`, `[LoadSdkException](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/LoadSdkException)`> receiver) ` Loads SDK in an SDK sandbox java process.                                                                                                               |
| ` void`                                                                                                                                                                                                                | ` `[registerAppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#registerAppOwnedSdkSandboxInterface(android.app.sdksandbox.AppOwnedSdkSandboxInterface))`(`[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)` appOwnedSdkSandboxInterface) ` Registers[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)for an app process.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` void`                                                                                                                                                                                                                | ` `[removeSdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#removeSdkSandboxProcessDeathCallback(android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback))`(`[SdkSandboxManager.SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback)` callback) ` Removes an[SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback)that was previously added using[addSdkSandboxProcessDeathCallback(java.util.concurrent.Executor, android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSdkSandboxProcessDeathCallback(java.util.concurrent.Executor,%20android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback)) |
| ` void`                                                                                                                                                                                                                | ` `[removeSyncedSharedPreferencesKeys](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#removeSyncedSharedPreferencesKeys(java.util.Set<java.lang.String>))`(`[Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`> keys) ` Removes keys from set of keys that have been added using[addSyncedSharedPreferencesKeys(java.util.Set)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSyncedSharedPreferencesKeys(java.util.Set<java.lang.String>)) Removed keys will be erased from the SDK sandbox if they have been synced already.                                                                                                                                                                                                                                                                                                                                                       |
| ` void`                                                                                                                                                                                                                | ` `[requestSurfacePackage](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>))`(`[String](https://developer.android.com/reference/java/lang/String)` sdkName, `[Bundle](https://developer.android.com/reference/android/os/Bundle)` params, `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)` callbackExecutor, `[OutcomeReceiver](https://developer.android.com/reference/android/os/OutcomeReceiver)`<`[Bundle](https://developer.android.com/reference/android/os/Bundle)`, `[RequestSurfacePackageException](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/RequestSurfacePackageException)`> receiver) ` Sends a request for a surface package to the SDK.                                                                                         |
| ` void`                                                                                                                                                                                                                | ` `[startSdkSandboxActivity](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#startSdkSandboxActivity(android.app.Activity,%20android.os.IBinder))`(`[Activity](https://developer.android.com/reference/android/app/Activity)` fromActivity, `[IBinder](https://developer.android.com/reference/android/os/IBinder)` sdkActivityToken) ` Starts an[Activity](https://developer.android.com/reference/android/app/Activity)in the SDK sandbox.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| ` void`                                                                                                                                                                                                                | ` `[unloadSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#unloadSdk(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` sdkName) ` Unloads an SDK that has been previously loaded by the caller.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` void`                                                                                                                                                                                                                | ` `[unregisterAppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#unregisterAppOwnedSdkSandboxInterface(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` name) ` Unregisters[ERROR(/AppOwnedSdkSandboxInterfaces)](https://developer.android.com/)for an app process.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Constants

### EXTRA_DISPLAY_ID

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final String EXTRA_DISPLAY_ID
```

The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should define the integer ID of the logical display to display the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).

<br />

Constant Value: "android.app.sdksandbox.extra.DISPLAY_ID"  

### EXTRA_HEIGHT_IN_PIXELS

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final String EXTRA_HEIGHT_IN_PIXELS
```

The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should define the integer height of the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)in pixels.

<br />

Constant Value: "android.app.sdksandbox.extra.HEIGHT_IN_PIXELS"  

### EXTRA_HOST_TOKEN

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final String EXTRA_HOST_TOKEN
```

The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should present the token returned by[SurfaceView.getHostToken()](https://developer.android.com/reference/android/view/SurfaceView#getHostToken())once the[SurfaceView](https://developer.android.com/reference/android/view/SurfaceView)has been added to the view hierarchy. Only a non-null value is accepted to enable ANR reporting.

<br />

Constant Value: "android.app.sdksandbox.extra.HOST_TOKEN"  

### EXTRA_SURFACE_PACKAGE

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final String EXTRA_SURFACE_PACKAGE
```

The name of key in the Bundle which is passed to the`onResult`function of the[OutcomeReceiver](https://developer.android.com/reference/android/os/OutcomeReceiver)which is field of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value presents the requested[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).

<br />

Constant Value: "android.app.sdksandbox.extra.SURFACE_PACKAGE"  

### EXTRA_WIDTH_IN_PIXELS

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final String EXTRA_WIDTH_IN_PIXELS
```

The name of key to be used in the Bundle fields of[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>)), its value should define the integer width of the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)in pixels.

<br />

Constant Value: "android.app.sdksandbox.extra.WIDTH_IN_PIXELS"  

### LOAD_SDK_ALREADY_LOADED

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int LOAD_SDK_ALREADY_LOADED
```

SDK is already loaded.

This indicates that client application tried to reload the same SDK by calling[loadSdk(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#loadSdk(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.sdksandbox.SandboxedSdk,android.app.sdksandbox.LoadSdkException>))after being successfully loaded.

<br />

Constant Value: 101 (0x00000065)  

### LOAD_SDK_INTERNAL_ERROR

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int LOAD_SDK_INTERNAL_ERROR
```

Internal error while loading SDK.

This indicates a generic internal error happened while applying the call from client application.

<br />

Constant Value: 500 (0x000001f4)  

### LOAD_SDK_NOT_FOUND

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int LOAD_SDK_NOT_FOUND
```

SDK not found.

This indicates that client application tried to load a non-existing SDK by calling[loadSdk(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#loadSdk(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.sdksandbox.SandboxedSdk,android.app.sdksandbox.LoadSdkException>)).

<br />

Constant Value: 100 (0x00000064)  

### LOAD_SDK_SDK_DEFINED_ERROR

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int LOAD_SDK_SDK_DEFINED_ERROR
```

SDK error after being loaded.

This indicates that the SDK encountered an error during post-load initialization. The details of this can be obtained from the Bundle returned in[LoadSdkException](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/LoadSdkException)through the[OutcomeReceiver](https://developer.android.com/reference/android/os/OutcomeReceiver)passed in to[SdkSandboxManager#loadSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#loadSdk(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.app.sdksandbox.SandboxedSdk,android.app.sdksandbox.LoadSdkException>)).

<br />

Constant Value: 102 (0x00000066)  

### LOAD_SDK_SDK_SANDBOX_DISABLED

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int LOAD_SDK_SDK_SANDBOX_DISABLED
```

SDK sandbox is disabled.

This indicates that the SDK sandbox is disabled. Any subsequent attempts to load SDKs in this boot will also fail.

<br />

Constant Value: 103 (0x00000067)  

### REQUEST_SURFACE_PACKAGE_INTERNAL_ERROR

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int REQUEST_SURFACE_PACKAGE_INTERNAL_ERROR
```

Internal error while requesting a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).

This indicates a generic internal error happened while requesting a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).

<br />

Constant Value: 700 (0x000002bc)  

### REQUEST_SURFACE_PACKAGE_SDK_NOT_LOADED

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 5](https://developer.android.com/sdkExtensions)  

```
public static final int REQUEST_SURFACE_PACKAGE_SDK_NOT_LOADED
```

SDK is not loaded while requesting a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).

This indicates that the SDK for which the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)is being requested is not loaded, either because the sandbox died or because it was not loaded in the first place.

<br />

Constant Value: 701 (0x000002bd)  

### SDK_SANDBOX_PROCESS_NOT_AVAILABLE

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final int SDK_SANDBOX_PROCESS_NOT_AVAILABLE
```

SDK sandbox process is not available.

This indicates that the SDK sandbox process is not available, either because it has died, disconnected or was not created in the first place.

<br />

Constant Value: 503 (0x000001f7)  

### SDK_SANDBOX_SERVICE

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public static final String SDK_SANDBOX_SERVICE
```

Use with[Context#getSystemService(String)](https://developer.android.com/reference/android/content/Context#getSystemService(java.lang.String))to retrieve an[SdkSandboxManager](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager)for interacting with the SDKs belonging to this client application.

<br />

Constant Value: "sdk_sandbox"  

### SDK_SANDBOX_STATE_DISABLED

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 3](https://developer.android.com/sdkExtensions)  

```
public static final int SDK_SANDBOX_STATE_DISABLED
```

SDK sandbox is disabled.

[SdkSandboxManager](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager)APIs are hidden. Attempts at calling them will result in[UnsupportedOperationException](https://developer.android.com/reference/java/lang/UnsupportedOperationException).

<br />

Constant Value: 0 (0x00000000)  

### SDK_SANDBOX_STATE_ENABLED_PROCESS_ISOLATION

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 3](https://developer.android.com/sdkExtensions)  

```
public static final int SDK_SANDBOX_STATE_ENABLED_PROCESS_ISOLATION
```

SDK sandbox is enabled.

App can use[SdkSandboxManager](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager)APIs to load`SDKs`it depends on into the corresponding SDK sandbox process.

<br />

Constant Value: 2 (0x00000002)

## Public methods

### addSdkSandboxProcessDeathCallback

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public void addSdkSandboxProcessDeathCallback (Executor callbackExecutor, 
                SdkSandboxManager.SdkSandboxProcessDeathCallback callback)
```

Adds a callback which gets registered for SDK sandbox lifecycle events, such as SDK sandbox death. If the sandbox has not yet been created when this is called, the request will be stored until a sandbox is created, at which point it is activated for that sandbox. Multiple callbacks can be added to detect death and will not be removed when the sandbox dies.

<br />

|                                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                                              ||
|--------------------| |
| `callbackExecutor` | `Executor`: the[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)on which to invoke the callback This value cannot be`null`. Callback and listener events are dispatched through this[Executor](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[Context.getMainExecutor()](https://developer.android.com/reference/android/content/Context#getMainExecutor()). Otherwise, provide an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)that dispatches to an appropriate thread. <br /> |
| `callback`         | `SdkSandboxManager.SdkSandboxProcessDeathCallback`: the[SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback)which will receive SDK sandbox lifecycle events. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                               |

### addSyncedSharedPreferencesKeys

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 5](https://developer.android.com/sdkExtensions)  

```
public void addSyncedSharedPreferencesKeys (Set<String> keys)
```

Adds keys to set of keys being synced from app's default[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences)to the SDK sandbox.

Synced data will be available for SDKs to read using the[SdkSandboxController.getClientSharedPreferences()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/sdkprovider/SdkSandboxController#getClientSharedPreferences())API.

To stop syncing any key that has been added using this API, use[removeSyncedSharedPreferencesKeys(java.util.Set)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#removeSyncedSharedPreferencesKeys(java.util.Set<java.lang.String>)).

The sync breaks if the app restarts and user must call this API again to rebuild the pool of keys for syncing.

Note: This class does not support use across multiple processes.

<br />

|                                          Parameters                                           ||
|--------|---------------------------------------------------------------------------------------|
| `keys` | `Set`: set of keys that will be synced to Sandbox. This value cannot be`null`. <br /> |

### getAppOwnedSdkSandboxInterfaces

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public List<AppOwnedSdkSandboxInterface> getAppOwnedSdkSandboxInterfaces ()
```

Fetches a list of[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)registered for an app

<br />

|                                                                                                                                                                                                                               Returns                                                                                                                                                                                                                                ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)`>` | empty list if callingInfo not found in map otherwise a list of[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)This value cannot be`null`. <br /> |

### getSandboxedSdks

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 5](https://developer.android.com/sdkExtensions)  

```
public List<SandboxedSdk> getSandboxedSdks ()
```

Fetches information about SDKs that are loaded in the sandbox.

<br />

|                                                                                                                                                                                         Returns                                                                                                                                                                                         ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [List](https://developer.android.com/reference/java/util/List)`<`[SandboxedSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SandboxedSdk)`>` | List of[SandboxedSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SandboxedSdk)containing all currently loaded SDKs. This value cannot be`null`. <br /> |

### getSdkSandboxState

Added in[API level 33](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 3](https://developer.android.com/sdkExtensions)  

```
public static int getSdkSandboxState ()
```

Returns the current state of the availability of the SDK sandbox feature.

<br />

|                                                                                                                                                                                          Returns                                                                                                                                                                                           ||
|-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is[SDK_SANDBOX_STATE_DISABLED](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#SDK_SANDBOX_STATE_DISABLED), or[SDK_SANDBOX_STATE_ENABLED_PROCESS_ISOLATION](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#SDK_SANDBOX_STATE_ENABLED_PROCESS_ISOLATION) <br /> |

### getSyncedSharedPreferencesKeys

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 5](https://developer.android.com/sdkExtensions)  

```
public Set<String> getSyncedSharedPreferencesKeys ()
```

Returns the set keys that are being synced from app's default[SharedPreferences](https://developer.android.com/reference/android/content/SharedPreferences)to the SDK sandbox.

<br />

|                                                                                 Returns                                                                                  ||
|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Set](https://developer.android.com/reference/java/util/Set)`<`[String](https://developer.android.com/reference/java/lang/String)`>` | This value cannot be`null`. <br /> |

### loadSdk

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public void loadSdk (String sdkName, 
                Bundle params, 
                Executor executor, 
                OutcomeReceiver<SandboxedSdk, LoadSdkException> receiver)
```

Loads SDK in an SDK sandbox java process.

Loads SDK library with`sdkName`to an SDK sandbox process asynchronously. The caller will be notified through the`receiver`.

The caller should already declare`SDKs`it depends on in its manifest using`<uses-sdk-library>`tag. The caller may only load`SDKs`it depends on into the SDK sandbox.

When the client application loads the first SDK, a new SDK sandbox process will be created. If a sandbox has already been created for the client application, additional SDKs will be loaded into the same sandbox.

This API may only be called while the caller is running in the foreground. Calls from the background will result in returning[LoadSdkException](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/LoadSdkException)in the`receiver`.

<br />

|                                                                                                                                                                                                                                                                                                                                                          Parameters                                                                                                                                                                                                                                                                                                                                                          ||
|------------| |
| `sdkName`  | `String`: name of the SDK to be loaded. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `params`   | `Bundle`: additional parameters to be passed to the SDK in the form of a[Bundle](https://developer.android.com/reference/android/os/Bundle)as agreed between the client and the SDK. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| `executor` | `Executor`: the[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)on which to invoke the receiver. This value cannot be`null`. Callback and listener events are dispatched through this[Executor](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[Context.getMainExecutor()](https://developer.android.com/reference/android/content/Context#getMainExecutor()). Otherwise, provide an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)that dispatches to an appropriate thread. <br /> |
| `receiver` | `OutcomeReceiver`: This either receives a[SandboxedSdk](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SandboxedSdk)on a successful run, or[LoadSdkException](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/LoadSdkException). This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                   |

### registerAppOwnedSdkSandboxInterface

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public void registerAppOwnedSdkSandboxInterface (AppOwnedSdkSandboxInterface appOwnedSdkSandboxInterface)
```

Registers[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)for an app process.

Registering an[AppOwnedSdkSandboxInterface](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface)that has same name as a previously registered interface will result in[IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException).

[AppOwnedSdkSandboxInterface#getName()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/AppOwnedSdkSandboxInterface#getName())refers to the name of the interface.

<br />

|                                                                    Parameters                                                                     ||
|-------------------------------|--------------------------------------------------------------------------------------------------------------------|
| `appOwnedSdkSandboxInterface` | `AppOwnedSdkSandboxInterface`: the AppOwnedSdkSandboxInterface to be registered This value cannot be`null`. <br /> |

### removeSdkSandboxProcessDeathCallback

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public void removeSdkSandboxProcessDeathCallback (SdkSandboxManager.SdkSandboxProcessDeathCallback callback)
```

Removes an[SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback)that was previously added using[addSdkSandboxProcessDeathCallback(java.util.concurrent.Executor, android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSdkSandboxProcessDeathCallback(java.util.concurrent.Executor,%20android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback))

<br />

|                                                                                                                                                                                                                                                                                                                           Parameters                                                                                                                                                                                                                                                                                                                            ||
|------------| |
| `callback` | `SdkSandboxManager.SdkSandboxProcessDeathCallback`: the[SdkSandboxProcessDeathCallback](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager.SdkSandboxProcessDeathCallback)which was previously added using[SdkSandboxManager#addSdkSandboxProcessDeathCallback(Executor, SdkSandboxProcessDeathCallback)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSdkSandboxProcessDeathCallback(java.util.concurrent.Executor,%20android.app.sdksandbox.SdkSandboxManager.SdkSandboxProcessDeathCallback))This value cannot be`null`. <br /> |

### removeSyncedSharedPreferencesKeys

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 5](https://developer.android.com/sdkExtensions)  

```
public void removeSyncedSharedPreferencesKeys (Set<String> keys)
```

Removes keys from set of keys that have been added using[addSyncedSharedPreferencesKeys(java.util.Set)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#addSyncedSharedPreferencesKeys(java.util.Set<java.lang.String>))

Removed keys will be erased from the SDK sandbox if they have been synced already.

<br />

|                                                   Parameters                                                   ||
|--------|--------------------------------------------------------------------------------------------------------|
| `keys` | `Set`: set of key names that should no longer be synced to Sandbox. This value cannot be`null`. <br /> |

### requestSurfacePackage

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public void requestSurfacePackage (String sdkName, 
                Bundle params, 
                Executor callbackExecutor, 
                OutcomeReceiver<Bundle, RequestSurfacePackageException> receiver)
```

Sends a request for a surface package to the SDK.

After the client application receives a signal about a successful SDK loading, and has added a[SurfaceView](https://developer.android.com/reference/android/view/SurfaceView)to the view hierarchy, it may asynchronously request a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)to render a view from the SDK.

When the[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)is ready, the[OutcomeReceiver#onResult](https://developer.android.com/reference/android/os/OutcomeReceiver#onResult(R))callback of the passed`receiver`will be invoked. This callback will contain a[Bundle](https://developer.android.com/reference/android/os/Bundle)object, which will contain the key[SdkSandboxManager#EXTRA_SURFACE_PACKAGE](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_SURFACE_PACKAGE)whose associated value is the requested[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage).

The passed`params`must contain the following keys:[EXTRA_WIDTH_IN_PIXELS](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_WIDTH_IN_PIXELS),[SdkSandboxManager#EXTRA_HEIGHT_IN_PIXELS](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_HEIGHT_IN_PIXELS),[SdkSandboxManager#EXTRA_DISPLAY_ID](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_DISPLAY_ID)and[SdkSandboxManager#EXTRA_HOST_TOKEN](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_HOST_TOKEN). If any of these keys are missing or invalid, an[IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException)will be thrown.

This API may only be called while the caller is running in the foreground. Calls from the background will result in returning RequestSurfacePackageException in the`receiver`.

<br />

|                                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                                              ||
|--------------------| |
| `sdkName`          | `String`: name of the SDK loaded into the SDK sandbox. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `params`           | `Bundle`: the parameters which the client application passes to the SDK. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `callbackExecutor` | `Executor`: the[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)on which to invoke the callback This value cannot be`null`. Callback and listener events are dispatched through this[Executor](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[Context.getMainExecutor()](https://developer.android.com/reference/android/content/Context#getMainExecutor()). Otherwise, provide an[Executor](https://developer.android.com/reference/java/util/concurrent/Executor)that dispatches to an appropriate thread. <br /> |
| `receiver`         | `OutcomeReceiver`: This either returns a[Bundle](https://developer.android.com/reference/android/os/Bundle)on success which will contain the key[SdkSandboxManager#EXTRA_SURFACE_PACKAGE](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_SURFACE_PACKAGE)with a[SurfacePackage](https://developer.android.com/reference/android/view/SurfaceControlViewHost.SurfacePackage)value, or[RequestSurfacePackageException](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/RequestSurfacePackageException)on failure. This value cannot be`null`. <br />                                                           |

|                                                                        Throws                                                                         ||
|--------------------------------------------------------------------------------------------------------|-----------------------------------------------|
| [IllegalArgumentException](https://developer.android.com/reference/java/lang/IllegalArgumentException) | if`params`does not contain all required keys. |

**See also:**

- [EXTRA_WIDTH_IN_PIXELS](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_WIDTH_IN_PIXELS)
- [EXTRA_HEIGHT_IN_PIXELS](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_HEIGHT_IN_PIXELS)
- [EXTRA_DISPLAY_ID](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_DISPLAY_ID)
- [EXTRA_HOST_TOKEN](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#EXTRA_HOST_TOKEN)  

### startSdkSandboxActivity

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 7](https://developer.android.com/sdkExtensions)  

```
public void startSdkSandboxActivity (Activity fromActivity, 
                IBinder sdkActivityToken)
```

Starts an[Activity](https://developer.android.com/reference/android/app/Activity)in the SDK sandbox.

This function will start a new[Activity](https://developer.android.com/reference/android/app/Activity)in the same task of the passed`fromActivity`and pass it to the SDK that shared the passed`sdkActivityToken`that identifies a request from that SDK to stat this[Activity](https://developer.android.com/reference/android/app/Activity).

The[Activity](https://developer.android.com/reference/android/app/Activity)will not start in the following cases:

- The App calling this API is in the background.
- The passed`sdkActivityToken`does not map to a request for an[Activity](https://developer.android.com/reference/android/app/Activity)form the SDK that shared it with the caller app.
- The SDK that shared the passed`sdkActivityToken`removed its request for this[Activity](https://developer.android.com/reference/android/app/Activity).
- The sandbox[Activity](https://developer.android.com/reference/android/app/Activity)is already created.

<br />

<br />

|                                                                                                                                                                                                      Parameters                                                                                                                                                                                                      ||
|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fromActivity`     | `Activity`: the[Activity](https://developer.android.com/reference/android/app/Activity)will be used to start the new sandbox[Activity](https://developer.android.com/reference/android/app/Activity)by calling[Activity#startActivity(Intent)](https://developer.android.com/reference/android/app/Activity#startActivity(android.content.Intent))against it. This value cannot be`null`. <br /> |
| `sdkActivityToken` | `IBinder`: the identifier that is shared by the SDK which requests the[Activity](https://developer.android.com/reference/android/app/Activity). This value cannot be`null`. <br />                                                                                                                                                                                                               |

### unloadSdk

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  

```
public void unloadSdk (String sdkName)
```

Unloads an SDK that has been previously loaded by the caller.

It is not guaranteed that the memory allocated for this SDK will be freed immediately. All subsequent calls to[requestSurfacePackage(java.lang.String, android.os.Bundle, java.util.concurrent.Executor, android.os.OutcomeReceiver)](https://developer.android.com/design-for-safety/privacy-sandbox/reference/sdksandbox/SdkSandboxManager#requestSurfacePackage(java.lang.String,%20android.os.Bundle,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver<android.os.Bundle,android.app.sdksandbox.RequestSurfacePackageException>))for the given`sdkName`will fail.

This API may only be called while the caller is running in the foreground. Calls from the background will result in a[SecurityException](https://developer.android.com/reference/java/lang/SecurityException)being thrown.

<br />

|                                       Parameters                                        ||
|-----------|------------------------------------------------------------------------------|
| `sdkName` | `String`: name of the SDK to be unloaded. This value cannot be`null`. <br /> |

### unregisterAppOwnedSdkSandboxInterface

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public void unregisterAppOwnedSdkSandboxInterface (String name)
```

Unregisters[ERROR(/AppOwnedSdkSandboxInterfaces)](https://developer.android.com/)for an app process.

<br />

|                                                      Parameters                                                       ||
|--------|---------------------------------------------------------------------------------------------------------------|
| `name` | `String`: the name under which AppOwnedSdkSandboxInterface was registered. This value cannot be`null`. <br /> |