Merge "Define IRemoteAccess V2 reference impl." into main

This commit is contained in:
Yu Shan
2023-09-21 20:29:21 +00:00
committed by Android (Google) Code Review
10 changed files with 101 additions and 6 deletions

View File

@@ -47,9 +47,20 @@ cc_defaults {
],
}
// TODO(b/295393732): remove this once we finish the migration from V1 to V2.
cc_binary {
name: "android.hardware.automotive.remoteaccess@V1-default-service",
defaults: ["remote-access-hal-defaults"],
vintf_fragments: ["remoteaccess-default-service-v1.xml"],
init_rc: ["remoteaccess-default-service-v1.rc"],
cflags: [
"-DGRPC_SERVICE_ADDRESS=\"10.0.2.2:50051\"",
],
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V2-default-service",
defaults: ["remote-access-hal-defaults"],
vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-default-service.rc"],
cflags: [
@@ -57,9 +68,21 @@ cc_binary {
],
}
// TODO(b/295393732): remove this once we finish the migration from V1 to V2.
cc_binary {
name: "android.hardware.automotive.remoteaccess@V1-tcu-test-service",
defaults: ["remote-access-hal-defaults"],
vintf_fragments: ["remoteaccess-default-service-v1.xml"],
init_rc: ["remoteaccess-tcu-test-service-v1.rc"],
cflags: [
"-DGRPC_SERVICE_ADDRESS=\"10.10.10.1:50051\"",
"-DGRPC_SERVICE_IFNAME=\"eth1\"",
],
}
cc_binary {
name: "android.hardware.automotive.remoteaccess@V2-tcu-test-service",
defaults: ["remote-access-hal-defaults"],
vintf_fragments: ["remoteaccess-default-service.xml"],
init_rc: ["remoteaccess-tcu-test-service.rc"],
cflags: [
@@ -77,7 +100,7 @@ cc_library {
"src/RemoteAccessService.cpp",
],
whole_static_libs: [
"android.hardware.automotive.remoteaccess-V1-ndk",
"android.hardware.automotive.remoteaccess-V2-ndk",
"wakeup_client_protos",
"libvhalclient",
],
@@ -99,7 +122,7 @@ cc_library {
}
cc_fuzz {
name: "android.hardware.automotive.remoteaccess@V1-default-service.aidl_fuzzer",
name: "android.hardware.automotive.remoteaccess@V2-default-service.aidl_fuzzer",
srcs: ["fuzzer/fuzzer.cpp"],
whole_static_libs: [
"RemoteAccessService",

View File

@@ -21,6 +21,7 @@
#include <aidl/android/hardware/automotive/remoteaccess/BnRemoteAccess.h>
#include <aidl/android/hardware/automotive/remoteaccess/BnRemoteTaskCallback.h>
#include <aidl/android/hardware/automotive/remoteaccess/IRemoteTaskCallback.h>
#include <aidl/android/hardware/automotive/remoteaccess/ScheduleInfo.h>
#include <android-base/thread_annotations.h>
#include <android/binder_auto_utils.h>
#include <utils/SystemClock.h>
@@ -78,6 +79,25 @@ class RemoteAccessService
ndk::ScopedAStatus notifyApStateChange(
const aidl::android::hardware::automotive::remoteaccess::ApState& newState) override;
ndk::ScopedAStatus isTaskScheduleSupported(bool* out) override;
ndk::ScopedAStatus scheduleTask(
const aidl::android::hardware::automotive::remoteaccess::ScheduleInfo& scheduleInfo)
override;
ndk::ScopedAStatus unscheduleTask(const std::string& clientId,
const std::string& scheduleId) override;
ndk::ScopedAStatus unscheduleAllTasks(const std::string& clientId) override;
ndk::ScopedAStatus isTaskScheduled(const std::string& clientId, const std::string& scheduleId,
bool* out) override;
ndk::ScopedAStatus getAllScheduledTasks(
const std::string& clientId,
std::vector<aidl::android::hardware::automotive::remoteaccess::ScheduleInfo>* out)
override;
binder_status_t dump(int fd, const char** args, uint32_t numArgs) override;
private:

View File

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

View File

@@ -0,0 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.automotive.remoteaccess</name>
<version>1</version>
<fqname>IRemoteAccess/default</fqname>
</hal>
</manifest>

View File

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

View File

@@ -1,7 +1,7 @@
<manifest version="1.0" type="device">
<hal format="aidl">
<name>android.hardware.automotive.remoteaccess</name>
<version>1</version>
<version>2</version>
<fqname>IRemoteAccess/default</fqname>
</hal>
</manifest>

View File

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

View File

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

View File

@@ -39,6 +39,7 @@ namespace {
using ::aidl::android::hardware::automotive::remoteaccess::ApState;
using ::aidl::android::hardware::automotive::remoteaccess::IRemoteTaskCallback;
using ::aidl::android::hardware::automotive::remoteaccess::ScheduleInfo;
using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
using ::android::base::Error;
using ::android::base::ParseInt;
@@ -313,6 +314,41 @@ ScopedAStatus RemoteAccessService::notifyApStateChange(const ApState& newState)
return ScopedAStatus::ok();
}
ScopedAStatus RemoteAccessService::isTaskScheduleSupported([[maybe_unused]] bool* out) {
// TODO(b/297271235): implement this.
return ScopedAStatus::ok();
}
ScopedAStatus RemoteAccessService::scheduleTask([[maybe_unused]] const ScheduleInfo& scheduleInfo) {
// TODO(b/297271235): implement this.
return ScopedAStatus::ok();
}
ScopedAStatus RemoteAccessService::unscheduleTask([[maybe_unused]] const std::string& clientId,
[[maybe_unused]] const std::string& scheduleId) {
// TODO(b/297271235): implement this.
return ScopedAStatus::ok();
}
ScopedAStatus RemoteAccessService::unscheduleAllTasks(
[[maybe_unused]] const std::string& clientId) {
// TODO(b/297271235): implement this.
return ScopedAStatus::ok();
}
ScopedAStatus RemoteAccessService::isTaskScheduled([[maybe_unused]] const std::string& clientId,
[[maybe_unused]] const std::string& scheduleId,
[[maybe_unused]] bool* out) {
// TODO(b/297271235): implement this.
return ScopedAStatus::ok();
}
ScopedAStatus RemoteAccessService::getAllScheduledTasks(const std::string& clientId,
std::vector<ScheduleInfo>* out) {
// TODO(b/297271235): implement this.
return ScopedAStatus::ok();
}
bool RemoteAccessService::checkDumpPermission() {
uid_t uid = AIBinder_getCallingUid();
return uid == AID_ROOT || uid == AID_SHELL || uid == AID_SYSTEM;

View File

@@ -141,7 +141,7 @@ interface.
* The android lunch target: sdk_car_x86_64-userdebug and
cf_x86_64_auto-userdebug already contains the default remote access HAL. For
other lunch target, you can add the default remote access HAL by adding
'android.hardware.automotive.remoteaccess@V1-default-service' to
'android.hardware.automotive.remoteaccess@V2-default-service' to
'PRODUCT_PACKAGES' variable in mk file, see `device/generic/car/common/car.mk`
as example.