PccService


public abstract class PccService
extends Service

java.lang.Object
   ↳ android.content.Context
     ↳ android.content.ContextWrapper
       ↳ android.app.Service
         ↳ android.app.privatecompute.PccService


Abstract base class for a PCC service that receives data from other components. Developers must extend this class and implement its abstract methods to handle data ingress.

Summary

Inherited constants

Protected constructors

PccService()

Public methods

final IBinder onBind(Intent intent)

Returns the communication channel to the service.

abstract void onReceiveData(Bundle data, String packageName)

This method is the data ingress point for a PCC service.

Inherited methods

Protected constructors

PccService

Added in API level 37
protected PccService ()

Public methods

onBind

Added in API level 37
public final IBinder onBind (Intent intent)

Returns the communication channel to the service.

Parameters
intent Intent: The Intent that was used to bind to this service.
This value may be null.

Returns
IBinder An IBinder through which clients can call back to the service. A system proxy binder will be returned to the caller, if it is not executing in a PCC UID, or isn't a trusted component.
This value cannot be null.

onReceiveData

Added in API level 37
public abstract void onReceiveData (Bundle data, 
                String packageName)

This method is the data ingress point for a PCC service. When a client sends data via the sendData api, the service will receive that data in this endpoint and can process it.

The data Bundle is already sanitised by the system if sent from outside PCC sandbox. This sanitization process makes sure that any object to establish 2 way communication are not passed.

To enforce a strictly one-way data flow, if the caller isn't allowed two way communication with PCC components, the Bundle is sanitized to prevent objects that can be used to establish a two-way communication channel like IBinder, Messenger, etc.

Allowed data types are:

  • Primitives and their arrays (e.g., int, char, boolean, String, byte[])
  • PersistableBundle
  • Read-only ParcelFileDescriptor
  • SharedMemory. If it has write access, it will be silently restricted to read-only.
  • Bitmap
  • Custom Parcelable objects must be serialized as a byte [].
  • Nested Bundle objects, which are recursively sanitized up to a depth of 100.

Parameters
data Bundle: A Bundle containing the data sent by the client.
This value cannot be null.

packageName String: The package name for the app that calls sendData.
This value cannot be null.