Commit graph

48 commits

Author SHA1 Message Date
Yu Shan
bfc29b2442 Implement scheduleTask in TestWakeupClientService.
Handles the schedule task request from GRPC. Starts a thread
for the scheduled tasks and injects the task data through the grpc
channel.

Test: m -j TestWakeupClientServerHost && atest TestWakeupClientServerHostUnitTest
Bug: 297271235
Change-Id: Ia9f1d7fa3dadb3be68e31987622bc6df9271e929
2023-10-18 13:44:55 -07:00
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
c07cdae9bb Add task schedule API to remote access HAL.
These APIs allows a client to schedule a task to be executed later.
If the vehicle is off when the task is to be exectued, the vehicle
will be woken up, execute the task and shutdown. If the vehicle is
already up, the task will be exectued.

Test: None
Bug: 282792374
Change-Id: I97c4fdbe2cba035e8bd9ddede4c94d0331c39eef
2023-09-14 18:10:10 -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
6078da87ca Use internal gRPC headers in BindToDeviceSocketMutatorLib.
Bug: 280043032
Test: presubmit
Change-Id: I53c413ab3dbbfb056f3b7f22c1db336aa68ba611
Merged-In: I53c413ab3dbbfb056f3b7f22c1db336aa68ba611
2023-05-03 22:26:13 +00: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
Alex Buynytskyy
ec1198d941 UpsideDownCake is now 34
Ignore-AOSP-First: UpsideDownCake Finalization
Bug: 275409981
Test: build
Change-Id: I832ab7a8b5445ba85e27bbcf5be64906bfa0e5be
2023-04-07 23:41:20 +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
ea4f5c0235 Merge "Add getProcessorId to support multiple processors in remote access" into udc-dev 2023-03-22 00:53:07 +00:00
Yu Shan
3750a76244 Add comment for remote task data.
Test: None
Bug: 274153816
Change-Id: Ib293d192c4ffe0e7374379359b2cf8463af25615
2023-03-17 13:44:48 -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
63cb195daa Allow specifying the service address. am: 8605e7bd3a am: 132b0843f7 am: a3096b8487
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2324638

Change-Id: Id07dab6035c50ec75c1818b975b599d3810254e4
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-12-03 02:33:24 +00:00
Yu Shan
8605e7bd3a Allow specifying the service address.
This will be useful for testing in different environment, e.g.
emulator v.s. phone where multiple ethernet interface might be
available and we need to explicitly pick an interface to start
the server.

Test: Manual test
Bug: None
Change-Id: I3c046e9549225058178346f529773cffa841ce07
2022-12-02 15:44:59 -08:00
Treehugger Robot
bd3231279a Merge "Change default wakeup required to true." am: 116f179012 am: 4ade1330fe am: fd967e7cd8
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2322456

Change-Id: Ia159505e04d0a269d48cccc20c86e6995d4f4650
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-30 21:32:58 +00:00
Yu Shan
7123885bd9 Change default wakeup required to true.
By default, TCU should always try to wake up AP until it receives
wakeup not required from AP.

Test: None
Bug: 254547153
Change-Id: If4d1111aae1d13f121230360317615ea4ba0302f
2022-11-29 17:44:19 -08:00
Treehugger Robot
e0bb88179a Merge "Define ApPowerControl library." am: c84a388681 am: 961df05a14 am: fb7e5d604c
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2299437

Change-Id: I3696cc857ad348d05c7629ff09687afc8449ad85
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-11-22 01:55:57 +00:00
Yu Shan
fb0cc2241a Define ApPowerControl library.
Define a library for the communication channel between TCU and
application processor. This library will be implemented with
device-specific logic.

Test: local compile
Bug: 254547153
Change-Id: I241ba141f9a5a4a3852017e291fbbc08cadf2bfe
2022-11-21 13:47:01 -08:00
Yu Shan
3b728f5db0 Update README for TestWakeupClientServer. am: 1b66644304 am: 2904d54014 am: e0ada0cfcc
Original change: https://android-review.googlesource.com/c/platform/hardware/interfaces/+/2271981

Change-Id: I417fe5d45b93462fbfeb9ca30328d4b043b77b4d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
2022-10-28 03:46:25 +00:00
Yu Shan
1b66644304 Update README for TestWakeupClientServer.
Change-Id: I6893bcacc32bbfe33646d19599301be6d8aa6b61
Test: Locally follow instruction.
Bug: 255623880
2022-10-27 14:22:20 -07: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
14f437614c Add wakeupApplicationProcessor function.
Add the logic to call wakeupAP when required.
Also update target in README.

