Merge changes I3b0c6325,I40f97f4b

* changes:
  Fix a race condition in remote access HAL.
  Define a new remoteaccess HAL for test.
This commit is contained in:
Treehugger Robot 2022-12-08 02:26:31 +00:00 committed by Gerrit Code Review
commit a55e702324
4 changed files with 49 additions and 7 deletions

View file

@ -18,11 +18,9 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V1-default-service",
cc_defaults {
name: "remote-access-hal-defaults",
vendor: true,
vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-default-service.rc"],
relative_install_path: "hw",
srcs: ["src/RemoteAccessImpl.cpp"],
whole_static_libs: [
@ -41,10 +39,29 @@ cc_binary {
],
cflags: [
"-Wno-unused-parameter",
],
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V1-default-service",
defaults: ["remote-access-hal-defaults"],
vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-default-service.rc"],
cflags: [
"-DGRPC_SERVICE_ADDRESS=\"localhost:50051\"",
],
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V1-tcu-test-service",
defaults: ["remote-access-hal-defaults"],
vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-tcu-test-service.rc"],
cflags: [
"-DGRPC_SERVICE_ADDRESS=\"10.10.10.1:50051\"",
],
}
cc_library {
name: "RemoteAccessService",
vendor_available: true,

View file

@ -0,0 +1,4 @@
service vendor.remoteaccess-default /vendor/bin/hw/android.hardware.automotive.remoteaccess@V1-tcu-test-service
class hal
user vehicle_network
group system inet

View file

@ -111,7 +111,9 @@ void RemoteAccessService::maybeStopTaskLoop() {
// Try to stop the reading stream.
if (mGetRemoteTasksContext) {
mGetRemoteTasksContext->TryCancel();
mGetRemoteTasksContext.reset();
// Don't reset mGetRemoteTaskContext here since the read stream might still be affective
// and might still be using it. This will cause reader->Read to return false and
// mGetRemoteTasksContext will be cleared after reader->Finish() is called.
}
mTaskWaitStopped = true;
mCv.notify_all();
@ -155,6 +157,7 @@ void RemoteAccessService::runTaskLoop() {
}
}
Status status = reader->Finish();
mGetRemoteTasksContext.reset();
ALOGE("GetRemoteTasks stream breaks, code: %d, message: %s, sleeping for 10s and retry",
status.error_code(), status.error_message().c_str());

View file

@ -75,11 +75,18 @@ following behavior:
* Under android root: `source build/envsetup.sh`
* Add
```
PRODUCT_SOONG_NAMESPACES += hardware/interfaces/automotive/remoteaccess/test_grpc_server/lib`
```
to `device/generic/car/common/car.mk`.
* `lunch sdk_car_x86_64-userdebug`
* `make -j TestWakeupClientServer`
* `make -j ApPowerControlLib`
* `make -j ApPOwerControlLib`
## How to push the test wakeup client to a TCU which runs Android.
@ -99,7 +106,7 @@ following behavior:
* `adb push vendor/bin/TestWakeupClientServer /vendor/bin`
* `adb push vendor/lib/ApPowerControlLib.so /vendor/lib`
* `adb push vendor/lib64/ApPowerControlLib.so /vendor/lib64`
* `adb shell`
@ -116,6 +123,13 @@ interface.
* Under android root, `source build/envsetup.sh`
* Add
```
PRODUCT_SOONG_NAMESPACES += hardware/interfaces/automotive/remoteaccess/test_grpc_server/lib`
```
to `device/generic/car/common/car.mk`.
* `lunch sdk_car_x86_64-userdebug`
* `m -j`
@ -150,8 +164,12 @@ interface.
* `make -j TestWakeupClientServer`
* `make -j ApPOwerControlLib`
* `adb push $ANDROID_PRODUCT_OUT/vendor/bin/TestWakeupClientServer /vendor/bin`
* `adb push $ANDROID_PRODUCT_OUT/vendor/lib64/ApPowerControlLib.so /vendor/lib64`
* `adb shell`
* `emulator_car_x86_64:/ # su`