Commit graph

119 commits

Author SHA1 Message Date
Maxim Pleshivenkov
124c3cde03 Update flag value
Set ENABLE_HIBERNATION_FLAG to a correct value.
Flag is used as a bitmask, and should set single bit.

Bug: 233373476
Change-Id: Ia60cdb3c9c344b3606ea07ed411ed6325a71c396
Test: atest CarServiceUnitTest
2022-05-20 18:59:30 +00:00
Yu Shan
b47e11e847 Fix a bug that would access uninitialized data.
Fix a bug where mThread is initialized before mRequests, causing
the new thread to access uninitialized mRequests.

Test: None. This is a race condition depending on when the thread is
started and hard to reproduce.
Bug: 231647009

Change-Id: I68037125bf4d14846585bd3a038844e4a7ced377
(cherry picked from commit 5e26ad3bf7)
2022-05-07 00:46:32 +00:00
TreeHugger Robot
1eb9ba70b8 Merge "Added supportedAreas for CRITICALLY_LOW_TIRE_PRESSURE" into tm-dev 2022-04-29 00:24:12 +00:00
Tyler Trephan
4677012912 Added supportedAreas for CRITICALLY_LOW_TIRE_PRESSURE
Test: atest CarPropertyManagerTest
Fix: 230386029
Change-Id: Idbd07a361f11b6b616c11ef2c359b656012b40cc
2022-04-25 22:58:59 +00:00
TreeHugger Robot
94b57a5d01 Merge "Added min/max rates for EV_CHARGE_TIME_REMAINING" into tm-dev 2022-04-22 16:26:28 +00:00
Tyler Trephan
e438bd358b Added min/max rates for EV_CHARGE_TIME_REMAINING
Test: atest CarPropertyManagerTest
Bug: 229118601
Change-Id: I6adedf1def47486ebe3cf9d12abe2bd65e0d6d48
2022-04-21 20:30:17 +00:00
Jiyong Park
70f5837e1f Freeze AIDL APIs for TM
Bug: 225941299
Test: m
Change-Id: I61eb51c0334eb99489c6f1570110d7e18c350c99
2022-04-16 07:03:24 +09:00
Tyler Trephan
fdf818ffce Updated EV_CHARGE_CURRENT_DRAW_LIMIT config array
Test: atest CarPropertyManagerTest
Bug: 229118601
Change-Id: If894454260852a1c7fa7ebfb3cf98682120bb397
2022-04-13 19:49:17 +00:00
Yu Shan
e3421c3ce2 Support '--user-hal' in FakeVehicleHardware.
Support dump fake user hal command in FakeVehicleHardware.

Test: atest FakeVehicleHardwareTest
Bug: 228218366
Change-Id: I9884a1a216d07da6ccb58af1fa869266c959f80c
2022-04-09 00:31:17 +00:00
Yu Shan
6923449c42 Make FakeVehicleHardware async.
Use a handler thread to handle all the get/set value requests in
FakeVehicleHardware to make it async. Vendor implementation should
use similar logic to make their VHAL async.

Test: atest FakeVehicleHardwareTest
Bug: 226001897
Change-Id: Iba95125e63566c27597b9d11bff131c229846d49
2022-04-09 00:31:17 +00:00
TreeHugger Robot
9c15ed74b6 Merge "Update subscription logic for VHAL ref impl." into tm-dev 2022-04-08 23:07:06 +00:00
Yu Shan
5a06465d3c Update subscription logic for VHAL ref impl.
Update the implementation for subscription logic. Add clearer
documentation for sampleRate and timestamp behavior. The sampleRate
specified in subscribeOptions is just a guidance to tell VHAL what
the polling rate could be. For timestamp, the timestamp returned
for each property must be the timestamp when that property is
updated, not when the property is retrieved.

