Commit graph

403 commits

Author SHA1 Message Date
Hao Chen
5f7c1aae49 Merge nested namesapces
fix the nits in ag/10318156

Test: build
Change-Id: I44609f8c7cbeffcb02cb9f2e2f56f3a829de17f6
2020-02-25 13:20:41 -08:00
Hao Chen
7e9e37fa0a Split client and server impl
Some of the code in VHAL client implementation contains Android-specific
code, and some of the server operations only works in the native case.
So we split them up so that the AGL VHAL server can selectivly pick the
parts it needs.

It won't change the logic of native VHAL.

Bug: 148877226

Test: Build

Change-Id: Ie142b19a5c435a0b4252ffd297504bde69eb44b0
2020-02-24 15:17:12 -08:00
Hao Chen
8dfac92fee Split vehicle client and server interface header
Since vehicle client may contains some Android-specific types/headers
that may not exist on AGL, we split the header into "client" and "server".
It won't change the logic of Android codes.

Bug: 148877226

Test: build

Change-Id: I550034b071ca6a7ca322fb26b61d76ed4a7307ee
2020-02-24 15:11:17 -08:00
Hao Chen
080963546a Add headers and macros for building VHAL server for AGL
It won't change the logic of Android codes.

Bug: 148877226

Test: Android build won't break

Change-Id: I07006a4a3e20900a2fa90b84167d114f9ac45cfe
2020-02-21 14:38:05 -08:00
Jim Kaye
afb6d8fdf4 Clean up descriptions of power states
Clarify the descriptions of VehicleApPowerStateReq and
VehicleApPowerStateReport.

Fixes: 128841180
Test: None. Documentation only.
Change-Id: Icbe86e2e6a761e37adf2689596eb81bb68295fa7
2020-02-14 13:24:35 -08:00
Felipe Leme
f2d4327c83 Merge "Changed value of "no user id" to -10000 (same as UserHandle.USER_NULL)." 2020-02-13 04:17:33 +00:00
Felipe Leme
7778389b1a Fixed User HAL dump.
It was not validating the input before storing the response form lshal, which
would crash it later.

Test: adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default --set 299896583 a 2
Bug: 146207078

Change-Id: I49a38041e2881224c61e3c645db7c9103d024040
2020-02-12 12:04:10 -08:00
Felipe Leme
31a6216561 Changed value of "no user id" to -10000 (same as UserHandle.USER_NULL).
Test: no, thanks
Bug: 146207078

Change-Id: I8bdab48caa8cff98ac8795e6aa20a2b295363fda
2020-02-12 11:29:39 -08:00
Enrico Granata
52d6e032af Move the virtualized vehicle hal code into the trout tree
AAOS virtualization work is happening under the trout tree, and
we should be building reference HAL implementations for the
virtualized deployment under that tree

Bug: 148816426
Test: build
Change-Id: I90fd2bc4191f8076475e034c7feb07b2664e63c8
2020-02-10 17:42:53 -08:00
Felipe Leme
2acb9a7e0d Added VehicleHal.dump()
This (optional) function allows the HAL implementation customize lshal debug;
for example, it could:
  - augment dump() by dumping its own state
  - disable dump()
  - dump specific state based on arguments
  - run custom commands based on arguments

This CL also implements this method in the emulated vehicle HAL, where it adds
options to dump the user-related state.

Bug: 146207078

Test: adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default --user-hal
Test: atest android.hardware.automotive.vehicle@2.0-manager-unit-tests \
          android.hardware.automotive.vehicle@2.0-default-impl-unit-tests

Change-Id: If04e8222a31448f170ab2b54552051196b6ab958
2020-02-07 16:03:09 -08:00
Felipe Leme
003fe685c2 Implemented INITIAL_USER_INFO.
This property is called by Android when it starts, and it's expecting a
property change indicating what the initial user should be.

During normal circumstances, the emulator will reply right away, passing a
response if InitialUserInfoResponseAction::DEFAULT (so Android could use its
own logic to decide which user to boot).

