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 "ability_keep_alive_service.h"
17
18 namespace OHOS {
19 namespace AbilityRuntime {
20 using namespace OHOS::AAFwk;
21 int32_t AbilityKeepAliveService::callSetResult = ERR_OK;
22 int32_t AbilityKeepAliveService::callQueryResult = ERR_OK;
23 bool AbilityKeepAliveService::callIsKeepAliveResult = false;
24 int32_t AbilityKeepAliveService::callGetResult = ERR_OK;
25
GetInstance()26 AbilityKeepAliveService &AbilityKeepAliveService::GetInstance()
27 {
28 static AbilityKeepAliveService instance;
29 return instance;
30 }
31
AbilityKeepAliveService()32 AbilityKeepAliveService::AbilityKeepAliveService() {}
33
~AbilityKeepAliveService()34 AbilityKeepAliveService::~AbilityKeepAliveService() {}
35
SetApplicationKeepAlive(KeepAliveInfo & info,bool flag)36 int32_t AbilityKeepAliveService::SetApplicationKeepAlive(KeepAliveInfo &info, bool flag)
37 {
38 return callSetResult;
39 }
40
QueryKeepAliveApplications(int32_t userId,int32_t appType,std::vector<KeepAliveInfo> & infoList)41 int32_t AbilityKeepAliveService::QueryKeepAliveApplications(int32_t userId,
42 int32_t appType, std::vector<KeepAliveInfo> &infoList)
43 {
44 return callQueryResult;
45 }
46
IsKeepAliveApp(const std::string & bundleName,int32_t userId)47 bool AbilityKeepAliveService::IsKeepAliveApp(const std::string &bundleName, int32_t userId)
48 {
49 return callIsKeepAliveResult;
50 }
51
GetKeepAliveApplications(int32_t userId,std::vector<KeepAliveInfo> & infoList)52 int32_t AbilityKeepAliveService::GetKeepAliveApplications(int32_t userId, std::vector<KeepAliveInfo> &infoList)
53 {
54 return callGetResult;
55 }
56 } // namespace AbilityRuntime
57 } // namespace OHOS
58