Differences between revisions 7 and 8
Revision 7 as of 2019-07-10 16:32:19
Size: 16640
Editor: 192
Revision 8 as of 2019-07-10 16:36:52
Size: 26
Editor: 192
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
Date of last update: 10 July 2019


= Introduction =

The Android Automotive OS and HMI provide users with a simplified interface for accessing applications while on the road. The OS is an Android-based infotainment system that allows for a vehicle-optimized, stand-alone Android device to be placed inside the head unit. In place of the phone apps, users install driver-optimized versions of the app directly onto the console. This streamlined experience enables the driver to perform efficient tasks, such as climate control, maps, phone, audio, etc..., in the convenience of their vehicle.

This guide will walk through the steps necessary to enable Android Automotive on your TI development board (AM57x BeagleBoard-X15).

== Default Tablet Configuration ==


'''Figure 1.''' Home screen for Tablet configuration.

== Automotive Configuration ==


'''Figure 2.''' Start screen for Automotive configuration, depicting a car with PSI information near tires.


'''Figure 3.''' “Let’s Drive” interface for Automotive configuration, allowing user to interact with applications by selecting icon in the middle.


'''Figure 4.''' Climate control interface for Automotive configuration, allowing user to adjust temperature, fan speed and direction, seat warmers, etc...


'''Figure 5.''' Notification pane for Automotive configuration, presenting user with up-to-date notifications regarding their vehicle.

= Getting Started =