But during development / testing, the behavior can be changed using lshal dump,
so the following scenarios can be tested:
- property timeout
- HAL response using a different request id
- user switch
- user creation

Bug: 146207078
Test: manual tests with lshal and a modified CarServiceHelper
Test: atest android.hardware.automotive.vehicle@2.0-manager-unit-tests \
      android.hardware.automotive.vehicle@2.0-default-impl-unit-tests

Change-Id: Ia5be62c8b19a168c0c6da5307169fc14bf3069c9
2020-02-07 09:35:14 -08:00
TreeHugger Robot
a01dc25fc1 Merge "Implemented IVehicle::debug() on default Vehicle HAL implementation." 2020-02-06 02:44:10 +00:00
Felipe Leme
6542f01ef2 Fixed typo (vehcile -> vehicle).
Test: rgrep -i vehcile . || echo NOT_FOUND
Bug: 146207078

Change-Id: I3ab9ffe25b6bf58a4ff18a70e94bf910b5302e72
2020-02-05 15:58:31 -08:00
Felipe Leme
75a27f8b37 Implemented IVehicle::debug() on default Vehicle HAL implementation.
This function allows developer to drive (no pun intend) the VHAL behaviour
using lshal, which is useful when implementing new CarService functionalities
that depend on VHAL properties.

Examples:

$ adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default --help
Usage:

[no args]: dumps (id and value) all supported properties
--help: shows this help
--list: lists the ids of all supported properties
--get <PROP1> [PROP2] [PROPN]: dumps the value of specific properties
--set <PROP> <i|s> <VALUE>: sets the value of property PROP, using an arbitrary number
  of key/value parameters (i for int32, s for string)

$ adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default | head -2
dumping 87 properties
1: {.timestamp = 0, .areaId = 0, .prop = 299896583, .status = AVAILABLE,
.value = {.int32Values = [3]{42, 1, 10}, .floatValues = [0]{}, .int64Values = [0]{},
.bytes = [0]{}, .stringValue = ""}}

$ adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default \
  --set 299896583 s Numbers i 4 i 8 i 15 i 16 i 23 i 42
Set property {.timestamp = 0, .areaId = 0, .prop = 299896583, .status = AVAILABLE,
.value = {.int32Values = [6]{4, 8, 15, 16, 23, 42}, .floatValues = [0]{},
.int64Values = [0]{}, .bytes = [0]{}, .stringValue = "Numbers"}}

$ adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle/default \
  --get 299896583

{.timestamp = 102372810363603, .areaId = 0, .prop = 299896583, .status = AVAILABLE,
.value = {.int32Values = [6]{4, 8, 15, 16, 23, 42}, .floatValues = [0]{},
.int64Values = [0]{}, .bytes = [0]{}, .stringValue = "Numbers"}}

Bug: 146207078
Test: see examples above
Test: atest android.hardware.automotive.vehicle@2.0-manager-unit-tests \
      android.hardware.automotive.vehicle@2.0-default-impl-unit-tests

Change-Id: I2a9bd6f39f2938653a404cab43bdae9e45476529
2020-02-05 15:22:50 -08:00
TreeHugger Robot
b1674a0147 Merge "Added more properties associated with user management:" 2020-02-05 05:56:39 +00:00
Felipe Leme
8edc5b8326 Added more properties associated with user management:
- CREATE_USER: called after an Android user is created.
- REMOVE_USER: called after an Android user is removed.
- USER_IDENTIFICATION_ASSOCIATION: associates an Android user with
  vehicle artifacts like a key FOB.

This CL only defines the new types, they're not implemented or used yet.

Test: m -j android.hardware.automotive.vehicle@2.0-service
Bug: 146207078

Change-Id: Idb399df55567402edb1b954b1c4b25f69e810a81
2020-02-04 19:01:40 -08:00
Enrico Granata
c44909ded8 Centralize creation and error handling for VsockServerInfo
Provide helper functions that create VsockServerInfo objects
from either the command line or the property storage, and
have them return optional instead of relying on default values.

