2 * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "bootstrap.h"
19 #include "LaunchAppCommand.h"
20 #include "LaunchAppRunnable.h"
25 #define WAIT_APP_LAUNCH 10000
27 LaunchAppCommand::LaunchAppCommand(const ::aurum::ReqLaunchApp *request,
28 ::aurum::RspLaunchApp *response)
29 : mRequest{request}, mResponse{response}
33 ::grpc::Status LaunchAppCommand::execute()
36 LOGI("LaunchApp --------------- ");
37 std::unique_ptr<LaunchAppRunnable> cmd = std::make_unique<LaunchAppRunnable>(mRequest->packagename(), mRequest->data());
38 std::shared_ptr<UiDevice> obj = UiDevice::getInstance();
39 ret = obj->executeAndWaitForEvents(cmd.get(), A11yEvent::EVENT_WINDOW_ACTIVATE, WAIT_APP_LAUNCH, mRequest->packagename(), 0);
41 if (ret) mResponse->set_status(::aurum::RspStatus::OK);
42 else mResponse->set_status(::aurum::RspStatus::ERROR);
44 return grpc::Status::OK;