Configure Debug Tabs

Last edit: 2023.07.27

The TomTom Digital Cockpit distribution comes integrated with a non-user-facing feature useful for development: a debug menu. By default, it can be opened by long-pressing the volume down button, via the backtick ("`") key, or via ADB with adb shell input keyevent --longpress KEYCODE_GRAVE.

Adding a debug tab

To add a new debug tab, an example app is provided in the examples/debugtab directory, with com.tomtom.ivi.platform.debug.api.frontendextension.debugtab.DebugTabFrontendExtension.

The debug tab's fragment is made with the DebugTabFragment and the view model with a normal FrontendViewModel, templated with the TabbedDebugPanel type.

The debug tab is then registered in the debug menu with a DebugTabFrontendExtension.

The product's build.gradle.kts file should then be changed to include, in the ivi configuration, a customization of the debug frontend:

1import com.tomtom.ivi.platform.gradle.api.common.dependencies.ModuleReference
2import com.tomtom.ivi.platform.gradle.api.common.iviapplication.config.FrontendExtensionConfig
3import com.tomtom.ivi.platform.gradle.api.common.iviapplication.config.IviInstanceIdentifier
4import com.tomtom.ivi.platform.gradle.api.defaults.config.debugFrontend
5import com.tomtom.ivi.platform.gradle.api.framework.config.ivi
6
7val debugTabFrontendExtension = FrontendExtensionConfig(
8 frontendExtensionName = "debugTabFrontendExtension",
9 implementationModule = ModuleReference(
10 "com.example.ivi",
11 "examples_debugtab",
12 "com.example.ivi.example.debugtab"
13 )
14)
15
16ivi {
17 application {
18 enabled = true
19 iviInstances {
20 create(IviInstanceIdentifier.default) {
21 applyGroups {
22 includeDefaultPlatformGroups()
23 includeDefaultAppsuiteGroups()
24 }
25 frontends {
26 configure(debugFrontend) {
27 addExtension(debugTabFrontendExtension)
28 }
29 }
30 }
31 }
32 }
33}

For more information about panels, fragments, view models, and adding frontend extensions, see the frontend plugin how-to guide.

Replacing debug tabs

Similarly to adding debug tabs, the same sort of ivi configuration must be used. However, the debugFrontend configuration must be changed by adding the extensions parameter, which takes a list of DebugTabFrontendExtension objects.