• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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_ABILITY_SCHEDULE_STUB_H
17 #define OHOS_ABILITY_RUNTIME_ABILITY_SCHEDULE_STUB_H
18 
19 #include <functional>
20 
21 #include "ability_scheduler_interface.h"
22 
23 #include <iremote_object.h>
24 #include <iremote_stub.h>
25 
26 namespace OHOS {
27 namespace AAFwk {
28 /**
29  * @class AbilitySchedulerStub
30  * AbilityScheduler Stub.
31  */
32 class AbilitySchedulerStub : public IRemoteStub<IAbilityScheduler> {
33 public:
34     AbilitySchedulerStub();
35     ~AbilitySchedulerStub();
36     virtual int OnRemoteRequest(
37         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
38 
39 private:
40     int AbilityTransactionInner(MessageParcel &data, MessageParcel &reply);
41     int SendResultInner(MessageParcel &data, MessageParcel &reply);
42     int ConnectAbilityInner(MessageParcel &data, MessageParcel &reply);
43     int DisconnectAbilityInner(MessageParcel &data, MessageParcel &reply);
44     int CommandAbilityInner(MessageParcel &data, MessageParcel &reply);
45     int PrepareTerminateAbilityInner(MessageParcel &data, MessageParcel &reply);
46     int CommandAbilityWindowInner(MessageParcel &data, MessageParcel &reply);
47     int SaveAbilityStateInner(MessageParcel &data, MessageParcel &reply);
48     int RestoreAbilityStateInner(MessageParcel &data, MessageParcel &reply);
49     int GetFileTypesInner(MessageParcel &data, MessageParcel &reply);
50     int OpenFileInner(MessageParcel &data, MessageParcel &reply);
51     int OpenRawFileInner(MessageParcel &data, MessageParcel &reply);
52     int InsertInner(MessageParcel &data, MessageParcel &reply);
53     int UpdatetInner(MessageParcel &data, MessageParcel &reply);
54     int DeleteInner(MessageParcel &data, MessageParcel &reply);
55     int QueryInner(MessageParcel &data, MessageParcel &reply);
56     int CallInner(MessageParcel &data, MessageParcel &reply);
57     int GetTypeInner(MessageParcel &data, MessageParcel &reply);
58     int ReloadInner(MessageParcel &data, MessageParcel &reply);
59     int BatchInsertInner(MessageParcel &data, MessageParcel &reply);
60     int RegisterObserverInner(MessageParcel &data, MessageParcel &reply);
61     int UnregisterObserverInner(MessageParcel &data, MessageParcel &reply);
62     int NotifyChangeInner(MessageParcel &data, MessageParcel &reply);
63     int NormalizeUriInner(MessageParcel &data, MessageParcel &reply);
64     int DenormalizeUriInner(MessageParcel &data, MessageParcel &reply);
65     int ExecuteBatchInner(MessageParcel &data, MessageParcel &reply);
66     int NotifyContinuationResultInner(MessageParcel &data, MessageParcel &reply);
67     int DumpAbilityInfoInner(MessageParcel& data, MessageParcel& reply);
68     int CallRequestInner(MessageParcel &data, MessageParcel &reply);
69     int OnExecuteIntentInner(MessageParcel &data, MessageParcel &reply);
70     int ContinueAbilityInner(MessageParcel &data, MessageParcel &reply);
71     int ShareDataInner(MessageParcel &data, MessageParcel &reply);
72     int CreateModalUIExtensionInner(MessageParcel &data, MessageParcel &reply);
73     int UpdateSessionTokenInner(MessageParcel &data, MessageParcel &reply);
74     int OnRemoteRequestInner(
75         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
76     int OnRemoteRequestInnerFirst(
77         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
78     int OnRemoteRequestInnerSecond(
79         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
80     int OnRemoteRequestInnerThird(
81         uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
82     int CollaborateDataInner(MessageParcel &data);
83 };
84 
85 /**
86  * @class AbilitySchedulerRecipient
87  * AbilitySchedulerRecipient notices IRemoteBroker died.
88  */
89 class AbilitySchedulerRecipient : public IRemoteObject::DeathRecipient {
90 public:
91     using RemoteDiedHandler = std::function<void(const wptr<IRemoteObject> &)>;
92 
93     explicit AbilitySchedulerRecipient(RemoteDiedHandler handler);
94 
95     virtual ~AbilitySchedulerRecipient();
96 
97     virtual void OnRemoteDied(const wptr<IRemoteObject> &remote);
98 
99 private:
100     RemoteDiedHandler handler_;
101 };
102 }  // namespace AAFwk
103 }  // namespace OHOS
104 #endif  // OHOS_ABILITY_RUNTIME_ABILITY_SCHEDULE_STUB_H
105