1 year ago

#212887

test-img

tellob

How get SystemUI components replaced by CarSystemUI components in Android 12

Android 12 provides for example a specific implementation for the "Toast" for the car device. The source code of this can be found here: CarToastUI. This class extends ToastUI, which can be found here: ToastUI.

When a "car device" is built from the AOSP, the CarToastUI class is used instead of the ToastUI class.

How does this replacement mechanism work?

What I found out so far:

  • the System UI uses Dagger 2 for dependency injection
  • there is some documentation for this here: dagger.md
  • there exists a CarGlobalRootComponent, which extends GlobalRootComponent and overrides methods
  • similarly the CarSystemUIFactory overrides methods of SystemUIFactory
  • there is a configuration where system UI components are excluded and car system ui components are included
  • from the CarSystemUI blueprint file I can see, that SystemUI gets overwritten: Android.bp

java

android

dagger-2

android-automotive

0 Answers

Your Answer

Accepted video resources