Refactored user-switching tests on CarPowerManagementServiceTest.

They were using the HAL signals to trigger user switch, which was
too slow (~9.5s for each test method); with this change, most
tests now  call switchUserOnResumeIfNecessary() directly, which
drops their duration to ~3s - just the original test
(testSleepEntryAndWakeUpForProcessing(), which was re-added)
exercises the full workflow.

Before this change, it would take ~3:33 minutes to run the tests:

real	3m33.778s
user	0m9.021s
sys	0m2.459s

After the change, it dropped to ~1:52:

real	1m52.760s
user	0m8.828s
sys	0m1.890s

Test: atest CarServiceUnitTest:com.android.car.CarPowerManagementServiceTest
Bug: 151223325

Change-Id: I00b45a8c13ecfdb268a75586a05d818cef0c51db
2 files changed
tree: 1d7a79b210d1ca88a2d725e5e42c3b60e4202774
  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. surround_view/
  18. tests/
  19. tools/
  20. user/
  21. vehicle-hal-support-lib/
  22. watchdog/
  23. .clang-format
  24. .gitignore
  25. Android.mk
  26. CleanSpec.mk
  27. CPPLINT.cfg
  28. OWNERS
  29. PREUPLOAD.cfg
  30. 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.