Test: atest FakeVehicleHardwareTest
Bug: 225191802, 226000926
Change-Id: I1e886133258236eedfa7fcffe5c4fb49aead4f6f
2022-04-06 23:40:17 +00:00
Jiyong Park
703e97920e Freeze AIDL APIs for TM
Bug: 225941299
Test: m
Change-Id: Ie41cc0797710f813f92c65c387f247c7806d8394
2022-03-31 12:01:39 +09:00
Nishtha Ahuja
f898641c09 Merge "Add default config for new VHAL properties in Android T." into tm-dev 2022-03-31 01:27:27 +00:00
Nishtha Ahuja
10651a6e68 Add default config for new VHAL properties in Android T.
Bug: 218388191
Test: manually tested in KitchenSink app
Change-Id: I08b980a272e66d87de134dc37d6916209f4b4374
2022-03-30 04:38:34 +00:00
Yu Shan
abd3431f9e Add ECHO_REVERSE_BYTES in VHAL ref impl.
This is a test property to test LargeParcelable end to end. It would
echo byte values back in reversed order.

Test: atest AndroidCarApiTest:android.car.apitest.VehicleHalLargeParcelableTest
Bug: 224595312
Change-Id: Ib07c7f602613919aef452ac8796a93988a1a9d65
2022-03-25 01:33:01 +00:00
Yu Shan
10707d6ae9 Merge changes from topics "aidl_vhal_vts", "vhalresult" into tm-dev
* changes:
  Define VhalResult alias.
  Migrate VHAL VTS to be AIDL compatible.
2022-03-17 19:00:01 +00:00
Yu Shan
2897aff9d8 Handle sample rate out of bound correctly.
This CL changes the behavior when sample rate is out of bound
for VHAL. Sample rate would be fitted to the range if out-of-bound.
Also added some comments to clearly document this behavior.

Test: atest DefaultVehicleHalTest
atest CtsCarTestCases
Bug: 225025926

Change-Id: Id853070cb0dc823855a68f86a01de2ff2a011577
2022-03-17 00:40:55 +00:00
Yu Shan
24fee7bba9 Define VhalResult alias.
Define a VhalResult alias to represent Result that contains a VHAL
StatusCode as error type. This alias helps client to easier migrate
from android::base::Result to VhalResult.

Test: Presubmit
Bug: 219612366
Change-Id: I17f15044ee962c7148b0adc3925e0b0a9dfab2a8
2022-03-04 14:07:45 -08:00
Yu Shan
f46e1df10b Clean up resource correctly when client died.
Add proper lock to make sure that all resources would be cleaned
up for a client if the client died. Also add check and not to
allocate resources for an already dead client.

Test: atest DefaultVehicleHalTest.
Run manually and do not see 'failed to call callback' messages.
Bug: 221500501

Change-Id: I1c799a6234017b976e7776537ab91526e785b9b4
2022-03-04 14:07:43 -08:00
Yu Shan
a58110ea59 Define custom error type for StatusCode.
Define a wrapper class for StatusCode to be used as E in
Result<T, E>. By default E is errorno as defined in linux and does
not print out the correct error message.

Migrate existing Result usage in VHAL to Result<T, VhalError>.

Test: atest VehicleUtilsTest
Bug: 219612366
Change-Id: Ic5369b6035bc46afc4c61da26c4b50f7fa9969d8
2022-03-03 02:31:37 +00:00
TreeHugger Robot
273583165c Merge changes from topic "fakevaluegeneratortest" into tm-dev
* changes:
  Fix a flaky test in FakeVehicleHalValueGeneratorsTest.
  Improve test coverage for FakeValueGenerator.
2022-02-25 04:19:11 +00:00
Yu Shan
d0e9111cad Fix a flaky test in FakeVehicleHalValueGeneratorsTest.
Fix a flaky test which might be caused by when the lock is waked
up, we might have more events than what we want. Furthermore, we
have to clear existing events after unregistering event generator.

Test: atest FakeVehicleHalValueGeneratorTest 10 times on cf_auto
Bug: 221084327
Change-Id: I65e87fa62b8538164fcdd60a9df871a9817f4f8e
Merged-In: I65e87fa62b8538164fcdd60a9df871a9817f4f8e
(cherry picked from commit 6ae468c1e3)
2022-02-25 00:33:01 +00:00
Yu Shan
83fe805275 Improve test coverage for FakeValueGenerator.
Bug: None
Test: atest FakeVehicleHalValueGeneratorsTest
Change-Id: I6df508e148ff0348fc28b467b4e5a70cf5727a27
Merged-In: I6df508e148ff0348fc28b467b4e5a70cf5727a27
(cherry picked from commit 6ae468c1e3)
2022-02-25 00:32:13 +00:00
Yu Shan
b48b6e28cb Improve getPropConfigs and error logging.
This CL improves getPropConfigs to return INVALID_ARG when one of
the prop ID is not found according to the AIDL interface definition.

