Commit graph

76 commits

Author SHA1 Message Date
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
Yu Shan
c5a9283c0e Refactor MockVehicleHardware into separate files.
Test: presubmit.
Bug: 200737967
Change-Id: Id28357f8ccd692de1daa47a1bfa539e90826b02a
2022-01-19 18:31:00 -08:00
Yu Shan
e032b15842 Use subscription manager in VHAL.
This CL renames GetSetValuesClient to ConnectedClient and add
SubscribeClient to the supported client type. The SubscribeClient
would provide a different timeout and on-results callback.

This CL adds a map for subscribe clients in VHAL and initializes
subscription manager.

Test: None, will add after we implement subscribe.
Bug: 200737967
Change-Id: I222b155e4365dcf0fa9344c7da5901142433f055
2022-01-19 18:31:00 -08:00
Yu Shan
686ec516bd Add subscription manager.
Add a class to manage VHAL subscription. It supports subscribing
and unsubscribing to properties. For continuous property, it uses
recurrent timer to recurrently calls the registered function. For
on-change property, it would return all subscribed clients for a
given property.

Test: atest DefaultVehicleHalTest
Bug: 200737967

Change-Id: I3e1a0401fd465dc31fe08ea77d5a6651fa7bbfaf
2022-01-19 18:31:00 -08:00
Yu Shan
5ad921ae27 Add RecurrentTimer for VHAL.
Add a RecurrentTimer that allows registering recurrent actions.

Test: atest DefaultVehicleHalTest
Bug: 200737967
Change-Id: I0d62c554bb8de404d9e9634ff8118c64ebf3c864
2022-01-19 18:31:00 -08:00
Yu Shan
c230860388 Manage pending requests in default VHAL.
Use PendingRequestPool in default VHAL to manage pending requests.
It would check for duplicate request IDs, call callbacks when request
timeout.

Test: atest DefaultVehicleHalTest
Bug: 203713317
Change-Id: Ifa42e6f06036c48914c56e357714b6dfb7173538
2022-01-19 18:31:00 -08:00
Yu Shan
28e06feed8 Use the new LargeParcelable API.
Bug: 210063973
Test: atest DefaultVehicleHalTest
Change-Id: Id1805638918acdf5bc79d2591d26829289ba56e8
2022-01-14 16:54:41 -08:00
Yu Shan
54cfc5a102 Add PendingRequestPool to handle pending requests.
PendingRequestPool would store all pending requests that we have
not yet got responses from hardware. If a request has been pending
for too long, the timout callback would be called and the request
would be removed.

Test: atest DefaultVehicleHalTest
Bug: 203713317
Change-Id: I4d7ae2c72b960347be70ac4cc8ce3d66eb8128f9
2022-01-14 14:12:16 -08:00
Yu Shan
65b7f4453b Implement setValues in DefaultVHAL.
Test: atest DefaultVehicleHalTest
Bug: 200737967

Change-Id: I702d139d2f1c0eb647559dde88deb0486c986c66
2021-12-28 17:40:45 -08:00
Yu Shan
ca779c76b9 Support latency in MockVehicleHardware.
Allow MockVehicleHardware to sleep for some time before returning
results to VHAL, so that we could test timeout behavior.

Test: atest DefaultVehicleHalTest
Bug: 200737967
Change-Id: I1198b80f1c08f664bc2fcdb6b590f6d84bc75384
2021-12-28 17:40:45 -08:00
Yu Shan
377dc7558d Add checkPropValue in VehicleUtils.
Test: atest VehicleHalVehicleUtilsTest
Bug: 200737967

Change-Id: I0e6eed7d085af2a45448efa845e3e8f66c0a84ce
2021-12-28 17:40:45 -08:00
Yu Shan
c2cf86b157 Implment getValues in Default VHAL.
Test: atest DefaultVehicleHalTest
Bug: 200737967

Change-Id: I46a0ebdf1c8e211cacc7568e7a8e6f5332083c14
2021-12-28 17:40:45 -08:00
Yu Shan
498b6b7856 Change the VHAL service name.
Change the VHAL service name.

Test: Manually build and test on emulator.
Bug: 209718034
Change-Id: If6d654648d8d7b197c1c75b7de024bbadcec2122
2021-12-09 15:49:43 -08:00
Yu Shan
d9ce3c88df Change IVehicleHardware callbacks to shared_ptr.
Use shared_ptr for hardware callbacks so that same callback could
be reused for multiple hardware calls.

Test: atest DefaultVehicleHalTest
atest FakeVehicleHardwareTest
Bug: 200737967

