Added in API level 37

PccService


abstract class PccService : Service
kotlin.Any
   ↳ 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

Public methods
IBinder
onBind(intent: Intent?)

Returns the communication channel to the service.

abstract Unit
onReceiveData(data: Bundle, packageName: String)

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

Inherited functions

Protected constructors

PccService

Added in API level 37
protected PccService()

Public methods

onBind

Added in API level 37
fun onBind(intent: Intent?): IBinder

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.
Return
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
abstract fun onReceiveData(
    data: Bundle,
    packageName: String
): Unit

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:

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.