Improvements on CarService dump():

- Added --help option
- Added --hal option do dump halls (all or specific ones)
- Fixed UserHalService dump

Examples:

$ adb shell dumpsys car_service --help
Car service dump usage:
[NO ARG]
	  dumps everything (all services and HALs)
--help
	  shows this help
--list
	  lists the name of all services
--list
	  lists the name of all HAls
--services <SVC1> [SVC2] [SVCN]
	  dumps just the specific services, where SVC is just the service class
	  name (like CarUserService)
--vms-hal
	  dumps the VMS HAL metrics
--hal [HAL1] [HAL2] [HALN]
	  dumps just the specified HALs (or all of them if none specified),
	  where HAL is just the class name (like UserHalService)
-h
	  shows commands usage (NOTE: commands are not available on USER builds
[ANYTHING ELSE]
	  runs the given command (use --h to see the available commands)

$ adb shell dumpsys car_service --list-hals
com.android.car.hal.PowerHalService
com.android.car.hal.InputHalService
com.android.car.hal.PropertyHalService
com.android.car.hal.DiagnosticHalService
com.android.car.hal.VmsHalService
com.android.car.hal.UserHalService

$ adb shell dumpsys car_service --hal UserHalService
*User HAL*
next request id: 1
no pending callbacks

$ adb shell dumpsys car_service --hal 9000
No HAL named 9000. Valid options are: [VmsHalService, UserHalService, PropertyHalService, PowerHalService, InputHalService, DiagnosticHalService]

Bug: 146207078
Test: see above

Change-Id: I7063128df3749645d7fa9453968076ebe68a506b
3 files changed
tree: af45867b4b89c9d8e5fedfcd3aef2613e32baafe
  1. car-bugreportd/
  2. car-default-input-service/
  3. car-lib/
  4. car-maps-placeholder/
  5. car-systemtest-lib/
  6. car-test-lib/
  7. car-usb-handler/
  8. car_product/
  9. computepipe/
  10. EncryptionRunner/
  11. evs/
  12. experimental/
  13. FrameworkPackageStubs/
  14. obd2-lib/
  15. procfs-inspector/
  16. service/
  17. tests/
  18. tools/
  19. user/
  20. vehicle-hal-support-lib/
  21. watchdog/
  22. .clang-format
  23. .gitignore
  24. Android.mk
  25. CleanSpec.mk
  26. CPPLINT.cfg
  27. OWNERS
  28. PREUPLOAD.cfg
  29. README.md
README.md

Native (C++) code format is required to be compatible with .clang-format file. Run

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.