共用方式為


OnDevicePersonalizationManager.Execute Method

Definition

Executes an IsolatedService in the OnDevicePersonalization sandbox.

[Android.Runtime.Register("execute", "(Landroid/content/ComponentName;Landroid/os/PersistableBundle;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetExecute_Landroid_content_ComponentName_Landroid_os_PersistableBundle_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=35)]
public virtual void Execute (Android.Content.ComponentName service, Android.OS.PersistableBundle params, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver receiver);
[<Android.Runtime.Register("execute", "(Landroid/content/ComponentName;Landroid/os/PersistableBundle;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetExecute_Landroid_content_ComponentName_Landroid_os_PersistableBundle_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=35)>]
abstract member Execute : Android.Content.ComponentName * Android.OS.PersistableBundle * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.Execute : Android.Content.ComponentName * Android.OS.PersistableBundle * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit

Parameters

service
ComponentName

The ComponentName of the IsolatedService.

params
PersistableBundle

a PersistableBundle that is passed from the calling app to the IsolatedService. The expected contents of this parameter are defined by theIsolatedService. The platform does not interpret this parameter.

executor
IExecutor

the Executor on which to invoke the callback.

receiver
IOutcomeReceiver

This returns a ExecuteResult object on success or an Exception on failure. If the IsolatedService returned a RenderingConfig to be displayed, ExecuteResult#getSurfacePackageToken() will return a non-null SurfacePackageToken. The SurfacePackageToken object can be used in a subsequent #requestSurfacePackage(SurfacePackageToken, IBinder, int, int, int, Executor, OutcomeReceiver) call to display the result in a view. The returned SurfacePackageToken may be null to indicate that no output is expected to be displayed for this request. If the IsolatedService has returned any output data and the calling app is allowlisted to receive data from this service, the ExecuteResult#getOutputData() will return a non-null byte array.

            In case of an error, the receiver returns one of the following exceptions:
            Returns a <code data-dev-comment-type="c">android.content.pm.PackageManager.NameNotFoundException</code> if the handler
            package is not installed or does not have a valid ODP manifest.
            Returns <code data-dev-comment-type="c">ClassNotFoundException</code> if the handler class is not found.
            Returns an <code data-dev-comment-type="c">OnDevicePersonalizationException</code> if execution of the handler fails.
Attributes

Remarks

Executes an IsolatedService in the OnDevicePersonalization sandbox. The platform binds to the specified IsolatedService in an isolated process and calls IsolatedWorker#onExecute(ExecuteInput, android.os.OutcomeReceiver) with the caller-provided parameters. When the IsolatedService finishes execution, the platform returns tokens that refer to the results from the service to the caller. These tokens can be subsequently used to display results in a android.view.SurfaceView within the calling app.

Java documentation for android.adservices.ondevicepersonalization.OnDevicePersonalizationManager.execute(android.content.ComponentName, android.os.PersistableBundle, java.util.concurrent.Executor, android.os.OutcomeReceiver<android.adservices.ondevicepersonalization.OnDevicePersonalizationManager.ExecuteResult, java.lang.Exception>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to