1 /*
2  * Copyright (c) 2021-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_RUNTIME_APP_SCHEDULER_HOST_H
17 #define OHOS_ABILITY_RUNTIME_APP_SCHEDULER_HOST_H
18 
19 #include <map>
20 
21 #include "iremote_object.h"
22 #include "iremote_stub.h"
23 #include "nocopyable.h"
24 #include "app_scheduler_interface.h"
25 #include "string_ex.h"
26 
27 namespace OHOS {
28 namespace AppExecFwk {
29 class AppSchedulerHost : public IRemoteStub<IAppScheduler> {
30 public:
31     AppSchedulerHost();
32     virtual ~AppSchedulerHost();
33     void InitMemberFuncMap();
34     virtual int OnRemoteRequest(
35         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
36 
37 private:
38     int32_t HandleScheduleForegroundApplication(MessageParcel &data, MessageParcel &reply);
39     int32_t HandleScheduleBackgroundApplication(MessageParcel &data, MessageParcel &reply);
40     int32_t HandleScheduleTerminateApplication(MessageParcel &data, MessageParcel &reply);
41     int32_t HandleScheduleLowMemory(MessageParcel &data, MessageParcel &reply);
42     int32_t HandleScheduleShrinkMemory(MessageParcel &data, MessageParcel &reply);
43     int32_t HandleScheduleMemoryLevel(MessageParcel &data, MessageParcel &reply);
44     int32_t HandleScheduleLaunchAbility(MessageParcel &data, MessageParcel &reply);
45     int32_t HandleScheduleCleanAbility(MessageParcel &data, MessageParcel &reply);
46     int32_t HandleScheduleLaunchApplication(MessageParcel &data, MessageParcel &reply);
47     int32_t HandleScheduleAbilityStage(MessageParcel &data, MessageParcel &reply);
48     int32_t HandleScheduleProfileChanged(MessageParcel &data, MessageParcel &reply);
49     int32_t HandleScheduleConfigurationUpdated(MessageParcel &data, MessageParcel &reply);
50     int32_t HandleScheduleProcessSecurityExit(MessageParcel &data, MessageParcel &reply);
51     int32_t HandleScheduleClearPageStack(MessageParcel &data, MessageParcel &reply);
52     int32_t HandleScheduleAcceptWant(MessageParcel &data, MessageParcel &reply);
53     int32_t HandleScheduleNewProcessRequest(MessageParcel &data, MessageParcel &reply);
54     int32_t HandleNotifyLoadRepairPatch(MessageParcel &data, MessageParcel &reply);
55     int32_t HandleNotifyHotReloadPage(MessageParcel &data, MessageParcel &reply);
56     int32_t HandleNotifyUnLoadRepairPatch(MessageParcel &data, MessageParcel &reply);
57     int32_t HandleScheduleUpdateApplicationInfoInstalled(MessageParcel &data, MessageParcel &reply);
58     int32_t HandleScheduleHeapMemory(MessageParcel &data, MessageParcel &reply);
59     int32_t HandleScheduleJsHeapMemory(MessageParcel &data, MessageParcel &reply);
60     int32_t HandleNotifyAppFault(MessageParcel &data, MessageParcel &reply);
61     int32_t HandleScheduleChangeAppGcState(MessageParcel &data, MessageParcel &reply);
62     int32_t HandleAttachAppDebug(MessageParcel &data, MessageParcel &reply);
63     int32_t HandleDetachAppDebug(MessageParcel &data, MessageParcel &reply);
64     int32_t HandleScheduleDumpIpcStart(MessageParcel &data, MessageParcel &reply);
65     int32_t HandleScheduleDumpIpcStop(MessageParcel &data, MessageParcel &reply);
66     int32_t HandleScheduleDumpIpcStat(MessageParcel &data, MessageParcel &reply);
67     int32_t HandleScheduleCacheProcess(MessageParcel &data, MessageParcel &reply);
68     int32_t HandleScheduleDumpFfrt(MessageParcel &data, MessageParcel &reply);
69     int32_t OnRemoteRequestInner(uint32_t code, MessageParcel &data,
70         MessageParcel &reply, MessageOption &option);
71     int32_t OnRemoteRequestInnerFirst(uint32_t code, MessageParcel &data,
72         MessageParcel &reply, MessageOption &option);
73     int32_t OnRemoteRequestInnerSecond(uint32_t code, MessageParcel &data,
74         MessageParcel &reply, MessageOption &option);
75     int32_t OnRemoteRequestInnerThird(uint32_t code, MessageParcel &data,
76         MessageParcel &reply, MessageOption &option);
77     DISALLOW_COPY_AND_MOVE(AppSchedulerHost);
78 };
79 }  // namespace AppExecFwk
80 }  // namespace OHOS
81 #endif  // OHOS_ABILITY_RUNTIME_APP_SCHEDULER_HOST_H
82