tree: d4d61c7ffaa3a8504877c91fc622b916e039a8e3 [path history] [tgz]
  1. car-rotary-lib/
  2. car-ui-lib/
  3. documentation/
  4. gradle/
  5. oem-apis/
  6. paintbooth/
  7. referencedesign/
  8. tests/
  9. Android.bp
  10. Android.mk
  11. AndroidTest.xml
  12. build.gradle
  13. findviewbyid-preupload-hook.sh
  14. generate_rros.mk
  15. gradle.properties
  16. gradlew
  17. gradlew.bat
  18. OWNERS
  19. README.md
  20. settings.gradle
  21. TEST_MAPPING
  22. trailing-blank-line-hook.sh
car-ui-lib/README.md

Android Automotive ‘Chassis’ library

Components and resources designed to increase Automotive UI consistency between GAS (Google Automotive Services) apps, system-apps and OEM developed apps.

See: go/aae-chassis-site

Content

Components and resources designed to be configured by means of RRO (Runtime Resource Overlays) by OEMs.

Developing

Project layout:

  • car-ui-lib: The main library that is statically linked into applications
  • paintbooth: A test application that contains demos of all the car-ui components
  • referencedesign: An RRO applied to internal google targets that does some minor car-ui customizations. It's used to make changes to car-ui that would cause backwards compatability issues if we were to create them directly in the library. It can also serve as an example RRO for OEMs, and should be kept reasonably functional and up-to-date because we use it actively.

Building and running PaintBooth

While car-ui-lib can be developed by using aidegen, it's probably easier to use Android Studio with the gradle build files. To do this, select “Open an existing Android Studio project”, then navigating to the (outer) car-ui-lib folder:

Open an existing Android Studio project Navigating to car-ui-lib

If this is your first time using Android Studio, it may ask you to install an SDK. Go ahead and do that.

It may ask if you want to generate the gradle wrapper files, select “Yes”. Wait for it to finish indexing, and then you should see car-ui-lib and PaintBooth projects in the project pane on the left. Make sure your project view is set to “Android” mode, as opposed to the regular “Project” mode:

Android project view

To launch paintbooth, start a car emulator or connect a device, make sure the PaintBooth module and “Virtual Device” is selected in your Android Studio toolbar, then click the green arrow:

Launching Paintbooth

If it launches a LeakCanary activity instead of PaintBooth, either exit LeakCanary and launch PaintBooth as normal through the car's launcher, or click on the PaintBooth module > Edit configurations > Change “Launch: Default Activity” to “Specified Activity”, and enter com.android.car.ui.paintbooth.MainActivity.

Building and running the CarUi Plugin

Setting up the plugin is mostly the same as setting up paintbooth. However, when you attempt to install the plugin, Android Studio will complain it can‘t launch any activity (despite the installation succeeding), and your changes won’t properly show up. To fix these issues, edit the plugin configuration, change the “Launch:” option to launch nothing, and check the “Always install with package manager (disables deployment optimizations on Android 11 and higher)” button. This checkbox shouldn't be required after b/188220380 is fixed.

Plugin setup

Running tests

Once you've set up paintbooth as described above, just open one of the test classes in car-ui-lib > java > com.android.car.ui (androidTest) and click the green arrow next to one of the tests to run it:

Running tests

The tests can also be run from the command line via atest CarUILibUnitTests, but that's much slower than running them through Android Studio.

Getting coverage reports

Coverage reports must be generated from the command line as opposed to Android Studio. Run ./gradlew createDebugCoverageReport to generate a coverate report under packages/apps/Car/libs/car-ui-lib/car-ui-lib/build/reports/coverage/debug/index.html. Currently, you must first run adb shell am switch-user 0 due to b/183903243

To only run certain tests, run ./gradlew clean createDebugCoverageReport -Pandroid.testInstrumentationRunnerArguments.tests_regex=CarUiIme*, changing the regex as necessary.

Updating Google3

This library is developed in Gerrit and copied as source to Google3 using Copybara (go/copybara).

Source: /packages/apps/Car/libs/car-ui-lib Target: //google3/third_party/java/android_libs/android_car_chassis_lib

Here is the process for updating this library:

  1. Develop, test and upload changes to Gerrit
  2. On Google3, run ./update.sh review <cl> (with being your Gerrit CL #) and test your changes
  3. Repeat #1 and #2 until your changes look okay on both places.
  4. Back on Gerrit, submit your CL.
  5. Back on Google3, run ./update.sh manual submit

TODO: Automate this process using CaaS (in progress)

If you're just updating the current state of car-ui-lib, and not testing a review that has yet to be submitted, the process can be simplified to:

/google/data/ro/teams/copybara/copybara /google/src/head/depot/google3/third_party/java_src/android_libs/car_chassis_lib/copy.bara.sky default