Change-Id: I2a005bbf77241fe2c85f871690c8aef18e770b69
2021-12-09 15:49:28 -08:00
TreeHugger Robot
01649e0b4d Merge "Beef up the documentation of VehicleApPowerStateReq" 2021-12-01 20:33:12 +00:00
Yu Shan
f9dcdea9f4 Add Java equal and toString annotations.
Add annotations so that the Java backend would generate equals and
toString methods, which would be useful in our code.

Test: Manual build.
Bug: 205774940
Change-Id: Ib08c5f42d29c6d028abcaa1a577147d1495cf550
2021-11-23 17:14:07 -08:00
Yu Shan
7a1c24fd5f Create ConnectedClient to manage VHAL clients.
Create a class to represent each VHAL client for each operations.
This class would manage the pending requests and maintain callbacks
that should be called when we get the result for async requests or
when the request time-out.

Test: atest DefaultVehicleHalTest
Bug: 200737967
Change-Id: I0e0be46f4a77b5dd5569fa949f67618a9aa9ac73
2021-11-16 15:45:03 -08:00
Yu Shan
8c24b293eb Add MockVehicleCallback for testing.
Test: None
Bug: 200737967
Change-Id: I2d34138a865be684720a1e0582cc9ea5a8a8ff04
2021-11-16 15:45:03 -08:00
Yu Shan
a8bc472e43 Add ParcelableUtils.
Add some helper functions to manage parsing/marshaling large
parcelable.

Test: None.
Bug: 200737967
Change-Id: I48729915aafe6d23de725e38ca5f653ba3147253
2021-11-16 15:45:03 -08:00
Eric Jeong
9e2b9e3f0e Beef up the documentation of VehicleApPowerStateReq
- HIBERNATION_ENTRY and HIBERNATION_EXIT are added next to
DEEP_SLEEP_ENTRY and DEEP_SLEEP_EXIT.

Bug: 206690574
Test: build okay
Change-Id: I157bb4798babd415f9a6302ce45aeb2560a505fd
2021-11-16 15:15:37 -08:00
Yu Shan
b33ac200cc Implement getPropConfigs in Default VHAL.
Test: atest DefaultVehicleHalTest
Bug: 200737967
Change-Id: Id0152cb2dbf489f5d709845108b87961f6d9a019
2021-11-03 16:11:47 -07:00
Yu Shan
23fcad97b1 Use FakeUserHal in FakeVehicleHardware.
Handle fake user hal properties in FakeVehicleHardware.

Test: atest FakeVehicleHardwareTest
Bug: 201830716

Change-Id: Ia60bbf7ae6a0fc5909dc8d27363af5c9939055d3
2021-11-01 22:29:12 -07:00
Yu Shan
7ed3aeb6ff Migrate fake user hal.
This CL mostly copies the existing user hal library with minor
modifications to use new AIDL type.

Test: atest FakeUserHalTest.
Bug: 201830716
Change-Id: I2bf4e96fb9fd71242e01f89c92cf743f7287ef64
2021-10-29 13:58:09 -07:00
Yu Shan
18198d7c51 Add special logic handle setting some props.
Add special logic to handle setting OBD2 properties and
VEHICLE_MAP_SERVICE.

Test: atest FakeVehicleHardwareTest
Bug: 201830716
Change-Id: I9b136efc452944e6c393c12feca14942919993c7
2021-10-29 13:58:09 -07:00
Yu Shan
bfc7030ee4 Migrate FakeObd2Frame to AIDL.
Test: atest FakeObd2FrameTest
Bug: 201830716

Change-Id: I1d83db2b0a1eb08ddc86c2a6106403edb73b6536
2021-10-29 13:58:09 -07:00
Yu Shan
27bfe01fc5 Migrate Obd2SensorStore.
Test: atest FakeObd2FrameTest
Bug: 201830716
Change-Id: Ibd460ab4c129707d567689d90979ca0424551a64
2021-10-29 13:58:06 -07:00
Yu Shan
a311631992 Add logic to handle special set values.
Test: atest FakeVehicleHardwareTest
Bug: 201830716
Change-Id: Ibecae5f917148d42a806c2a76faec4eac6d9ec7c
2021-10-28 18:30:03 -07:00
Yu Shan
b63d94be3c Change user flags to be bit map of flags.
Remove UserFlags enum. Change the flag field in UserInfo to be
bitmap of user flags.

