• 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_CLIENT_H
17 #define FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_APPMGR_APP_SCHEDULER_CLIENT_H
18 
19 #include "iremote_proxy.h"
20 #include "app_scheduler_interface.h"
21 
22 namespace OHOS {
23 namespace AppExecFwk {
24 class AppSchedulerProxy : public IRemoteProxy<IAppScheduler> {
25 public:
26     explicit AppSchedulerProxy(const sptr<IRemoteObject> &impl);
27     virtual ~AppSchedulerProxy() = default;
28 
29     /**
30      * ScheduleForegroundApplication, call ScheduleForegroundApplication() through proxy project,
31      * Notify application to switch to foreground.
32      *
33      * @return
34      */
35     virtual void ScheduleForegroundApplication() override;
36 
37     /**
38      * ScheduleBackgroundApplication, call ScheduleBackgroundApplication() through proxy project,
39      * Notify application to switch to background.
40      *
41      * @return
42      */
43     virtual void ScheduleBackgroundApplication() override;
44 
45     /**
46      * ScheduleTerminateApplication, call ScheduleTerminateApplication() through proxy project,
47      * Notify application to terminate.
48      *
49      * @return
50      */
51     virtual void ScheduleTerminateApplication() override;
52 
53     /**
54      * ScheduleShrinkMemory, call ScheduleShrinkMemory() through proxy project,
55      * Notifies the application of the memory seen.
56      *
57      * @param The memory value.
58      *
59      * @return
60      */
61     virtual void ScheduleShrinkMemory(const int32_t) override;
62 
63     /**
64      * ScheduleLowMemory, call ScheduleLowMemory() through proxy project,
65      * Notify application to low memory.
66      *
67      * @return
68      */
69     virtual void ScheduleLowMemory() override;
70 
71     /**
72      * ScheduleLaunchApplication, call ScheduleLaunchApplication() through proxy project,
73      * Notify application to launch application.
74      *
75      * @param The app data value.
76      *
77      * @return
78      */
79     virtual void ScheduleLaunchApplication(const AppLaunchData &, const Configuration &) override;
80 
81     /**
82      * Notify application to launch ability stage.
83      *
84      * @param The resident process data value.
85      */
86     virtual void ScheduleAbilityStage(const HapModuleInfo &abilityStage) override;
87 
88     /**
89      * ScheduleLaunchAbility, call ScheduleLaunchAbility() through proxy project,
90      * Notify application to launch ability.
91      *
92      * @param The ability info.
93      * @param The ability token.
94      * @param The ability want.
95      * @return
96      */
97     virtual void ScheduleLaunchAbility(const AbilityInfo &, const sptr<IRemoteObject> &,
98         const std::shared_ptr<AAFwk::Want> &want) override;
99 
100     /**
101      * ScheduleCleanAbility, call ScheduleCleanAbility() through proxy project,
102      * Notify application to clean ability.
103      *
104      * @param The ability token.
105      * @return
106      */
107     virtual void ScheduleCleanAbility(const sptr<IRemoteObject> &) override;
108 
109     /**
110      * ScheduleProfileChanged, call ScheduleProfileChanged() through proxy project,
111      * Notify application to profile update.
112      *
113      * @param The profile data.
114      * @return
115      */
116     virtual void ScheduleProfileChanged(const Profile &) override;
117 
118     /**
119      * ScheduleConfigurationUpdated, call ScheduleConfigurationUpdated() through proxy project,
120      * Notify application to configuration update.
121      *
122      * @param The configuration data.
123      * @return
124      */
125     virtual void ScheduleConfigurationUpdated(const Configuration &config) override;
126 
127     /**
128      * ScheduleProcessSecurityExit, call ScheduleProcessSecurityExit() through proxy project,
129      * Notify application process exit safely.
130      *
131      * @return
132      */
133     virtual void ScheduleProcessSecurityExit() override;
134 
135     virtual void ScheduleAcceptWant(const AAFwk::Want &want, const std::string &moduleName) override;
136 
137     /**
138      *
139      * @brief The handle of application not response process.
140      *
141      * @param sigMessage Recieve the sig message.
142      *
143      */
144     virtual void ScheduleANRProcess() override;
145 
146 private:
147     bool WriteInterfaceToken(MessageParcel &data);
148     static inline BrokerDelegator<AppSchedulerProxy> delegator_;
149 };
150 }  // namespace AppExecFwk
151 }  // namespace OHOS
152 #endif  // FOUNDATION_APPEXECFWK_INTERFACES_INNERKITS_APPEXECFWK_CORE_INCLUDE_APPMGR_APP_SCHEDULER_CLIENT_H
153