Package-level declarations
The debug panel service API package.
Overview of the debug panel service
The DebugPanelService
is an IVI service and this service used to provide a way to easily communicate with the System UI DebugPanel.
Using the debug panel service API
To use the DebugPanelService
, add a dependency to your gradle file:
dependencies {
implementation("com.tomtom.ivi.platform:platform_systemui_api_service_debugpanel")
}
To get access to the DebugPanelService
API, you need to first get a DebugPanelServiceApi
instance by calling the companion function DebugPanelService.createApi(...)
.
val debugPanelService = DebugPanelService.createApi(lifecycleOwner, iviServiceProvider)
Once you have the DebugPanelServiceApi
instance, you can use it to call any API, and observe any properties provided by the service.
Note: The service may not be ready when a client calls the service API and could return a SERVICE_UNAVAILABLE
result. It is possible to check the service availability by observing the serviceAvailable
property:
debugPanelService.serviceAvailable.observe(lifecycleOwner) {
if (it) {
// Service is available.
} else {
// Service is not available.
}
}
Toggle debug panel
This code shows how to toggle to the DebugPanel
visibility:
debugPanelService.toggleDebugPanelAsync()
To control the toggling feature:
debugPanelService.allowTogglingDebugPanelAsync(true_or_false)
If you want to control the visibility manually:
debugPanelService.showDebugPanelAsync(true_or_false)
Listen to the debug panel
You can listen whether the DebugPanel
should be shown:
debugPanelService.shouldShowDebugPanel.observe(lifecycleOwner) {
// Listen here.
}
To listen to the DebugPanel
toggle feature availability:
debugPanelService.canToggleDebugPanel.observe(lifecycleOwner) {
// Listen here.
}
Stock debug panel service implementation
The StockDebugPanelService
is the stock implementation of the DebugPanelService
.