This CL also improves logging to print out exception code.

This CL also updates service manifest to be consistent with
https://source.android.com/devices/architecture/aidl/aidl-hals

Test: atest DefaultVehicleHalTest
Bug: 219782023, 219612366
Change-Id: I96b091c5cf6641ab7d1df5c644bde7491cbaa5e7
2022-02-24 15:05:08 -08:00
Yu Shan
69ab393b88 Always trigger prop change event for WAIT_FOR_VHAL.
CarService always expect VHAL to generate a property change event
when sending WAIT_FOR_VHAL even though there is not actual power
state change in VHAL.

VHAL power state might already be ON when receive WAIT_FOR_VHAL if
CarService client crashes and restarts. In this case, CarService
still expects an event to be generated.

VehiclePropStore would only generate event when there is an actual
property value change, so we must erase the value before setting
the value to ensure a change event.

Test: atest FakeVehicleHardwareTest
Bug: 219861737
Change-Id: I185b07e188f0b581253b5ab29faf859247ed9d38
2022-02-23 12:40:23 -08:00
Antonio Kantek
40882e1f54 Merge "Update CustomInputType AIDL documentation" 2022-02-17 17:06:58 +00:00
Antonio Kantek
b62be4dbac Update CustomInputType AIDL documentation
OEMs are now free to pick any input code to represent their custom input
event.

Bug: 217288618
Test: atest CarServiceUnitTest
Change-Id: I48c967f0b2692bedef32cfae5435c8d4624e353f
2022-02-16 10:30:09 -08:00
Yu Shan
6753453867 Remove default value for AP_POWER_STATE_REQ.
Remove the default value for AP_POWER_STATE_REQ because initially the
device should be in an OFF state, but there is no such
AP_POWER_STATE_REQ. If we set the default value to ON, then when
VHAL set the value to ON, it would cause no value update event to
inform CarService.

Test: atest FakeVehicleHardwareTest.
Manually run audio test on cf target.
Bug: 218924258

Change-Id: I3552a38bf2433015767c2254e42871cee5c9e716
2022-02-12 00:53:25 +00:00
Yu Shan
75d311d54e Make VehicleHalUtils vendor available.
Test: Presubmit
Bug: 214635003
Change-Id: I402725599ec22574ed2bd5620e9b9328ff1800f4
2022-02-09 12:03:11 -08:00
TreeHugger Robot
afbb9baf07 Merge "Add vehicle curb weight property" 2022-02-08 20:18:25 +00:00
Kiran Rachuri
20014dab39 Add vehicle curb weight property
Bug: 197026083
Test: Build
Change-Id: I8c621b355e3d199dbac7a6170c1281fa2d7e03ad
2022-02-08 16:42:46 +00:00
Yu Shan
911588a887 Merge "Remove full namespace in header file." 2022-02-07 22:47:32 +00:00
Yu Shan
d0c0bbb6ce Remove full namespace in header file.
Test: Presubmit.
Bug: 215443397
Change-Id: If8d3556e06119d12f515dc68a591e0f342761d6f
2022-02-03 17:58:48 -08:00
Kiran Rachuri
6c4bb0aae6 Add trailer present property
Bug: 197026083
Test: Build
Change-Id: I734f35e3d7ef17aa47c2c2cc57ba87e6e7944e79
2022-02-04 00:12:39 +00:00
Kiran Rachuri
8f1f1503c5 Add properties for EV charging
Bug: 209021366
Test: Build
Change-Id: Iec82501e478830ff7f1830750394ad5b0ecc9735
2022-02-03 15:48:50 +00:00
Yu Shan
b819484c47 Rename VehicleHalUtils to VehicleHalUtilsVendor.
Rename the existing vendor version VehicleHalUtils to
VehicleHalUtils vendor and then create a non-vendor version of
VehicleHalUtils.

