Starting March 27, 2025, we recommend using android-latest-release
instead of aosp-main
to build and contribute to AOSP. For more information, see Changes to AOSP.
Monitor status
Stay organized with collections
Save and categorize content based on your preferences.
A typical instrument cluster updates driving, call, and media information whenever new data
comes in. Android provides the following API to enable an OEM's instrument cluster to receive
up-to-date status easily.
Driving status
Driving direction events are sent while navigation is ongoing. The file
packages/services/Car/car-lib/src/android/car/cluster/renderer/NavigationRenderer.java
contains abstract methods for a navigation app renderer in the instrument cluster.
In an extended InstrumentClusterRenderingService
, these methods are as follows:
public class MyClusterRenderingService extends
InstrumentClusterRenderingService {
...
@Override protected NavigationRenderer getNavigationRenderer() {
return new NavigationRenderer() {
@Override CarNavigationInstrumentCluster getNavigationProperties() {...}
@Override void onStartNavigation() {...}
@Override void onStopNavigation() {...}
@Override void onNextTurnChanged(int event, String road, int turnAngle,
int turnNumber, Bitmap image, int turnSide) {...}
@Override void onNextTurnDistanceChanged(int distanceMeters, int
timeSeconds) {...}
};
}
}
You can add custom actions (such as rendering) to these methods to display desired
information.
Call status
To monitor call status, use the following steps:
- Extend
android.telecom.InCallService
.
public class ClusterInCallService extends InCallService {
...
- Register the service in
AndroidManifest.xml
.
<service android:name="com.android.car.cluster.sample.ClusterInCallService"
android:permission="android.permission.BIND_INCALL_SERVICE"
android:exported="false">
- Override onCallAdded and onCallRemoved.
public void onCallAdded(Call call) {
...
call.registerCallback(mPhoneCallback);
mPhoneCallback.onStateChanged(call, call.getState());
}
public void onCallRemoved(Call call) {
...
call.unregisterCallback(mPhoneCallback);
}
- Register callbacks to receive call status change events (
Call#registerCallback
).
private static class PhoneCallback extends Callback {
...
public void onStateChanged(Call call, int state) {...}
}
- Use content providers to pull contact information:
ContactsContract.PhoneLookup, ContactsContract.Contacts#openContactPhotoInputStream
).
For call status monitor sample code, see:
packages/services/Car/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/ClusterInCallService.java
For content provider sample code, see:
packages/services/Car/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/TelecomUtils.java
.
You can configure the system to update the media status when it receive events related to a
change in MediaMetadata (such as album or song title or cover image) or playback state (buffering,
pause, play, and stop). To update the media status:
- Use
MediaSessionManager
and get primary controller
(#getActiveSessions(null)[0]
).
- Register callbacks (
MediaController#Callback
).
- Subscribe to on active session changed
MediaSessionManager#addOnActiveSessionsChangedListener(...)
.
For details, see:
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-08-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-29 UTC."],[],[],null,["# Monitor status\n\nA typical instrument cluster updates driving, call, and media information whenever new data\ncomes in. Android provides the following API to enable an OEM's instrument cluster to receive\nup-to-date status easily.\n\nDriving status\n--------------\n\nDriving direction events are sent while navigation is ongoing. The file\n`packages/services/Car/car-lib/src/android/car/cluster/renderer/NavigationRenderer.java`\ncontains abstract methods for a navigation app renderer in the instrument cluster.\n\nIn an extended `InstrumentClusterRenderingService`, these methods are as follows: \n\n```transact-sql\npublic class MyClusterRenderingService extends\nInstrumentClusterRenderingService {\n ...\n @Override protected NavigationRenderer getNavigationRenderer() {\n return new NavigationRenderer() {\n @Override CarNavigationInstrumentCluster getNavigationProperties() {...}\n @Override void onStartNavigation() {...}\n @Override void onStopNavigation() {...}\n @Override void onNextTurnChanged(int event, String road, int turnAngle,\n int turnNumber, Bitmap image, int turnSide) {...}\n @Override void onNextTurnDistanceChanged(int distanceMeters, int\n timeSeconds) {...}\n };\n }\n}\n```\n\nYou can add custom actions (such as rendering) to these methods to display desired\ninformation.\n\nCall status\n-----------\n\nTo monitor call status, use the following steps:\n\n1. Extend `android.telecom.InCallService`. \n\n ```gdscript\n public class ClusterInCallService extends InCallService {\n ...\n ```\n2. Register the service in `AndroidManifest.xml`. \n\n ```gdscript\n \u003cservice android:name=\"com.android.car.cluster.sample.ClusterInCallService\"\n android:permission=\"android.permission.BIND_INCALL_SERVICE\"\n android:exported=\"false\"\u003e\n ```\n3. Override onCallAdded and onCallRemoved. \n\n ```verilog\n public void onCallAdded(Call call) {\n ...\n call.registerCallback(mPhoneCallback);\n mPhoneCallback.onStateChanged(call, call.getState());\n }\n public void onCallRemoved(Call call) {\n ...\n call.unregisterCallback(mPhoneCallback);\n }\n ```\n4. Register callbacks to receive call status change events (`Call#registerCallback`). \n\n ```gdscript\n private static class PhoneCallback extends Callback {\n ...\n public void onStateChanged(Call call, int state) {...}\n }\n ```\n5. Use content providers to pull contact information: \n `ContactsContract.PhoneLookup, ContactsContract.Contacts#openContactPhotoInputStream`).\n\nFor call status monitor sample code, see: \n\n`packages/services/Car/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/ClusterInCallService.java`\n\nFor content provider sample code, see: \n\n`packages/services/Car/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/TelecomUtils.java`.\n\nMedia status\n------------\n\nYou can configure the system to update the media status when it receive events related to a\nchange in MediaMetadata (such as album or song title or cover image) or playback state (buffering,\npause, play, and stop). To update the media status:\n\n1. Use `MediaSessionManager` and get primary controller (`#getActiveSessions(null)[0]`).\n2. Register callbacks (`MediaController#Callback`).\n3. Subscribe to on active session changed `MediaSessionManager#addOnActiveSessionsChangedListener(...)`.\n\nFor details, see:\n\n- [packages/services/Car/+/android-8.1.0_r9/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/MediaStateMonitor.java](https://android.googlesource.com/platform/packages/services/Car/+/android-8.1.0_r9/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/MediaStateMonitor.java)\n- [packages/services/Car/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/InstrumentClusterController.java](https://android.googlesource.com/platform/packages/services/Car/+/android-8.1.0_r9/tests/InstrumentClusterRendererSample/src/com/android/car/cluster/sample/InstrumentClusterController.java)"]]