1 /*
2  * Copyright (c) 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_MEMORY_MEMMGR_APP_STATE_SUBSCRIBER_STUB_H
17 #define OHOS_MEMORY_MEMMGR_APP_STATE_SUBSCRIBER_STUB_H
18 
19 #include <iremote_stub.h>
20 
21 #include "iapp_state_subscriber.h"
22 namespace OHOS {
23 namespace Memory {
24 class AppStateSubscriberStub : public IRemoteStub<IAppStateSubscriber> {
25 public:
26     AppStateSubscriberStub();
27     ~AppStateSubscriberStub() override;
28     DISALLOW_COPY_AND_MOVE(AppStateSubscriberStub);
29 
30     /* *
31      * @brief Request service code and service data.
32      *
33      * @param code Service request code.
34      * @param data MessageParcel object.
35      * @param reply Local service response.
36      * @param option Point out async or sync.
37      * @return ERR_OK if success, else fail.
38      */
39     int32_t OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override;
40 
41 private:
42     int32_t HandleOnConnected();
43     int32_t HandleOnDisconnected();
44     int32_t HandleOnAppStateChanged(MessageParcel &data);
45     int32_t HandleOnTrim(MessageParcel &data);
46     int32_t HandleForceReclaim(MessageParcel &data);
47     int32_t OnRemoteRequestInner(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option);
48 };
49 } // namespace Memory
50 } // namespace OHOS
51 #endif // OHOS_MEMORY_MEMMGR_APP_STATE_SUBSCRIBER_STUB_H