Test: Presubmit
Bug: 214635003
Change-Id: I7717d2e9527b9dd8592bbdff152aab4ef1b80a10
2022-01-31 18:34:19 -08:00
TreeHugger Robot
4eaebc9395 Merge "Move PendingRequestPool and ParcelableUtils." 2022-01-27 02:37:37 +00:00
Kiran Rachuri
d25ef71f90 Merge "Add properties for front and rear fog lights" 2022-01-26 21:15:36 +00:00
Yu Shan
5b320fb72d Move PendingRequestPool and ParcelableUtils.
Move PendingRequestPool and ParcelableUtils to utils so that we could
reuse it for cpp VHAL client.
This CL also fixes a bug that the comment for PendingRequestPool
timeout unit is incorrect.

Test: atest VehicleHalVehicleUtilsTest
Bug: 214635003
Change-Id: Ie8ac1e0c4f49ae70caff7b680a7352fc23d4e680
2022-01-25 13:01:16 -08:00
Kiran Rachuri
44def7c860 Add properties for front and rear fog lights
Bug: 196103754
Test: Build
Change-Id: Id6049514917dd5f3a8375b0479c972a04c2caaf3
2022-01-24 20:48:43 +00:00
Yu Shan
92ee56024e Add some helper functions for Emulator.
Add some helper function for EmulatedVehicleHardware to use.

Test: atest FakeVehicleHardwareTest
Bug: 215419573
Change-Id: I64da5a0eae3872c608da925d68756a823299672c
2022-01-21 22:11:40 -08:00
Yu Shan
6cd2fd7e5f Move VehicleHalProto out from vhal_v2_0.
VehicleHalProto would be used by AIDL Vhal as well so move it to
a common place.

Test: Presubmit
Bug: 215419573
Change-Id: I1e886a64a6c5ef76f7dc918feccc9cf63b8bca0c
2022-01-21 15:30:52 -08:00
Yu Shan
73446f4958 Support set property in dump.
Support debug interface to set property value in FakeVehicleHardware.

Test: atest FakeVehicleHardwareTest.
Bug: 214613918
Change-Id: I64ef532274e20db1444e8583d71e0c0955c5b460
2022-01-21 15:30:51 -08:00
Yu Shan
93d36287e6 Support debug dump
Test: atest FakeVehicleHardwareTest
Bug: 199314530
Change-Id: Ied0d1cd7c21e62a7db085f3b5be465cb0d576e73
2022-01-21 15:14:40 -08:00
Yu Shan
2e6d900f3a Prevent log spam.
Add a macro guard for log messages to prevent spam.

Test: Manually test on emulator.
Bug: 200737967
Change-Id: I27a270fe70cf706307a0908d6d4aae8e5197a3e5
2022-01-21 15:02:52 -08:00
Yu Shan
26a3150b71 Optimize some code path to move instead of copy data.
Test: atest DefaultVehicleHalTest
Bug: 210063973
Change-Id: Ia6a75df7098fae23797571bb59dad3696239ab87
2022-01-21 14:50:30 -08:00
Yu Shan
14829be269 Implement linkToDeath, use binder as client ID.
Implement linkToDeath for binders. Delete allocated resources for a
binder when it died or unlinked.

This CL also uses 'const AIBinder*' as client id type instead of
the callback because the Binder object corresponds to the remote
proxy and is guaranteed to be unique per client.

Bug: 204943359
Test: atest DefaultVehicleHalTest
Change-Id: If2e0c58e86a041a78b8ca69597aef4733ce1826c
2022-01-20 14:14:03 -08:00
Yu Shan
d110eda701 Add permission check and heartbeat event to VHAL.
Test: atest DefaultVehicleHalTest
Bug: 200737967
Change-Id: I5ee4209a59dd63173060fb52a69a80bfbb3522c9
2022-01-20 13:49:56 -08:00
Yu Shan
4299bb3254 Support subscribe/unsubscribe in VHAL.
Test: atest DefaultVehicleHalTest
Bug: 200737967

Change-Id: I4e7b31af7fa2af445f9bac6ec71dad3bf6c0b8b3
2022-01-20 13:49:56 -08:00