Test: None, trivial logic.
Bug: 254547153
Change-Id: I0ad59f9f004d0cb5c01d664090fab984ac5420db
2022-10-26 15:42:42 -07:00
Yu Shan
096b1de781 Add README for test using two emulators.
Test: Locally follow the instructions.
Bug: 253627094
Change-Id: I8080fc98a077b3e8951b809ff7ffbae1dc84ba92
2022-10-24 18:32:13 -07:00
Yu Shan
8f590b9db7 Create a README and change log to print.
Add a README for documentation. Change log to printf so that
it has less android dependency and easier for showing the
message.

Test: Local run following the document.
Bug: 253627094
Change-Id: Ic7377ce763fdbd8599736a745942c1a0e27bc063
2022-10-24 18:32:12 -07:00
Yu Shan
9ed5788850 Reland "Add timeout logic to TestWakeupClientServiceImpl."
Fixes a type issue where uptimeMillis returns in64_t not long
type.
This reverts commit cd8b38611a.

Test: m -j TestWakeupClientServer
forest run on aosp_x86-eng target which failed previously
Change-Id: Ifc51cbe80787b0ecce2ffe42a2888962a8d9f941
2022-10-20 23:06:01 +00:00
Yu Shan
cd8b38611a Revert "Add timeout logic to TestWakeupClientServiceImpl."
This reverts commit a90f9c4a43.

Reason for revert: b/254573754

Change-Id: Ia81ed99423f7c8aee21464c842ecabd1f23b9fd1
2022-10-20 06:06:39 +00:00
Yu Shan
a90f9c4a43 Add timeout logic to TestWakeupClientServiceImpl.
Add timeout logic for fake tasks. They will timeout after 20s and
print an error message if not received by the remote access HAL.

Test: Manually run TestWakeupClientServiceImpl and verify the log:
Task for client ID: [ID] timed-out
is printed.
Bug: 246841306

Change-Id: I2173c931da9e0ea40c7b16f9e25a75592fa255c0
2022-10-14 17:53:01 -07:00
TreeHugger Robot
83530e5688 Merge "Add fuzzer for remote access HAL." 2022-10-07 09:13:35 +00: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
Bob Badour
5b71976b68 [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces
Added SPDX-license-identifier-Apache-2.0 to:
  automotive/remoteaccess/test_grpc_server/impl/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Ic50074db72b2c599360c77d8a93f6d6425938f83
2022-10-06 13:32:32 -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
Bob Badour
9fab4916b1 [LSC] Add LOCAL_LICENSE_KINDS to hardware/interfaces
Added SPDX-license-identifier-Apache-2.0 to:
  automotive/remoteaccess/impl/default/proto/Android.bp
  broadcastradio/aidl/Android.bp

Bug: 68860345
Bug: 151177513
Bug: 151953481

Test: m all
Change-Id: Idb39e78e5e4181fef165afd5451ac79597c89bfb
2022-09-29 11:59:23 -07:00
Yu Shan
b138c42a0d Implement receiving remote task.
Test: atest RemoteAccessServiceUnitTest
Bug: 241483300
Change-Id: I3d7f54f154beebba1bb1bdb7640dfe973ad012e4
2022-09-26 18:37:51 -07:00
Yu Shan
e29745606a Implement the GrpcWakeupClient.
Implement a remoteaccess HAL implementation that talks with
the wake up client using grpc.

Test: local build.
Bug: 241483300
Change-Id: I02a51f41427fa2854930d2076ca3a49791488fd9
2022-09-26 18:37:51 -07:00
Yu Shan
562c0f8035 Define remoteaccess grpc HAL.
Define a remote access HAL that talks with a wakeup client on
TCU through grpc.

Test: make android.hardware.automotive.remoteaccess
Bug: 241483300
Change-Id: I3bc6c8b837c157744f1d2b5f2e9c287e44a33883
2022-09-26 18:37:51 -07:00
Yu Shan
cb6afed51f Define grpc proto for remoteaccess.
This proto defines the GRPC interface supported by vendor wakeup
client. remoteaccess HAL will use this interface to communicate
with vendor wakeup client on TCU.

Test: Presubmit
Bug: 241482331
Change-Id: Idc68ad6cdcecac0103245cf8a415bdf6205105cc
2022-09-26 18:37:51 -07:00
Yu Shan
5b1a1c787f Define IRemoteAccess.aidl.
Define the HAL interface for a wakeup client. This interface will
be used by remote task client to receive remote tasks.

Test: m android.hardware.automotive.remoteaccess-update-api
Bug: 241170646
Change-Id: I332221b303274463dfa5b46d78cf0d81f6045e4b
2022-09-26 18:37:50 -07:00