1 /*
2  * Copyright (c) 2020 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_ABILITY_CONNECT_MISSION_H
17 #define OHOS_ABILITY_CONNECT_MISSION_H
18 
19 #include <list>
20 
21 #include "page_ability_record.h"
22 
23 namespace OHOS {
24 class AbilityConnectMission {
25 public:
26     AbilityConnectMission() = default;
27     ~AbilityConnectMission();
28 
29     void PushServiceRecord(PageAbilityRecord &abilityRecord);
30     PageAbilityRecord *FindServiceRecord(uint64_t token) const;
31     PageAbilityRecord *FindServiceRecord(const char *bundleName, const char *abilityName) const;
32     PageAbilityRecord *FindServiceRecord(const SvcIdentity &connectSid, uint64_t abilityToken) const;
33     void RemoveServiceRecord(uint64_t token);
34     void RemoveServiceRecord(const char *bundleName);
35     int32_t CountServiceInApp(const char *bundleName);
36 #ifdef OHOS_DEBUG
37     AbilityMsStatus DumpConnectMission() const;
38 #endif
39     void RemoveConnectRecordByPageToken(uint64_t token, const char *bundleName);
40 
41 private:
42     std::list<PageAbilityRecord *> serviceRecords_;
43 };
44 } // namespace OHOS
45 
46 #endif // OHOS_ABILITY_CONNECT_MISSION_H
47