Test: None
Bug: 202520478
Change-Id: Ia1837dde783b92dde830ee1244d38dfb684d546a
2021-10-28 18:30:02 -07:00
TreeHugger Robot
bef03540bc Merge "Add vendor override property to fake VHAL hardware." 2021-10-27 17:48:39 +00:00
TreeHugger Robot
e56bf6b9b5 Merge "Add EXTERNAL_CAR_TIME property in the Vehicle HAL." 2021-10-26 20:40:13 +00:00
Yu Shan
d7575f7672 Add vendor override property to fake VHAL hardware.
Allow vendor to override default properties in fake VHAL hardware.

Test: atest FakeVehicleHardwareTest
Bug: 201830716
Change-Id: Ie6061d7a8123e3b22c6fa467639f1fe77dec222c
2021-10-25 17:36:32 -07:00
Yu Shan
f242d50b18 Update epoch time property name.
The EPOCH_TIME is renamed to ANDROID_EPOCH_TIME in ag/16039960.

Test: Presubmit
Bug: 204104488
Change-Id: Icba29460d608734d6b6f708caf148871c0efba46
2021-10-25 14:16:04 -07:00
Yu Shan
d963db98f3 Merge "Migrate fake value generator." 2021-10-25 20:04:03 +00:00
Yu Shan
4ef92a9438 Merge "Migrate fake value generator hub." 2021-10-25 20:03:56 +00:00
TreeHugger Robot
a4865ca558 Merge "Support set/get value in fake vehicle hardware." 2021-10-25 20:03:39 +00:00
Ashutosh Agarwal
bb11285156 Add EXTERNAL_CAR_TIME property in the Vehicle HAL.
This property will be used to sync time between external ECUs and AAOS.

Bug: 157504928
Bug: 202376653
Test: build
Change-Id: Idb095246a786a771af7f31516b90098c1470e1ab
2021-10-25 17:50:26 +00:00
TreeHugger Robot
00836281ff Merge "Update Documentation and name for EPOCH_TIME to ANDROID_EPOCH_TIME." 2021-10-25 16:56:59 +00:00
Ashutosh Agarwal
1d9f2eb6f8 Update Documentation and name for EPOCH_TIME to ANDROID_EPOCH_TIME.
This is a change in behaviour for ANDROID_EPOCH_TIME property to align it with a future revisions.

This change was submitted to VHAL HIDL in http://ag/15618006.

Bug: 157504928
Bug: 202379958
Test: build using `make -j96 android.hardware.automotive.vehicle-V1-java`
Test: atest VehicleHalDefaultConfigTest

Change-Id: I464b9215f4bdcbbf53c1239b6d38f9940248b5cf
2021-10-21 05:24:57 +00:00
Yu Shan
f2b8b8f9ae Migrate fake value generator.
Test: atest FakeVehicleHalValueGeneratorsTest
Bug: 201830716
Change-Id: Ic113c9b189a07140a288d6d03d3a8a2b9061881f
2021-10-20 11:13:09 -07:00
Yu Shan
7987654ed6 Migrate fake value generator hub.
Migrate fake value generator hub. This CL also turns all exising
LockGuard to ScopedLock.

Test: atest FakeVehicleHalValueGeneratorsTest
Bug: 201830716
Change-Id: I3ce64792fa5a49ae5e11e1fc5636a30221c596e6
2021-10-20 11:13:08 -07:00
Yu Shan
b219ef0b5f Support set/get value in fake vehicle hardware.
Support setValues and getValues in fake vehicle hardware
implementation.

Test: atest FakeVehicleHardwareTest
Bug: 201830716
Change-Id: I4b94408434fd8511ab79d757116b776105d69222
2021-10-20 11:09:44 -07:00
Yu Shan
5ec4f372e9 Migrate ConcurrentQueue.
Test: atest VehicleHalVehicleUtilsTest
Bug: 201830716
Change-Id: I78671befd8351f17bf3da43372ec302e106690de
2021-10-20 11:09:44 -07:00
Yu Shan
5bd6aefe99 Add error code to VeiclePropertyStore.
Add error code to differentiate between different error cases, e.g.
when the value is not configured v.s. the value is not set.

Test: atest VehicleHalVehicleUtilsTest
Bug: 201830716
Change-Id: I1ef0716edce5bc72e07a769026769a330b4e3025
2021-10-19 17:04:38 -07:00
Yu Shan
8e7f780484 Add fake vehicle hardware implementation.
Add a fake vehicle hardware implementation that uses default config.
This would be used in emulator.

Test: atest FakeVehicleHardwareTest
Bug: 201830716
Change-Id: If93bdebb5c82b947a327688db80978fc4cb46d3c
2021-10-19 17:04:37 -07:00