CarRemoteAccessManager
public
final
class
CarRemoteAccessManager
extends Object
java.lang.Object | |
↳ | android.car.remoteaccess.CarRemoteAccessManager |
CarRemoteAccessManager allows applications to listen to remote task requests even while Android System is not running.
The remote task client registers to CarRemoteAccessManager
to listen to remote access
events. At RemoteTaskClientCallback#onRegistrationUpdated
it is required to share
serviceId
, deviceId
and clientId
with the cloud service which will use
the IDs to wake the vehicle. At RemoteTaskClientCallback#onRemoteTaskRequested
, it starts
executing the given task. It is supposed to call reportRemoteTaskDone(java.lang.String)
when it
finishes the given task. Once the task completion is reported or the timeout expires, Android
System goes back to either the previous power state or the specified power state.
Note that the remote task will be executed even when the vehicle is actively in use, not
nessarily when the vehicle is off. Remote task client must make sure the task to be executed
will not affect the system performance or affect driving safety. If certain task must be
executed while the vehicle is off, the remote task client must check VHAL property
VEHICLE_IN_USE
and/or check igntition state via VehicleIgnitionState
.
Note: all remote task clients must run as system user.
A serverless setup might also be supported if the RRO overlay for remote_access_serverless_client_map exists which provides a map from serverless client ID to their package names.
Here the term 'remote' refers to the source of task coming from outside of the Android system, it does not necessarily means the task comes from Internet. In the serverless setup, no cloud service is required. Another device within the same vehicle, but outside the Android system is the issuer for the remote task.
For serverless setup, there is a pre-configured set of serverless remote task clients. They
register to CarRemoteAccessManager
to listen to remote access events.
RemoteTaskClientCallback#onServerlessClientRegistered
will be called instead of
RemoteTaskClientCallback#onRegistrationUpdated
and there is no cloud service involved.
RemoteTaskClientCallback#onRemoteTaskRequested
will be invoked when the task is to be
executed. It is supposed to call reportRemoteTaskDone(java.lang.String)
when it
finishes the given task. Once the task completion is reported or the timeout expires, Android
system goes back to either the previous power state or the specified power state.
For serverless setup, if ERROR(/isTaskScheduleSupported)
returns true
, client may
use ERROR(InVehicleTaskScheduler#scheduleTask/android.car.remoteaccess.CarRemoteAccessManager.InVehicleTaskScheduler#scheduleTask InVehicleTaskScheduler#scheduleTask)
to schedule a remote task to be executed later.
If ERROR(/isTaskScheduleSupported)
returns false
, it is assumed there exists some other
channel outside of the Android system for task scheduling.
Summary
Nested classes | |
---|---|
interface |
CarRemoteAccessManager.CompletableRemoteTaskFuture
An interface passed from |
interface |
CarRemoteAccessManager.RemoteTaskClientCallback
Listener for remote task events. |
Public methods | |
---|---|
void
|
clearRemoteTaskClient()
Clears the remote task client previously set via |
void
|
reportRemoteTaskDone(String taskId)
Reports that remote task execution is completed, so that the vehicle will go back to the power state before the wake-up. |
void
|
setRemoteTaskClient(Executor executor, CarRemoteAccessManager.RemoteTaskClientCallback callback)
Sets the remote task client represented as |
Inherited methods | |
---|---|
Public methods
clearRemoteTaskClient
public void clearRemoteTaskClient ()
Clears the remote task client previously set via setRemoteTaskClient(java.util.concurrent.Executor, android.car.remoteaccess.CarRemoteAccessManager.RemoteTaskClientCallback)
.
After the remote task client is cleared, all tasks associated with the previous client
will not be delivered and the client must not call reportRemoteTaskDone
with the
task ID associated with the previous client ID.
Requires Car.PERMISSION_USE_REMOTE_ACCESS
Throws | |
---|---|
IllegalStateException |
if callback is not registered. |
reportRemoteTaskDone
public void reportRemoteTaskDone (String taskId)
Reports that remote task execution is completed, so that the vehicle will go back to the
power state before the wake-up.
Requires Car.PERMISSION_USE_REMOTE_ACCESS
Parameters | |
---|---|
taskId |
String : ID of the remote task which has been completed. |
Throws | |
---|---|
IllegalArgumentException |
If taskId is null. |
IllegalStateException |
If the remote task client is not registered or not woken up. |
setRemoteTaskClient
public void setRemoteTaskClient (Executor executor, CarRemoteAccessManager.RemoteTaskClientCallback callback)
Sets the remote task client represented as RemoteTaskClientCallback
.
Requires Car.PERMISSION_USE_REMOTE_ACCESS
Parameters | |
---|---|
executor |
Executor : Executor on which callback is executed. |
callback |
CarRemoteAccessManager.RemoteTaskClientCallback : RemoteTaskClientCallback that listens to remote task events. |
Throws | |
---|---|
IllegalStateException |
When a remote task client is already set. |
IllegalArgumentException |
When the given callback or the executor is null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-17 UTC.