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_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_INTERFACE_H
17#define OHOS_MEMORY_MEMMGR_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_INTERFACE_H
18
19#include <vector>
20
21#include "bundle_priority_list.h"
22#include "iremote_broker.h"
23#include "iremote_object.h"
24#include "iremote_proxy.h"
25#include "mem_mgr_process_state_info.h"
26#include "mem_mgr_window_info.h"
27#include "memmgrservice_ipc_interface_code.h"
28#ifdef USE_PURGEABLE_MEMORY
29#include "iapp_state_subscriber.h"
30#endif
31
32namespace OHOS {
33namespace Memory {
34class IMemMgr : public IRemoteBroker {
35public:
36    DECLARE_INTERFACE_DESCRIPTOR(u"ohos.memory.MemMgr");
37
38    virtual int32_t GetBundlePriorityList(BundlePriorityList &bundlePrioList) = 0;
39
40    virtual int32_t NotifyDistDevStatus(int32_t pid, int32_t uid, const std::string &name, bool connected) = 0;
41
42    virtual int32_t GetKillLevelOfLmkd(int32_t &killLevel) = 0;
43
44#ifdef USE_PURGEABLE_MEMORY
45    virtual int32_t RegisterActiveApps(int32_t pid, int32_t uid) = 0;
46
47    virtual int32_t DeregisterActiveApps(int32_t pid, int32_t uid) = 0;
48
49    virtual int32_t SubscribeAppState(const sptr<IAppStateSubscriber> &subscriber) = 0;
50
51    virtual int32_t UnsubscribeAppState(const sptr<IAppStateSubscriber> &subscriber) = 0;
52
53    virtual int32_t GetAvailableMemory(int32_t &memSize) = 0;
54
55    virtual int32_t GetTotalMemory(int32_t &memSize) = 0;
56#endif
57
58    virtual int32_t OnWindowVisibilityChanged(const std::vector<sptr<MemMgrWindowInfo>> &MemMgrWindowInfo) = 0;
59    virtual int32_t GetReclaimPriorityByPid(int32_t pid, int32_t &priority) = 0;
60    virtual int32_t NotifyProcessStateChangedSync(const MemMgrProcessStateInfo &processStateInfo) = 0;
61    virtual int32_t NotifyProcessStateChangedAsync(const MemMgrProcessStateInfo &processStateInfo) = 0;
62    virtual int32_t NotifyProcessStatus(int32_t pid, int32_t type, int32_t status, int saId = -1) = 0;
63    virtual int32_t SetCritical(int32_t pid, bool critical, int32_t saId = -1) = 0;
64};
65} // namespace Memory
66} // namespace OHOS
67#endif // OHOS_MEMORY_MEMMGR_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_INTERFACE_H
68