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_data_manager.h" 17 18 #include "ability_manager_errors.h" 19 20 namespace OHOS { 21 namespace AbilityRuntime { 22 int32_t AbilityKeepAliveDataManager::callSetResult = ERR_OK; 23 int32_t AbilityKeepAliveDataManager::callInsertResult = ERR_OK; 24 int32_t AbilityKeepAliveDataManager::callDeleteResult = ERR_OK; 25 int32_t AbilityKeepAliveDataManager::callQueryDataResult = ERR_OK; 26 int32_t AbilityKeepAliveDataManager::callQueryApplicationResult = ERR_OK; 27 KeepAliveSetter AbilityKeepAliveDataManager::queryDataSetter = KeepAliveSetter::UNSPECIFIED; 28 std::vector<KeepAliveInfo> AbilityKeepAliveDataManager::returnInfoList; 29 GetInstance()30AbilityKeepAliveDataManager &AbilityKeepAliveDataManager::GetInstance() 31 { 32 static AbilityKeepAliveDataManager instance; 33 return instance; 34 } 35 AbilityKeepAliveDataManager()36AbilityKeepAliveDataManager::AbilityKeepAliveDataManager() {} 37 ~AbilityKeepAliveDataManager()38AbilityKeepAliveDataManager::~AbilityKeepAliveDataManager() {} 39 InsertKeepAliveData(const KeepAliveInfo & info)40int32_t AbilityKeepAliveDataManager::InsertKeepAliveData(const KeepAliveInfo &info) 41 { 42 return callInsertResult; 43 } 44 DeleteKeepAliveData(const KeepAliveInfo & info)45int32_t AbilityKeepAliveDataManager::DeleteKeepAliveData(const KeepAliveInfo &info) 46 { 47 return callDeleteResult; 48 } 49 QueryKeepAliveData(const KeepAliveInfo & info)50KeepAliveStatus AbilityKeepAliveDataManager::QueryKeepAliveData(const KeepAliveInfo &info) 51 { 52 KeepAliveStatus kaStatus; 53 kaStatus.code = callQueryDataResult; 54 kaStatus.setter = queryDataSetter; 55 return kaStatus; 56 } 57 QueryKeepAliveApplications(const KeepAliveInfo & queryParam,std::vector<KeepAliveInfo> & infoList)58int32_t AbilityKeepAliveDataManager::QueryKeepAliveApplications( 59 const KeepAliveInfo &queryParam, std::vector<KeepAliveInfo> &infoList) 60 { 61 infoList = returnInfoList; 62 return callQueryApplicationResult; 63 } 64 } // namespace AbilityRuntime 65 } // namespace OHOS 66