• 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 FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_APPMGR_APP_SCHEDULER_INTERFACE_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_APPMGR_APP_SCHEDULER_INTERFACE_H
18 
19 #include "iremote_broker.h"
20 #include "ability_info.h"
21 #include "app_launch_data.h"
22 #include "configuration.h"
23 #include "hap_module_info.h"
24 #include "want.h"
25 
26 namespace OHOS {
27 namespace AppExecFwk {
28 class IAppScheduler : public IRemoteBroker {
29 public:
30     DECLARE_INTERFACE_DESCRIPTOR(u"ohos.appexecfwk.AppScheduler");
31 
32     /**
33      * ScheduleForegroundApplication, call ScheduleForegroundApplication() through proxy project,
34      * Notify application to switch to foreground.
35      *
36      * @return
37      */
38     virtual void ScheduleForegroundApplication() = 0;
39 
40     /**
41      * ScheduleBackgroundApplication, call ScheduleBackgroundApplication() through proxy project,
42      * Notify application to switch to background.
43      *
44      * @return
45      */
46     virtual void ScheduleBackgroundApplication() = 0;
47 
48     /**
49      * ScheduleTerminateApplication, call ScheduleTerminateApplication() through proxy project,
50      * Notify application to terminate.
51      *
52      * @return
53      */
54     virtual void ScheduleTerminateApplication() = 0;
55 
56     /**
57      * ScheduleShrinkMemory, call ScheduleShrinkMemory() through proxy project,
58      * Notifies the application of the memory seen.
59      *
60      * @param The memory value.
61      *
62      * @return
63      */
64     virtual void ScheduleShrinkMemory(const int) = 0;
65 
66     /**
67      * ScheduleLowMemory, call ScheduleLowMemory() through proxy project,
68      * Notify application to low memory.
69      *
70      * @return
71      */
72     virtual void ScheduleLowMemory() = 0;
73 
74     /**
75      * ScheduleLaunchApplication, call ScheduleLaunchApplication() through proxy project,
76      * Notify application to launch application.
77      *
78      * @param The app data value.
79      *
80      * @return
81      */
82     virtual void ScheduleLaunchApplication(const AppLaunchData &, const Configuration &) = 0;
83 
84     /**
85      * ScheduleAbilityStageInfo, call ScheduleAbilityStageInfo() through proxy project,
86      * Notify application to launch application.
87      *
88      * @param The app data value.
89      *
90      * @return
91      */
92     virtual void ScheduleAbilityStage(const HapModuleInfo &) = 0;
93 
94     virtual void ScheduleLaunchAbility(const AbilityInfo &, const sptr<IRemoteObject> &,
95         const std::shared_ptr<AAFwk::Want> &want) = 0;
96 
97     /**
98      * ScheduleCleanAbility, call ScheduleCleanAbility() through proxy project,
99      * Notify application to clean ability.
100      *
101      * @param The ability token.
102      * @return
103      */
104     virtual void ScheduleCleanAbility(const sptr<IRemoteObject> &) = 0;
105 
106     /**
107      * ScheduleProfileChanged, call ScheduleProfileChanged() through proxy project,
108      * Notify application to profile update.
109      *
110      * @param The profile data.
111      * @return
112      */
113     virtual void ScheduleProfileChanged(const Profile &) = 0;
114 
115     /**
116      * ScheduleConfigurationUpdated, call ScheduleConfigurationUpdated() through proxy project,
117      * Notify application to configuration update.
118      *
119      * @param The configuration data.
120      * @return
121      */
122     virtual void ScheduleConfigurationUpdated(const Configuration &config) = 0;
123 
124     /**
125      * ScheduleProcessSecurityExit, call ScheduleProcessSecurityExit() through proxy project,
126      * Notify application process exit safely.
127      *
128      * @return
129      */
130     virtual void ScheduleProcessSecurityExit() = 0;
131 
132     virtual void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) = 0;
133 
134     /**
135      *
136      * @brief The handle of application not response process.
137      *
138      * @param sigMessage Recieve the sig message.
139      *
140      */
141     virtual void ScheduleANRProcess() = 0;
142 
143     enum class Message {
144         SCHEDULE_FOREGROUND_APPLICATION_TRANSACTION = 0,
145         SCHEDULE_BACKGROUND_APPLICATION_TRANSACTION,
146         SCHEDULE_TERMINATE_APPLICATION_TRANSACTION,
147         SCHEDULE_LOWMEMORY_APPLICATION_TRANSACTION,
148         SCHEDULE_SHRINK_MEMORY_APPLICATION_TRANSACTION,
149         SCHEDULE_LAUNCH_ABILITY_TRANSACTION,
150         SCHEDULE_CLEAN_ABILITY_TRANSACTION,
151         SCHEDULE_LAUNCH_APPLICATION_TRANSACTION,
152         SCHEDULE_PROFILE_CHANGED_TRANSACTION,
153         SCHEDULE_CONFIGURATION_UPDATED,
154         SCHEDULE_PROCESS_SECURITY_EXIT_TRANSACTION,
155         SCHEDULE_ABILITY_STAGE_INFO,
156         SCHEDULE_ACCEPT_WANT,
157         SCHEDULE_ANR_PROCESS,
158     };
159 };
160 }  // namespace AppExecFwk
161 }  // namespace OHOS
162 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_APPMGR_APP_SCHEDULER_INTERFACE_H
163