Commit Graph

20 Commits

Author SHA1 Message Date
Yu Shan
72d6f8944d Implement ScheduleTask API using grpc.
Implement the ScheduleTask APIs in reference remote access
HAL by using grpc to communicate with an external grpc server.

Test: atest RemoteAccessServiceUnitTest
Bug: 297271235
Change-Id: I2d363aa244c842cea5be0c35f4f3a7961eb3cc0b
2023-10-18 13:44:53 -07:00
Yu Shan
ca2f39be70 Remove remoteaccess V1 impl.
We have migrated all the ref to V2.

Test: Presubmit
Bug: 295393732
Change-Id: I358d6380664dac13412b2706652de9726441adae
2023-09-22 19:26:27 -07:00
Yu Shan
06ddbc6d52 Define IRemoteAccess V2 reference impl.
Rename remote access HAL to V2 and implement V2 interface.

Test: Presubmit
Bug: 297271235
Change-Id: I4b21fce3c18f7697f62229107b210b7675749b68
2023-09-20 18:30:34 -07:00
Yu Shan
3a129d7a3b Implement a host side TestWakeupClientService.
Implement a host program that could be used to test the remote
access feature. The program will provides grpc service that the
remote access HAL running on device can talk to to get tasks. The
program will also use adb/aemu command to control the power of the
Android instance.

This CL also changes the GRPC service address for the default
remoteaccess HAL to 10.0.2.2 which points to the host's 127.0.0.1
from the emulator.

Test: m -j TestWakeupClientServerHost, run manually.
TestWakeupClientServerHost
>>> inject task [clientID] taskdata
verify emualtor boot up
verify emulator shutdown after task finish
>>> power on
verify emualtor boot up
>>> inject task [clientID] taskdata
verify emulator does not shutdown after task finish
>>> power off
>>> inject task [clientID] taskdata
verify emulator boot up
>>> set vehicleInUse
verify emulator does not shutdown after task finish
>>> power off
>>> genFakeTask start [clientID]
verify emulator starts up to execute remote tasks.
verify emulator shuts down after 300s.
verify emulator restarts after shutdown.
>>> genFakeTask stop
verify emulator shuts down after finishing last task.
Bug: 285205122

Change-Id: I22b660448d8b495cf3ced3378c1c1dc10051d87a
2023-08-28 17:45:08 -07:00
Yu Shan
58ff09197b Update the remote access test folder.
Update the test folder directory. The previous temp directory
is not allowed to be accessed by selinux rule.

Test: Manual follow remote access test plan on seahawk.
Bug: 272773565
Change-Id: I2b8b05f56560d3d28d0d61e816d345f8d03f59a5
2023-05-12 18:00:59 -07:00
Yu Shan
194757d25f Add inject-task-next-reboot debug command.
Support a debug command that will inject a fake remote task for
testing on next reboot with specified latency. This is used to
simulate the situation when a remote task arrives while the device
is not booted up and the task will be delivered once the device
boots up.

Test: Manually test on seahawk.
Bug: 275880463
Change-Id: I6eb064893bea0700da80dfa2dcf3079ddb0b59a1
2023-05-08 15:42:56 -07:00
Krzysztof Kosiński
e908adfde3 Refactor BindToDeviceSocketMutator.
Only expose a factory function in the header. This limits the
internal gRPC dependency to the .cpp file and simplifies the
implementation.

Bug: 280043032
Test: local build
Change-Id: Ic7ea8dac9935231ceb05bec22c2a5902c50ea8db
2023-04-29 12:54:07 +00:00
Yu Shan
9549368dd4 Add inject task cmd to default remoteaccess hal.
This allows local remote access HAL test. This CL also adds debug
status dump to remote access HAL.

Test: Manual run on gcar_emu
Bug: 272773565
Change-Id: Ic02b451d800cfe75d8c410a4dc52e8ce15e481b7
2023-03-22 11:38:50 -07:00
Yu Shan
5ba8f5230c Grant net_raw capabilities to remote access hal.
Remote access test VHAL requires net_raw to select specific eth
interface to communicate with TCU.

Test: Manual test.
Bug: 261108682
Change-Id: Ieb84a84ffeee2b8f907de8b58501024a3d704945
2023-03-21 20:49:53 -07:00
Eric Jeong
6c3a1d8beb Add getProcessorId to support multiple processors in remote access
Bug: 262483074
Test: atest RemoteAccessServiceUnitTest
Change-Id: I88dedb7ef914bd72772a4bbae2b283836bd1d19a
2023-03-16 00:49:16 -07:00
Yu Shan
2a096c4983 Change BindToDeviceSocketMutator to lib.
Test: Presubmit
Bug: 268750179
Change-Id: I7d338eef4f622631d0ead0af0a91e3b68bfa69eb
2023-03-06 12:56:04 -08:00
Yu Shan
39b19857d4 Specify a eth interface for grpc connection.
When enabling wifi on seahawk, the main network interface changes
so we need to explicitly specify the eth interface we want to
use for our grpc connection.

