1 /* 2 * Copyright (c) 2021 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 "power_storage.h" 17 #include "ability_util.h" 18 #include "mission_record.h" 19 20 namespace OHOS { 21 namespace AAFwk { SetPowerOffInActiveRecord(const std::shared_ptr<AbilityRecord> & ability)22void PowerStorage::SetPowerOffInActiveRecord(const std::shared_ptr<AbilityRecord> &ability) 23 { 24 CHECK_POINTER(ability); 25 PowerOffRecord record; 26 record.ability = ability; 27 record.StackId = ability->GetMissionRecord()->GetMissionStack()->GetMissionStackId(); 28 record.missionId = ability->GetMissionRecord()->GetMissionRecordId(); 29 record.state = ability->GetAbilityState(); 30 inActiveRecord_.emplace_back(record); 31 } 32 GetPowerOffInActiveRecord() const33std::vector<PowerOffRecord> PowerStorage::GetPowerOffInActiveRecord() const 34 { 35 return inActiveRecord_; 36 } 37 SetPowerOffActiveRecord(const std::shared_ptr<AbilityRecord> & ability)38void PowerStorage::SetPowerOffActiveRecord(const std::shared_ptr<AbilityRecord> &ability) 39 { 40 CHECK_POINTER(ability); 41 PowerOffRecord record; 42 record.ability = ability; 43 record.StackId = ability->GetMissionRecord()->GetMissionStack()->GetMissionStackId(); 44 record.missionId = ability->GetMissionRecord()->GetMissionRecordId(); 45 record.state = ability->GetAbilityState(); 46 activeRecord_.emplace_back(record); 47 } 48 GetPowerOffActiveRecord() const49std::vector<PowerOffRecord> PowerStorage::GetPowerOffActiveRecord() const 50 { 51 return activeRecord_; 52 } 53 } // namespace AAFwk 54 } // namespace OHOS 55