Add TaskType to ScheduleInfo.

Add a task type field to schedule serverless remote task. We want
to introduce an ENTER_GARAGE_MODE type where the external system
can set the AP_POWER_BOOT_UP_REASON and makes android enter
garage mode.

Test: atest RemoteAccessServiceUnitTest
Bug: 316233421
Change-Id: Iddbd2a14aa6f4672a2e27f0a05ec2b73b7d1aab2
diff --git a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h
index 1fc4037..23b4ebe 100644
--- a/automotive/remoteaccess/hal/default/include/RemoteAccessService.h
+++ b/automotive/remoteaccess/hal/default/include/RemoteAccessService.h
@@ -81,6 +81,9 @@
 
     ndk::ScopedAStatus isTaskScheduleSupported(bool* out) override;
 
+    ndk::ScopedAStatus getSupportedTaskTypesForScheduling(
+            std::vector<aidl::android::hardware::automotive::remoteaccess::TaskType>* out) override;
+
     ndk::ScopedAStatus scheduleTask(
             const aidl::android::hardware::automotive::remoteaccess::ScheduleInfo& scheduleInfo)
             override;
diff --git a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp
index 0944d86..5521134 100644
--- a/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp
+++ b/automotive/remoteaccess/hal/default/src/RemoteAccessService.cpp
@@ -40,6 +40,7 @@
 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::remoteaccess::TaskType;
 using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
 using ::android::base::Error;
 using ::android::base::ParseInt;
@@ -319,6 +320,13 @@
     return ScopedAStatus::ok();
 }
 
+ndk::ScopedAStatus RemoteAccessService::getSupportedTaskTypesForScheduling(
+        std::vector<TaskType>* out) {
+    // TODO(b/316233421): support ENTER_GARAGE_MODE type.
+    out->push_back(TaskType::CUSTOM);
+    return ScopedAStatus::ok();
+}
+
 ScopedAStatus RemoteAccessService::scheduleTask(const ScheduleInfo& scheduleInfo) {
     ClientContext context;
     ScheduleTaskRequest request = {};
diff --git a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp
index c0038c2..4af0003 100644
--- a/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp
+++ b/automotive/remoteaccess/hal/default/test/RemoteAccessServiceUnitTest.cpp
@@ -48,6 +48,7 @@
 using ::aidl::android::hardware::automotive::remoteaccess::ApState;
 using ::aidl::android::hardware::automotive::remoteaccess::BnRemoteTaskCallback;
 using ::aidl::android::hardware::automotive::remoteaccess::ScheduleInfo;
+using ::aidl::android::hardware::automotive::remoteaccess::TaskType;
 using ::aidl::android::hardware::automotive::vehicle::VehiclePropValue;
 
 using ::grpc::ClientAsyncReaderInterface;
@@ -61,6 +62,7 @@
 using ::ndk::ScopedAStatus;
 using ::testing::_;
 using ::testing::DoAll;
+using ::testing::ElementsAre;
 using ::testing::Return;
 using ::testing::SetArgPointee;
 
@@ -434,6 +436,14 @@
     EXPECT_TRUE(out);
 }
 
+TEST_F(RemoteAccessServiceUnitTest, TestGetSupportedTaskTypesForScheduling) {
+    std::vector<TaskType> out;
+    ScopedAStatus status = getService()->getSupportedTaskTypesForScheduling(&out);
+
+    EXPECT_TRUE(status.isOk());
+    EXPECT_THAT(out, ElementsAre(TaskType::CUSTOM));
+}
+
 TEST_F(RemoteAccessServiceUnitTest, TestScheduleTask) {
     ScheduleTaskRequest grpcRequest = {};
     EXPECT_CALL(*getGrpcWakeupClientStub(), ScheduleTask)