Use try catch block to avoid car service crash

Bug: 395047636

In A14 per-display power management is implemented. If OEM use virtual
displays for some use case, Virtual display's power state also be
monitored in A14. Now for race condition during shutdown time if the
virtual display is removed, and car service is trying to power off that
particular Virtual display then the car service crash due to
IllegalArgumentException.

Test: atest CarPowerManagerTest ScreenOffHandlerUnitTest

Signed-off-by: Parijat Banerjee <pbanerj2@ford.com>
Change-Id: Iba678b27622097110b139cf8a0ad5dee62ce5346
1 file changed
tree: 78e30e7a67dcc6eb493a837477afe57c2d7bb1fd
  1. aconfig/
  2. apex_car_framework/
  3. car-builtin-lib/
  4. car-lib/
  5. car-lib-module/
  6. car-maps-placeholder/
  7. car-usb-handler/
  8. car_product/
  9. cpp/
  10. data/
  11. experimental/
  12. FrameworkPackageStubs/
  13. libs/
  14. packages/
  15. prebuilts/
  16. service/
  17. service-builtin/
  18. teams/
  19. tests/
  20. tools/
  21. .clang-format
  22. .gitignore
  23. clang_format_check_style.sh
  24. CleanSpec.mk
  25. CPPLINT.cfg
  26. OWNERS
  27. PREUPLOAD.cfg
  28. README.md
  29. TEST_MAPPING
README.md

AAOS

Source code for Android Automotive OS.

Structure

car_product/           - AAOS product
car-builtin-lib/       - A helper library for CarService to access hidden
                         framework APIs
car-lib/               - Car API
car-lib-module/        - Car API module
cpp/                   - Native services
experimental/          - Experimental Car API and services
packages/              - Apps and services for cars
service/               - Car service module
service-builint        - Platform builtin component that runs CarService module
tests/                 - Tests and sample apps
tools/                 - Helper scripts

C++

Native (C++) code format is required to be compatible with .clang-format file. The formatter is already integrated to repo tool. To run manually, use:

git clang-format --style=file --extension='h,cpp,cc' HEAD~

Note that clang-format is not desirable for Android java files. Therefore the command line above is limited to specific extensions.

Debugging CarService

Dumpsys and car shell can be useful when debugging CarService integration issues.

dumpsys

adb shell dumpsys car_service # to dump all car service information
adb shell dumpsys car_service --services [service name] # to dump a specific service information
adb shell dumpsys car_service --list # get list of available services

Dumpsys for CarService includes the following (more information is availble in dumpsys, below are just highlights):

  • Enabled features
  • Current power policy and list of registered power policies
  • Power state of componens of power policy
  • Silent mode status
  • Garage mode status
  • I/O stats
  • List of available vehicle properties

car shell

adb shell cmd car_service

CarService supports commands via car shell:
(list is not complete, run adb shell cmd car_service -h for more details)

  • Injection of vhal events
  • Toggling garage mode on/off
  • Toggling of suspend/hibernation/resume
  • Injection of input events
  • User managemnet/switching
  • Power policy control/manipulation

Helpful command for Garage mode

Start Garage mode

adb shell cmd car_service garage-mode on

Finish Garage mode

adb shell cmd car_service garage-mode on

Get Garage mode status

adb shell cmd car_service garage-mode query

Change Garage mode max duration (only eng and debug builds)

adb shell setprop android.car.garagemodeduration <seconds>