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 "memmgrservice_ipc_interface_code.h" 25 #include "mem_mgr_window_info.h" 26 #ifdef USE_PURGEABLE_MEMORY 27 #include "iapp_state_subscriber.h" 28 #endif 29 30 namespace OHOS { 31 namespace Memory { 32 class IMemMgr : public IRemoteBroker { 33 public: 34 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.memory.MemMgr"); 35 36 virtual int32_t GetBundlePriorityList(BundlePriorityList &bundlePrioList) = 0; 37 38 virtual int32_t NotifyDistDevStatus(int32_t pid, int32_t uid, const std::string &name, bool connected) = 0; 39 40 virtual int32_t GetKillLevelOfLmkd(int32_t &killLevel) = 0; 41 42 #ifdef USE_PURGEABLE_MEMORY 43 virtual int32_t RegisterActiveApps(int32_t pid, int32_t uid) = 0; 44 45 virtual int32_t DeregisterActiveApps(int32_t pid, int32_t uid) = 0; 46 47 virtual int32_t SubscribeAppState(const sptr<IAppStateSubscriber> &subscriber) = 0; 48 49 virtual int32_t UnsubscribeAppState(const sptr<IAppStateSubscriber> &subscriber) = 0; 50 51 virtual int32_t GetAvailableMemory(int32_t &memSize) = 0; 52 53 virtual int32_t GetTotalMemory(int32_t &memSize) = 0; 54 #endif 55 56 virtual int32_t OnWindowVisibilityChanged(const std::vector<sptr<MemMgrWindowInfo>> &MemMgrWindowInfo) = 0; 57 virtual int32_t GetReclaimPriorityByPid(int32_t pid, int32_t &priority) = 0; 58 }; 59 } // namespace Memory 60 } // namespace OHOS 61 #endif // OHOS_MEMORY_MEMMGR_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_INTERFACE_H 62