Also, avoid atoi() since it has the potential for undefined behavior.

Test: build
Change-Id: I0aab6b7d84e5084580e25217ac5ba4f5a1db6e2a
2020-02-03 14:01:37 -08:00
felipeal
c5afe480bd Added new properties on Vehicle HAL to support user management.
These initial properties are:

- INITIAL_USER_INFO: gets information about the initial user, it will
  replace the android.car.systemuser.bootuseroverrideid system property
  approach.
- SWITCH_USER_REQUEST: used to communicate a user switch request from
  Android to HAL, or vice versa.

This CL only defines the new types, they're not implemented or used yet.

Test: m -j android.hardware.automotive.vehicle@2.0-service
Bug: 146207078

Change-Id: I25055f8adc90aaebaf3a3faa9a9b73c284440624
2020-01-31 09:24:15 -08:00
Hao Chen
5a97c389e9 Apply Grpc Client to current VHal Implementation
Test: tested on Cuttlefish VM

 - Use virtualization HAL implementation, device/google/cuttlefish/shared/auto/device.mk, PRODUCT_PACKAGES:
      remove android.hardware.automotive.vehicle@2.0-service
      add:
        android.hardware.automotive.vehicle@2.0-virtualization-service
        android.hardware.automotive.vehicle@2.0-virtualization-grpc-server

 - configure the server CID and port, add the following device/google/cuttlefish/shared/config/init.vendor.rc:
        setprop ro.vendor.vehiclehal.server.cid 3
        setprop ro.vendor.vehiclehal.server.port 9210
 - Build and Launch cuttlefish VM
        m && acloud create --boot-timeout 3600 -vv --local-instance --local-image
 - VHAL should work as normal, see tests in ag/9693857

Bug: b/141493212

Change-Id: I97df02dd26b89f60d3d87b2c32c4f4f8919b1294
2020-01-23 13:34:34 -08:00
Hao Chen
46df8f5909 Grpc Vehicle Connectors
Test: Build; test with ag/9869095

Bug: b/141493212

Change-Id: Ia4c0b0b5b358b1c67aae43d8c64f781b83725329
2020-01-23 13:14:29 -08:00
Tyler Trephan
8081fb6eba Merge "Updated PERF_STEERING_ANGLE to support rear steering." 2020-01-18 00:17:06 +00:00
Tyler Trephan
e57c109d3e Adding INFO_EXTERIOR_DIMENSIONS car property.
Fix: 146020990
Test: Tested on device.
Change-Id: I003cbb05de0a91efb8e393860fc64ba508515b26
2020-01-17 11:31:09 -08:00
Tyler Trephan
cb8d72c707 Updated PERF_STEERING_ANGLE to support rear steering.
Change-Id: I2d8d8eff076ab2b76476a8b4edc18d213df71d45
Fix: 146022250
Test: Tested on device.
2020-01-14 16:12:55 -08:00
Hao Chen
0885f9b10a Set Timestamp By the Server when the client called 'set'
Test: Build; unit tests `atest packages/services/Car/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java`

Bug: b/141493212

Change-Id: I6686a15d6e9fa483d9b361acfe88001b7497b937
2019-12-20 10:48:45 -08:00
Hao Chen
de6835be3e Simplify Connector class APIs and hierachy
Test: Build; unit tests `atest
 packages/services/Car/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java`

Bug: b/141493212

Change-Id: I6c561d517646760dfff63cb6c6b50c3c5994098a
2019-12-20 10:48:15 -08:00
Hao Chen
5f82b989bb Merge changes from topic "proto_package_name"
* changes:
  A more generalized package name for VHal proto IDLs
  Protobuf message converter should be a public utility library
2019-12-19 21:30:40 +00:00
Hao Chen
5deac06ad9 A more generalized package name for VHal proto IDLs
Test: build; test (and submit) with ag/9868729

