mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 11:36:00 +00:00
Rename to getAllPendingScheduledTasks.
Rename getAllScheduledTasks to getAllPendingScheduledTasks. Test: Presubmit Bug: 305285376 Change-Id: I0a908d3c4cc77ff718883e17468a2ff75df470d3
This commit is contained in:
@@ -46,5 +46,5 @@ interface IRemoteAccess {
|
||||
void unscheduleTask(String clientId, String scheduleId);
|
||||
void unscheduleAllTasks(String clientId);
|
||||
boolean isTaskScheduled(String clientId, String scheduleId);
|
||||
List<android.hardware.automotive.remoteaccess.ScheduleInfo> getAllScheduledTasks(String clientId);
|
||||
List<android.hardware.automotive.remoteaccess.ScheduleInfo> getAllPendingScheduledTasks(String clientId);
|
||||
}
|
||||
|
||||
@@ -201,5 +201,5 @@ interface IRemoteAccess {
|
||||
*
|
||||
* <p>The finished scheduled tasks will not be included.
|
||||
*/
|
||||
List<ScheduleInfo> getAllScheduledTasks(String clientId);
|
||||
List<ScheduleInfo> getAllPendingScheduledTasks(String clientId);
|
||||
}
|
||||
|
||||
@@ -75,8 +75,9 @@ class MockGrpcClientStub : public WakeupClient::StubInterface {
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
Status GetAllScheduledTasks(ClientContext* context, const GetAllScheduledTasksRequest& request,
|
||||
GetAllScheduledTasksResponse* response) {
|
||||
Status GetAllPendingScheduledTasks(ClientContext* context,
|
||||
const GetAllPendingScheduledTasksRequest& request,
|
||||
GetAllPendingScheduledTasksResponse* response) {
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
@@ -165,17 +166,19 @@ class MockGrpcClientStub : public WakeupClient::StubInterface {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClientAsyncResponseReaderInterface<GetAllScheduledTasksResponse>* AsyncGetAllScheduledTasksRaw(
|
||||
ClientAsyncResponseReaderInterface<GetAllPendingScheduledTasksResponse>*
|
||||
AsyncGetAllPendingScheduledTasksRaw(
|
||||
[[maybe_unused]] ClientContext* context,
|
||||
[[maybe_unused]] const GetAllScheduledTasksRequest& request,
|
||||
[[maybe_unused]] const GetAllPendingScheduledTasksRequest& request,
|
||||
[[maybe_unused]] CompletionQueue* cq) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ClientAsyncResponseReaderInterface<GetAllScheduledTasksResponse>*
|
||||
PrepareAsyncGetAllScheduledTasksRaw([[maybe_unused]] ClientContext* context,
|
||||
[[maybe_unused]] const GetAllScheduledTasksRequest& request,
|
||||
[[maybe_unused]] CompletionQueue* c) {
|
||||
ClientAsyncResponseReaderInterface<GetAllPendingScheduledTasksResponse>*
|
||||
PrepareAsyncGetAllPendingScheduledTasksRaw(
|
||||
[[maybe_unused]] ClientContext* context,
|
||||
[[maybe_unused]] const GetAllPendingScheduledTasksRequest& request,
|
||||
[[maybe_unused]] CompletionQueue* c) {
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -96,7 +96,7 @@ class RemoteAccessService
|
||||
ndk::ScopedAStatus isTaskScheduled(const std::string& clientId, const std::string& scheduleId,
|
||||
bool* out) override;
|
||||
|
||||
ndk::ScopedAStatus getAllScheduledTasks(
|
||||
ndk::ScopedAStatus getAllPendingScheduledTasks(
|
||||
const std::string& clientId,
|
||||
std::vector<aidl::android::hardware::automotive::remoteaccess::ScheduleInfo>* out)
|
||||
override;
|
||||
|
||||
@@ -99,7 +99,8 @@ service WakeupClient {
|
||||
*
|
||||
* <p>The finished scheduled tasks will not be included.
|
||||
*/
|
||||
rpc GetAllScheduledTasks(GetAllScheduledTasksRequest) returns (GetAllScheduledTasksResponse) {}
|
||||
rpc GetAllPendingScheduledTasks(GetAllPendingScheduledTasksRequest)
|
||||
returns (GetAllPendingScheduledTasksResponse) {}
|
||||
}
|
||||
|
||||
message GetRemoteTasksRequest {}
|
||||
@@ -154,10 +155,10 @@ message IsTaskScheduledResponse {
|
||||
bool isTaskScheduled = 1;
|
||||
}
|
||||
|
||||
message GetAllScheduledTasksRequest {
|
||||
message GetAllPendingScheduledTasksRequest {
|
||||
string clientId = 1;
|
||||
}
|
||||
|
||||
message GetAllScheduledTasksResponse {
|
||||
message GetAllPendingScheduledTasksResponse {
|
||||
repeated GrpcScheduleInfo allScheduledTasks = 1;
|
||||
}
|
||||
|
||||
@@ -399,13 +399,13 @@ ScopedAStatus RemoteAccessService::isTaskScheduled(const std::string& clientId,
|
||||
return ScopedAStatus::ok();
|
||||
}
|
||||
|
||||
ScopedAStatus RemoteAccessService::getAllScheduledTasks(const std::string& clientId,
|
||||
std::vector<ScheduleInfo>* out) {
|
||||
ScopedAStatus RemoteAccessService::getAllPendingScheduledTasks(const std::string& clientId,
|
||||
std::vector<ScheduleInfo>* out) {
|
||||
ClientContext context;
|
||||
GetAllScheduledTasksRequest request = {};
|
||||
GetAllScheduledTasksResponse response = {};
|
||||
GetAllPendingScheduledTasksRequest request = {};
|
||||
GetAllPendingScheduledTasksResponse response = {};
|
||||
request.set_clientid(clientId);
|
||||
Status status = mGrpcStub->GetAllScheduledTasks(&context, request, &response);
|
||||
Status status = mGrpcStub->GetAllPendingScheduledTasks(&context, request, &response);
|
||||
if (!status.ok()) {
|
||||
return rpcStatusToScopedAStatus(status, "Failed to call isTaskScheduled");
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ class MockGrpcClientStub : public WakeupClient::StubInterface {
|
||||
MOCK_METHOD(Status, IsTaskScheduled,
|
||||
(ClientContext * context, const IsTaskScheduledRequest& request,
|
||||
IsTaskScheduledResponse* response));
|
||||
MOCK_METHOD(Status, GetAllScheduledTasks,
|
||||
(ClientContext * context, const GetAllScheduledTasksRequest& request,
|
||||
GetAllScheduledTasksResponse* response));
|
||||
MOCK_METHOD(Status, GetAllPendingScheduledTasks,
|
||||
(ClientContext * context, const GetAllPendingScheduledTasksRequest& request,
|
||||
GetAllPendingScheduledTasksResponse* response));
|
||||
// Async methods which we do not care.
|
||||
MOCK_METHOD(ClientAsyncReaderInterface<GetRemoteTasksResponse>*, AsyncGetRemoteTasksRaw,
|
||||
(ClientContext * context, const GetRemoteTasksRequest& request, CompletionQueue* cq,
|
||||
@@ -141,13 +141,13 @@ class MockGrpcClientStub : public WakeupClient::StubInterface {
|
||||
PrepareAsyncIsTaskScheduledRaw,
|
||||
(ClientContext * context, const IsTaskScheduledRequest& request,
|
||||
CompletionQueue* cq));
|
||||
MOCK_METHOD(ClientAsyncResponseReaderInterface<GetAllScheduledTasksResponse>*,
|
||||
AsyncGetAllScheduledTasksRaw,
|
||||
(ClientContext * context, const GetAllScheduledTasksRequest& request,
|
||||
MOCK_METHOD(ClientAsyncResponseReaderInterface<GetAllPendingScheduledTasksResponse>*,
|
||||
AsyncGetAllPendingScheduledTasksRaw,
|
||||
(ClientContext * context, const GetAllPendingScheduledTasksRequest& request,
|
||||
CompletionQueue* cq));
|
||||
MOCK_METHOD(ClientAsyncResponseReaderInterface<GetAllScheduledTasksResponse>*,
|
||||
PrepareAsyncGetAllScheduledTasksRaw,
|
||||
(ClientContext * context, const GetAllScheduledTasksRequest& request,
|
||||
MOCK_METHOD(ClientAsyncResponseReaderInterface<GetAllPendingScheduledTasksResponse>*,
|
||||
PrepareAsyncGetAllPendingScheduledTasksRaw,
|
||||
(ClientContext * context, const GetAllPendingScheduledTasksRequest& request,
|
||||
CompletionQueue* cq));
|
||||
};
|
||||
|
||||
@@ -573,13 +573,13 @@ TEST_F(RemoteAccessServiceUnitTest, TestIsTaskScheduled) {
|
||||
EXPECT_EQ(grpcRequest.scheduleid(), kTestScheduleId);
|
||||
}
|
||||
|
||||
TEST_F(RemoteAccessServiceUnitTest, testGetAllScheduledTasks) {
|
||||
TEST_F(RemoteAccessServiceUnitTest, testGetAllPendingScheduledTasks) {
|
||||
std::vector<ScheduleInfo> result;
|
||||
GetAllScheduledTasksRequest grpcRequest = {};
|
||||
EXPECT_CALL(*getGrpcWakeupClientStub(), GetAllScheduledTasks)
|
||||
GetAllPendingScheduledTasksRequest grpcRequest = {};
|
||||
EXPECT_CALL(*getGrpcWakeupClientStub(), GetAllPendingScheduledTasks)
|
||||
.WillOnce([&grpcRequest]([[maybe_unused]] ClientContext* context,
|
||||
const GetAllScheduledTasksRequest& request,
|
||||
GetAllScheduledTasksResponse* response) {
|
||||
const GetAllPendingScheduledTasksRequest& request,
|
||||
GetAllPendingScheduledTasksResponse* response) {
|
||||
grpcRequest = request;
|
||||
GrpcScheduleInfo* newInfo = response->add_allscheduledtasks();
|
||||
newInfo->set_clientid(kTestClientId);
|
||||
@@ -591,7 +591,7 @@ TEST_F(RemoteAccessServiceUnitTest, testGetAllScheduledTasks) {
|
||||
return Status();
|
||||
});
|
||||
|
||||
ScopedAStatus status = getService()->getAllScheduledTasks(kTestClientId, &result);
|
||||
ScopedAStatus status = getService()->getAllPendingScheduledTasks(kTestClientId, &result);
|
||||
|
||||
ASSERT_TRUE(status.isOk());
|
||||
EXPECT_EQ(grpcRequest.clientid(), kTestClientId);
|
||||
|
||||
@@ -138,9 +138,9 @@ class TestWakeupClientServiceImpl : public WakeupClient::Service {
|
||||
const IsTaskScheduledRequest* request,
|
||||
IsTaskScheduledResponse* response) override;
|
||||
|
||||
grpc::Status GetAllScheduledTasks(grpc::ServerContext* context,
|
||||
const GetAllScheduledTasksRequest* request,
|
||||
GetAllScheduledTasksResponse* response) override;
|
||||
grpc::Status GetAllPendingScheduledTasks(
|
||||
grpc::ServerContext* context, const GetAllPendingScheduledTasksRequest* request,
|
||||
GetAllPendingScheduledTasksResponse* response) override;
|
||||
|
||||
/**
|
||||
* Starts generating fake tasks for the specific client repeatedly.
|
||||
|
||||
@@ -469,11 +469,11 @@ Status TestWakeupClientServiceImpl::IsTaskScheduled(ServerContext* context,
|
||||
return Status::OK;
|
||||
}
|
||||
|
||||
Status TestWakeupClientServiceImpl::GetAllScheduledTasks(ServerContext* context,
|
||||
const GetAllScheduledTasksRequest* request,
|
||||
GetAllScheduledTasksResponse* response) {
|
||||
Status TestWakeupClientServiceImpl::GetAllPendingScheduledTasks(
|
||||
ServerContext* context, const GetAllPendingScheduledTasksRequest* request,
|
||||
GetAllPendingScheduledTasksResponse* response) {
|
||||
const std::string& clientId = request->clientid();
|
||||
printf("GetAllScheduledTasks called with client Id: %s\n", clientId.c_str());
|
||||
printf("GetAllPendingScheduledTasks called with client Id: %s\n", clientId.c_str());
|
||||
response->clear_allscheduledtasks();
|
||||
{
|
||||
std::unique_lock lk(mLock);
|
||||
|
||||
@@ -280,7 +280,7 @@ TEST_F(TestWakeupClientServiceImplUnitTest, TestUnscheduleAllTasks) {
|
||||
EXPECT_EQ(getRemoteTaskResponses().size(), 0);
|
||||
}
|
||||
|
||||
TEST_F(TestWakeupClientServiceImplUnitTest, TestGetAllScheduledTasks) {
|
||||
TEST_F(TestWakeupClientServiceImplUnitTest, TestGetAllPendingScheduledTasks) {
|
||||
std::string scheduleId1 = "scheduleId1";
|
||||
std::string scheduleId2 = "scheduleId2";
|
||||
int64_t time1 = getNow();
|
||||
@@ -296,19 +296,19 @@ TEST_F(TestWakeupClientServiceImplUnitTest, TestGetAllScheduledTasks) {
|
||||
ASSERT_TRUE(status.ok());
|
||||
|
||||
ClientContext context;
|
||||
GetAllScheduledTasksRequest request;
|
||||
GetAllScheduledTasksResponse response;
|
||||
GetAllPendingScheduledTasksRequest request;
|
||||
GetAllPendingScheduledTasksResponse response;
|
||||
request.set_clientid("invalid client Id");
|
||||
status = getStub()->GetAllScheduledTasks(&context, request, &response);
|
||||
status = getStub()->GetAllPendingScheduledTasks(&context, request, &response);
|
||||
|
||||
ASSERT_TRUE(status.ok());
|
||||
EXPECT_EQ(response.allscheduledtasks_size(), 0);
|
||||
|
||||
ClientContext context2;
|
||||
GetAllScheduledTasksRequest request2;
|
||||
GetAllScheduledTasksResponse response2;
|
||||
GetAllPendingScheduledTasksRequest request2;
|
||||
GetAllPendingScheduledTasksResponse response2;
|
||||
request2.set_clientid(kTestClientId);
|
||||
status = getStub()->GetAllScheduledTasks(&context2, request2, &response2);
|
||||
status = getStub()->GetAllPendingScheduledTasks(&context2, request2, &response2);
|
||||
|
||||
ASSERT_TRUE(status.ok());
|
||||
ASSERT_EQ(response2.allscheduledtasks_size(), 2);
|
||||
|
||||
Reference in New Issue
Block a user