• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #ifndef OHOS_AAFWK_LOCK_MISSION_CONTAINER_H
17 #define OHOS_AAFWK_LOCK_MISSION_CONTAINER_H
18 
19 #include <list>
20 
21 #include "mission_record.h"
22 
23 namespace OHOS {
24 namespace AAFwk {
25 /**
26  * @class LockMissionContainer
27  * LockMissionContainer records locked mission record.
28  */
29 class LockMissionContainer {
30 public:
31     LockMissionContainer() = default;
32     virtual ~LockMissionContainer() = default;
33 
34     enum LockMissionState { LOCK_MISSION_STATE_NONE = 0, LOCK_MISSION_STATE_LOCKED, LOCK_MISSION_STATE_PINNED };
35 
36     bool IsLockedMissionState() const;
37     bool SetLockedMission(const std::shared_ptr<MissionRecord> &mission, int lockUid, bool isSystemApp);
38     bool ReleaseLockedMission(const std::shared_ptr<MissionRecord> &mission, int callerUid, bool isForce);
39     bool IsSameLockedMission(std::string bundleName) const;
40     std::shared_ptr<MissionRecord> GetLockMission();
41     int GetLockedMissionState() const;
42 
43 private:
44     void Clear();
45 
46 private:
47     int lockerUid_ = -1;
48     LockMissionState lockState_ = LOCK_MISSION_STATE_NONE;
49     std::weak_ptr<MissionRecord> lockMission_;
50 };
51 }  // namespace AAFwk
52 }  // namespace OHOS
53 #endif  // OHOS_AAFWK_LOCK_MISSION_CONTAINER_H