Change-Id: Iacdf518d8c90485430a009e341dd1fd705b7ee83
2019-12-06 16:01:28 -08:00
Hao Chen
1c1fdca026 Protobuf message converter should be a public utility library
Test: Built, and flashed to Osprey (go/enable-google-vhal-on-osprey)

```
# See value changed in Vehicle HAL tab, KitchenSink app:
$ python packages/services/Car/tools/emulator/prop_event_simulator.py
--property
VEHICLEPROPERTY_HVAC_AC_ON --area 0 --value 1

# unit tests
$ atest android.hardware.automotive.vehicle@2.0-default-impl-unit-tests
```

Change-Id: I3841870614f316f2f0e2f54283674223a0b036f4
2019-12-06 15:58:20 -08:00
Keun-young Park
f3b8f482be Merge "Add DISABLED_OPTIONAL_FEATURES property" 2019-11-25 17:58:41 +00:00
Hao Chen
ad1222486d Merge "Add GRPC Server as a Library to VHal Build File" 2019-11-22 22:37:18 +00:00
Hao Chen
744fe1a75b Merge changes Iab77a0ae,Ibf525ffe
* changes:
  Applying the vehicle connector to the VHAL
  Implement the connector for emulated vehicles
2019-11-22 19:03:40 +00:00
Hao Chen
fba3ac86cc Applying the vehicle connector to the VHAL
Make VHAL to use the connector/server interfaces instead of talking to
the (faked) vehicle directly. Use passthrough connector for now since we
have not moved to the virtualized scenario yet (but soon :)

Bug: b/141493212

Test: On both Osprey and Hawk. Build and flash the image. If on Osprey, see
go/enable-google-vhal-on-osprey; if on hawk, `aae app vhal apply google`
to enable Google VHAL

```
# no VHAL crash
$ adb logcat

$ vts-tradefed
> run vts-hal-auto -m VtsHalAutomotiveVehicleV2_0Host
# 30 passed, 2 failed, the same as the result before this patch

# See value changed in Vehicle HAL tab, KitchenSink app:
$ python packages/services/Car/tools/emulator/prop_event_simulator.py --property
VEHICLEPROPERTY_HVAC_AC_ON --area 0 --value 1

# unit tests
$ atest packages/services/Car/tests/vehiclehal_test/src/com/android/car/vehiclehal/test/CarPropertyTest.java
```

Change-Id: Iab77a0ae32db2c55b4c65aa8f3e4f73ec9ef2644
2019-11-21 16:57:31 -08:00
Hao Chen
3ebbb8273f Add GRPC Server as a Library to VHal Build File
Bug: b/141493212

Test: Tested with ag/9775633, successfully compiled, also tested with ag/9775563

Change-Id: Icf046aafe3d5794a8b79183baa370bdbbcdb796a
2019-11-21 14:51:04 -08:00
Hao Chen
cda8e6e03a Implement the connector for emulated vehicles
Some functions are copyed from the original VHAL implementation. The
ones left in the old implementation will be removed after enabling the
Vehicle Connector. Keeping them right now because otherwise it will
break the build.

Bug: b/141493212

Test: since nothing changed in the "active" code, just compiled by `mm`

Change-Id: Ibf525ffe056d6a4c789a7a407eb0b54f61858041
2019-11-21 13:21:49 -08:00
Keun young Park
697cb33c45 Add DISABLED_OPTIONAL_FEATURES property
- This allows disabling specific optional features in car service from
  vehicle hal layer.

Bug: 144504820
Test: run with car service

Change-Id: I419ad86b75151aba129730bdc75c9bc1e47333cf
2019-11-20 18:29:35 -08:00
Prachi Hande
8068753e78 Merge "VmsUtils: Add new methods to parse availability state messages" into qt-qpr1-dev am: 0d1d5a0697
am: 6533853937