1. Check to make sure your setup meets the [[https://source.android.com/setup/build/requirements|hardware and software requirements]] as given by Android

2. Follow the steps provided in the Texas Instruments Processor SDK Android [[http://software-dl.ti.com/processor-sdk-android/esd/docs/latest/android/Overview_Getting_Started_Guide.html|1.1 Getting Started Guide]] to install necessary components and [[http://software-dl.ti.com/processor-sdk-android/esd/docs/latest/android/Overview_Building_the_SDK.html|1.3 Building the SDK]] to prepare for development on the TI microprocessor

3. [[https://source.android.com/setup/build/initializing|Establish your Build Environment for Android]]

4. Ensure that your device meets the [[https://source.android.com/compatibility/android-cdd#2_5_automotive_requirements|Automotive Requirements defined by the Android Compatibility Definition]]

= Modification of Source Files =

'''NOTE:''' Please change directory to your Android Filesystem before continuing

== AndroidProducts.mk ==

Changes inside ''device/ti/beagle_x15/AndroidProducts.mk''

- $(LOCAL_DIR)/beagle_x15.mk \
+ beagle_x15:$(LOCAL_DIR)/beagle_x15.mk \
+ beagle_x15_auto:$(LOCAL_DIR)/auto/beagle_x15.mk \

     beagle_x15-userdebug \
+ beagle_x15_auto-userdebug \

 * These changes add a new lunch combo called “beagle_x15_auto-userdebug” and it’s path to the relative top-level makefile

== BoardConfig.mk ==

Changes inside ''device/ti/beagle_x15/BoardConfig.mk''


+ifeq ($(TARGET_PRODUCT),beagle_x15_auto)
+ packages/services/Car/car_product/sepolicy
+DEVICE_MANIFEST_FILE += device/ti/beagle_x15/auto/manifest.xml

 * Conditional is needed to differentiate the content that is included depending on the '''TARGET_PRODUCT''' (macro set by lunch combo)
 * [[https://source.android.com/devices/architecture/vintf/objects#device-manifest-file|DEVICE_MANIFEST_FILE]] adds the auto-specific manifest file to the build

== Auto Directory ==

Create an ''auto'' directory inside of ''device/ti/beagle_x15''

'''NOTE:''' The following steps will all be completed inside the ''device/ti/beagle_x15/auto'' directory

== auto/beagle_x15.mk ==

Create a top-level makefile for the beagle_x15_auto-userdebug lunch combo and insert the following content

$(call inherit-product, device/ti/beagle_x15/device.mk)
$(call inherit-product, device/ti/beagle_x15/auto/device.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
$(call inherit-product, packages/services/Car/car_product/build/car.mk)

PRODUCT_NAME := beagle_x15_auto
PRODUCT_DEVICE := beagle_x15
PRODUCT_MODEL := AOSP Auto on BeagleBoard X15
PRODUCT_MANUFACTURER := Texas Instruments Inc

 * The top-level makefiles are inherited above to include all necessary components ('''PRODUCT_PACKAGES''', '''PRODUCT_COPY_FILES''', '''PRODUCT_PROPERTY_OVERRIDES''', etc...) to enable desired features
  * ''auto/device.mk'' and ''car.mk'' are crucial to enabling all automotive-specific features
  * The content inside the car.mk, the common makefile for all car builds, can be found [[https://android.googlesource.com/platform/packages/services/Car/+/refs/heads/pie-release/car_product/build/car.mk|here]]
  * car.mk then inherits car_base.mk, the base platform for car builds, whose content can be found [[https://android.googlesource.com/platform/packages/services/Car/+/refs/heads/pie-release/car_product/build/car_base.mk|here]]
  * Inside car_base.mk, the [[https://android.googlesource.com/platform/packages/services/Car/+/refs/heads/pie-release/car_product/overlay/frameworks/base/core/res/res/values/config.xml|auto-specific PRODUCT_PROPERTY_OVERLAYS]] are added to customize the product at build time

== auto/device.mk ==

Create the ''device.mk'' to declare the auto-specific files and modules needed for the device and insert the following content

        android.hardware.automotive.vehicle@2.0-service \

        frameworks/native/data/etc/android.hardware.type.automotive.xml: $(TARGET_COPY_OUT_VENDOR)/etc/permissions/ android.hardware.type.automotive.xml \
        frameworks/native/data/etc/android.hardware.screen.landscape.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/ android.hardware.screen.landscape.xml \

        android.car.drawer.unlimited=true \
        android.car.hvac.demo=true \
        com.android.car.radio.demo=true \
        com.android.car.radio.demo.dual=true \

 * The ''android.hardware.automotive.vehicle@2.0-service'' '''PRODUCT_PACKAGE''' is the [[https://source.android.com/devices/automotive|Android Automotive hardware abstraction layer (HAL)]], which is the interface definition between the car and the vehicle network service
 * The ''frameworks/../../../android.hardware.type.automotive.xml'' '''PRODUCT_COPY_FILE''' determines that the Android device implementation is classified as “Automotive”

== auto/manifest.xml ==

Create the ''manifest.xml'' to provide the HAL(s) specific to automotive and insert the following content

<manifest version="1.0" type="device">
    <hal format="hidl">

 * Beagle_x15 requires the ''android.hardware.automotive.vehicle'' inclusion to define the product as automotive

= Testing =

== Compatibility Test Suite (CTS) ==

 * Runs on your desktop and executes a series of test cases on the connected device(s)
 * The intent is to reveal incompatibilities or malfunctions while developing automotive configuration and related additional software components ([[https://source.android.com/compatibility/cts|Overview of CTS]])

=== Desktop Machine Setup ===

[[https://source.android.com/compatibility/cts/setup|Setting up CTS]] (This link will provide all steps necessary. The concise version is below.)

1. Ensure the latest versions of both Android Debug Bridge (adb) and Android Asset Packaging Tool (AAPT) are installed and those tools’ location(s) are added to the system path of your machine

$ sudo apt-get install adb aapt

'''NOTE:''' The SDK should already come with adb and aapt so the above command will either update/upgrade them or return the message:

“aapt is already the newest version (version_number)”

“adb is already the newest version (version_number)”

2. [[https://source.android.com/compatibility/cts/downloads.html|Download the CTS packages]] matching your devices’ Android version and the Application Binary Interfaces (ABIs) your devices support
 * Unzip the CTS packages inside of <SDK_install_dir>/bin

$ cd <SDK_install_dir>/bin
$ unzip ~/Downloads/android-cts-<version>.zip

 * You may need to override the [[https://source.android.com/compatibility/cts/setup#first-api-level|ro.product.first_api_level]] property in order to ensure upgrade requirements are applied
  * Find the valid override values on [[https://source.android.com/setup/start/build-numbers|Codenames, Tags, and Build Numbers]]
  * This would be done inside the relative ''device.mk'' file

PRODUCT_PROPERTY_OVERRIDES += ro.product.first_api_level=<Valid_Override_Value>

=== Running CTS Tests ===

[[https://source.android.com/compatibility/cts/run|Running CTS Tests]] (This link will provide all steps necessary. The concise version is below.)

1. While inside the ''<SDK_install_dir>/bin'' directory, run the following commands

$ cd android-cts/tools
$ sudo ./cts-tradefed

2. Ensure that the Device Under Test (DUT) is found when launching cts-tradefed
  -- The following output should be seen

Android Compatibility Test Suite [Version] (5550264)
Use "help" or "help all" to get more information on running commands.
[Date] [Time] I/DeviceManager: Detected new device #
cts-tf >

 * If the above message isn’t seen, inside ''<SDK_install_dir>/bin'', run the following command

$ sudo ./adb devices

 * If your device doesn’t show up here, run the following commands inside ''<SDK_install_dir>/bin''

$ sudo ./adb kill-server
$ sudo ./adb start-server

 * Retry $ sudo ./adb devices
  * If your device(s) still doesn’t show up, reboot the device and retry the above steps

3. Once the DUT is found, continue

cts-tf > run cts --module CtsCarTestCases

 * '''cts-tf > list modules''' will list all modules and '''cts-tf > list plans''' will list all plans
 * '''CtsCarTestCases''' will run car-specific test cases
 * To exit CTS, '''cts-tf > exit'''

=== Test Results ===

Located in ''android-cts/results/<time_stamp>''

<SDK_install_dir>/bin/$ cd android-cts/results/<time_stamp>

== Vendor Test Suite (VTS) ==

Used for HAL and OS Kernel testing

=== Setup ===

[[https://source.android.com/compatibility/vts/systems|Systems Testing with VTS]]

=== Running VTS Tests ===

~$ vts-tradefed
vts-tf > list plans

We are interested in the ''vts-hal-auto'', described as the “VTS automotive vehicle HAL test.” The full list of plans can be found [[https://android.googlesource.com/platform/test/vts/+/master/tools/vts-tradefed/res/config/plans.md|here]]

vts-tf > run vts --plan vts-hal-auto

=== Test Results ===

Path should be given on completion of test

~$ cd <Android_FS>/out/host/linux-x86/vts/android-vts/results/<time_stamp>

= Known Bugs =

'''NOTE:''' These are known issues and may be resolved in the future depending on their impacts

1. Sepolicy output while the device is running

~/<SDK_install_dir>/bin$ sudo ./adb shell dmesg | grep denied | audit2allow -p <Android_FS>/out/target/product/beagle_x15/obj/ETC/sepolicy_intermediates/sepolicy

May see the following

#============== carservice_app ==============
allow carservice_app runtime_event_log_tags_file:file map;

#============== hal_vehicle_default ==============
allow hal_vehicle_default node:tcp_socket node_bind;
allow hal_vehicle_default self:tcp_socket { accept bind create listen };

These cannot be resolved at this time due to [[https://source.android.com/security/selinux/customize#neverallow|SEPolicy neverallow]]

2. Power manager service is failing

You may see the following errors

E CarPowerManagerNative: Received unknown bootReason = 0
E PowerTestService: ERROR: Could not read bootReason!!

3. CTS test_result_failures.html output when tested on pie-core-release branch with an AM57x BeagleBoard-X15

 * test_result_failures.html returned one failed test
  * android.car.cts.CarBluetoothTest#testRequiredBluetoothProfilesExist
 * Details
  * java.lang.NullPointerException: Attempt to invoke virtual method ‘boolean android.bluetooth.BluetoothAdapter.disable()’ on a null object reference

This is expected since the AM57x BeagleBoard-X15 doesn’t support Bluetooth at this time

= Upstream Status =
[[https://android-review.googlesource.com/c/device/ti/beagle-x15/+/985026|Patch for AM57x BeagleBoard-X15 is ready to be merged to AOSP]]

= Future Work =

 * Enable Android Automotive on TI 64 bit platforms, including AM6 and J7
 * Migrate to Android Q
  * Add support for 3 or more hardware displays
   * '''Interactive:''' Individual input mapping, decorative elements and IME (soft keyboard)
   * '''Driver:''' Main IVI display with all UX restrictions applied
   * '''Passenger:''' Add support for more types of apps and individual launchers for each screen
  * Multiple users with “headless” system, where a user is not associated with a real user and doesn’t have a lock screen
  * Multi-zone Audio
   * A zone is a collection of audio devices and each user device can only be in one zone
   * Within each zone, audio usage determines which device the audio is routed to
  * HwAudioSourcePlayer HAL, which connects the audio source device direcly to an Android mixer
   * Broadcast radio can take advantage of this player and operate as a regular Android media application
   * Add support for multiple applications communicating with a single tuner and a single application communicating with multiple tuners
   * Integrate a “Lazy HAL” that is started asynchronously or on demand. Introduced to solve hardware initialization issues. (Only for Broadcast radio HAL)

= FAQ =

1. What is important about this topic?

        This topic allows the entire Android Open Source community to benefit from an additional feature: Android Automotive on all currently supported Texas Instruments ARM32B and ARM64B platforms, including AM57x X15, AM6 and J721E.

2. Who is the intended end user?
        The intended end user(s) include the Automotive Business Unit for Digital Cockpit implementation targeted at infotainment customers who need a graphically rich user interface with an Android extensive app store on a Texas Instruments digital application processor.

3. When will this document be used?
        The reader will use this document whenever they intend to implement Android Automotive on any application processor which is designed to showcase and use the functionality of Android.

4. Why is this implementation on a Sitara device?
        This is the only available device at the moment but in the future, this work will be extended to J721E Auto.

= References =

 * [[http://git.omapzoom.org/?p=device%2Fti%2Fjacinto6evm.git&a=search&h=refs%2Fheads%2Fd-oreo-mr1-release&st=commit&s=auto|Jacinto 6 EVM on d-oreo-mr1-release]]
  * [[http://git.omapzoom.org/?p=device/ti/jacinto6evm.git;a=commit;h=d0e55148e19bb6ba3401b6ad913154697cb65af0|Changes for defining auto platform]]
  * [[http://git.omapzoom.org/?p=device/ti/jacinto6evm.git;a=commit;h=1acce155fa3d1c5925e474ecc66ba28e05f368a2|Initial changes for automotive configuration]]
  * [[http://git.omapzoom.org/?p=device/ti/jacinto6evm.git;a=commit;h=bb52b0b3590c7f169182400bf6fc436278a07bce|Initial changes for O MR1]]
 * [[https://android.googlesource.com/device/google/cuttlefish/+/refs/heads/pie-release/vsoc_x86_64/auto/device.mk|Google Cuttlefish Auto (cf_x86_64_auto-userdebug)]]
 * [[https://android.googlesource.com/device/generic/car/+/refs/heads/pie-release|AOSP Generic Car (aosp_car_x86_64-userdebug)]]
Describe AOSP/Auto here.

Describe AOSP/Auto here.

AOSP/Auto (last modified 2019-07-10 16:36:52)