1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "startup_config.h"
17 
18 namespace OHOS {
19 namespace AbilityRuntime {
20 StartupConfig::StartupConfig() = default;
21 
22 StartupConfig::~StartupConfig() = default;
23 
StartupConfig(int32_t awaitTimeoutMs)24 StartupConfig::StartupConfig(int32_t awaitTimeoutMs) : awaitTimeoutMs_(awaitTimeoutMs)
25 {}
26 
StartupConfig(const std::shared_ptr<StartupListener> & listener)27 StartupConfig::StartupConfig(const std::shared_ptr<StartupListener> &listener) : listener_(listener)
28 {}
29 
StartupConfig(int32_t awaitTimeoutMs,const std::shared_ptr<StartupListener> & listener)30 StartupConfig::StartupConfig(int32_t awaitTimeoutMs, const std::shared_ptr<StartupListener> &listener)
31     : awaitTimeoutMs_(awaitTimeoutMs), listener_(listener)
32 {}
33 
GetAwaitTimeoutMs() const34 int32_t StartupConfig::GetAwaitTimeoutMs() const
35 {
36     return awaitTimeoutMs_;
37 }
38 
ListenerOnCompleted(const std::shared_ptr<StartupTaskResult> & result)39 void StartupConfig::ListenerOnCompleted(const std::shared_ptr<StartupTaskResult> &result)
40 {
41     if (listener_ != nullptr) {
42         listener_->OnCompleted(result);
43     }
44 }
45 } // namespace AbilityRuntime
46 } // namespace OHOS
47