Change-Id: I1380935021936bb530ddeeaad3b76e00664d0a1f
2019-11-19 13:07:56 -08:00
Prachi Hande
6533853937 Merge "VmsUtils: Add new methods to parse availability state messages" into qt-qpr1-dev
am: 0d1d5a0697

Change-Id: Id96237e0638dad9fa3d6edcba768c8a5606e5ee4
2019-11-19 13:04:33 -08:00
Kai Wang
683ad9fa44 Merge "Support chose permissions for vendor property" 2019-11-19 19:02:47 +00:00
Prachi Hande
dbce8697bd VmsUtils: Add new methods to parse availability state messages
These methods are needed in the HAL client to parse sequence number and
associated layers when the availablity of the VMS layers change.
HAL client relies on these messages by either explicitly requesting the
availability or through availability change message sent by the Car
service.

Bug: 144434783
Fixes: 144434783

Test: Added new tests for the new methods. Ran the tests on Hawk.
Change-Id: I09497640367a894e1dfb6143ac3bbdb63d64b53e
2019-11-19 10:40:20 -08:00
TreeHugger Robot
2098b9e370 Merge "Interface Definition of Vehicle HAL Connector/Vehicle Server Pair" 2019-11-15 19:46:35 +00:00
Hao Chen
b9fb7e58fc Interface Definition of Vehicle HAL Connector/Vehicle Server Pair
Test: compiled by `mm`

Change-Id: I0616e9abfca28656242a82e6ca6addad9b9b812c
2019-11-14 18:03:00 -08:00
Kai
7ba4cf867c Support chose permissions for vendor property
Add property SUPPORT_CUSTOMIZE_VENDOR_PERMISSION.
Add enum VehicleVendorPermission.
The configArray of new property indicate vendor property Id and
the permission selected by vendor.
Update google VHAL as an example how to use it.

Bug: 109950289
Test: build and flash with google HAL
      check permission via property test in KitchenSink

Change-Id: Ic8dcb661ce69bfb82ebc00781426dfbb98fb393d
2019-11-13 17:59:58 -08:00
TreeHugger Robot
234d8f806c Merge "Log and return error if failed to listen to a socket" 2019-11-13 21:39:05 +00:00
Hao Chen
86e5880d82 Log and return error if failed to listen to a socket
Test: build by `mm`

Change-Id: I5cf38c4011274ff70a02ac7472a10670b779aa85
2019-11-11 22:51:03 -08:00
Inseob Kim
d86992f29a Merge "Remove static vndk dep from vendor modules" am: 437baabfde am: 5d5fee2ef2
am: 936efb8177

Change-Id: Ifb7b89378fd22a8c8cf8a89b41845339c3e0c60f
2019-11-10 22:37:37 -08:00
Inseob Kim
936efb8177 Merge "Remove static vndk dep from vendor modules" am: 437baabfde
am: 5d5fee2ef2

Change-Id: I42aac9039542e01e230aef0d306ea30ae0221fc5
2019-11-10 22:33:03 -08:00
Inseob Kim
5d5fee2ef2 Merge "Remove static vndk dep from vendor modules"
am: 437baabfde

Change-Id: I75a47428508efbaa060d9c72a51b3e5f47472ec5
2019-11-10 22:29:38 -08:00
Treehugger Robot
437baabfde Merge "Remove static vndk dep from vendor modules" 2019-11-11 06:15:14 +00:00
Jordan Jozwiak
88213e3193 DO NOT MERGE Add DISTANCE_DISPLAY_UNIT to google VHAL
Bug: 138816759
Test: aae app vhal apply google & dump properties
Change-Id: I6a4d571975d5fe7ba6419cd4c37b734f21162f41
(cherry picked from commit 2619443e0a)
2019-10-31 23:28:19 -07:00
Xin Li
ab68d3750b DO NOT MERGE - qt-qpr1-dev-plus-aosp-without-vendor@5915889 into stage-aosp-master
Bug: 142003500
Change-Id: I8933ff57906fffacf1d48d606451533ec5b79fa2
2019-10-30 11:49:26 -07:00