Note that using setsockopt requires NET_RAW permission which is
only granted to limited apps. As a result, selinux permissive
mode is required for this CL to work.

Test: Manual test on seahawk, verify grpc is connected okay.
Bug: 261108682
Change-Id: I95c9f796bf40226b612edf284188ffc6d095086f
2023-03-06 12:56:02 -08:00
Treehugger Robot
e52f382909 Merge changes I3b0c6325,I40f97f4b am: a55e702324 am: 76c6b3a669 am: 673426770e
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2323902

Change-Id: I3e39e3e19e338b9cdb6d09a7fbbdbd86147b55f8
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-08 03:23:04 +00:00
Yu Shan
df39d6e450 Fix a race condition in remote access HAL.
We should not delete ClientContext after we TryCancel it since the
reader in the main task loop might still access it, e.g., while
calling reader->Finish. We must wait under reader->Finish is
returned, then to delete the ClientContext.

This CL also updates README.md to incorporate soong namespace change.

Test: manually test on sdk_car_x86_64-userdebug
Run TestWakeupClientServer
Run --set-ap-state 1 0 and then --set-ap-state 0 0 multiple times.
Bug: 261234399

Change-Id: I3b0c632546c218c4ced43af95a585cd41e0da036
2022-12-07 15:20:06 -08:00
Yu Shan
1532afd33c Define a new remoteaccess HAL for test.
Bug: 261108682
Test: Locally build and run

Change-Id: I40f97f4b10714096a32c5b14c8716b6c8e413419
2022-12-07 15:17:48 -08:00
Yu Shan
7a5283fda1 Add remote access HAL interface and ref impl.
Add remote access HAL interface and reference implementation. This
CL is a merge of multiple CLs commited in internal master.

Test: Presubmit
Bug: 241170646
Change-Id: I55ba98015055d779a362cac05a9f68650b5b92ab
Merged-In: I332221b303274463dfa5b46d78cf0d81f6045e4b
2022-10-26 17:16:05 -07:00
Yu Shan
4b2850f2c6 Add fuzzer for remote access HAL.
Test: m -j android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer
cd [output_dir]
adb push ./data/fuzz/x86_64 /data/fuzz/x86_64
adb shell
/data/fuzz/x86_64/android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer/android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer
Bug: 241483300

Change-Id: I150e4aaf33b3732586341f8c55076d4eda687876
2022-10-06 14:28:20 -07:00
Yu Shan
bc2ed2a3c7 Talk with VHAL to get device ID.
Test: In adb root shell:
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default
Bug: 241483300

Change-Id: I884cb75a493550afe4b1b412e6cc95ebe61b8cd3
2022-09-29 18:33:08 -07:00
Yu Shan
dc54b8c24e Add debug command to remote access HAL.
Add debug command to test remote access HAL.

Bug: 241483300
Test: Follow:
change file sytem to read-write.
m -j TestWakeupClientServer
adb push
out/target/product/emulator_car64_x86_64/vendor/bin/TestWakeupClientServer
/vendor/bin

In one adb shell:
/vendor/bin/TestWakeupClientServer

In another shell:
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --start-debug-callback
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task
[should show no tasks]
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --ready-for-remote-task 1
[wait for 5s]
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task
[should see all the tasks from client ID 1]
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --ready-for-remote-task 0
[wait for 5s]
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task
[should see no new tasks]
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default
--ready-for-remote-task 1
dumpsys android.hardware.automotive.remoteaccess.IRemoteAccess/default --show-task
[should see new tasks]

Change-Id: I551bf9ab5b55c4de9d8382d69bd5078ec62cad51
2022-09-29 18:33:08 -07:00
Yu Shan
a725df46fc Add a test wakeupclient service implementation.
The test implementation will send out a remote task to remote access
HAL every 5s.

Test: Manually test on gcar_emu.
adb root
adb remount
adb reboot
adb root
adb remount
m -j TestWakeupClientServer
cd out/target/product/emulator_car64_x86_64
adb push ./vendor/bin/TestWakeupClientServer /vendor/bin
adb shell

In the shell:
su
/vendor/bin/TestWakeupClientServer

Check adb logcat, verify tasks are received.
Bug: 246841306

Change-Id: Idaf198662f7004e3a9e77d75caeffc00cda49218
2022-09-29 18:33:08 -07:00