1 /*
2  * Copyright (c) 2023 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_SLITE_ABILITY_MGR_SERVICE_SLITE_H
17 #define OHOS_ABILITY_SLITE_ABILITY_MGR_SERVICE_SLITE_H
18 
19 #include "ability_record_manager.h"
20 #include "feature.h"
21 #include "nocopyable.h"
22 
23 namespace OHOS {
24 namespace AbilitySlite {
25 class AbilityMgrServiceSlite : public Service, public Feature {
26 public:
27     static AbilityMgrServiceSlite *GetInstance();
28 
29     const Identity *GetIdentity();
30 
31     static int32_t StartAbility(const Want *want);
32 
33     static int32_t TerminateAbility(uint64_t token);
34 
35     static int32_t SchedulerLifecycleDone(uint64_t token, int state);
36 
37     static int32_t ForceStopBundle(uint64_t token);
38 
39     static ElementName *GetTopAbility();
40 
41     static void *GetMissionInfos(uint32_t maxNum);
42 
43 private:
44     AbilityMgrServiceSlite();
45 
46     ~AbilityMgrServiceSlite();
47 
48     static const char *GetFeatureName(Feature *feature);
49 
50     static void OnFeatureInitialize(Feature *feature, Service *parent, Identity identity);
51 
52     static void OnFeatureStop(Feature *feature, Identity identity);
53 
54     static BOOL OnFeatureMessage(Feature *feature, Request *request);
55 
56     static const char *GetServiceName(Service *service);
57 
58     static BOOL ServiceInitialize(Service *service, Identity identity);
59 
60     static TaskConfig GetServiceTaskConfig(Service *service);
61 
62     static BOOL ServiceMessageHandle(Service *service, Request *request);
63 
64     static void InitAbilityThreadLoad();
65 
66     static void InitAbilityLoad();
67 
68 private:
69     Identity serviceIdentity_ {};
70     Identity featureIdentity_ {};
71     DISALLOW_COPY_AND_MOVE(AbilityMgrServiceSlite);
72 };
73 } // namespace AbilitySlite
74 } // namespace OHOS
75 #endif // OHOS_ABILITY_SLITE_ABILITY_MGR_SERVICE_SLITE_H
76