1ba5c3796Sopenharmony_ci/* 2ba5c3796Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3ba5c3796Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4ba5c3796Sopenharmony_ci * you may not use this file except in compliance with the License. 5ba5c3796Sopenharmony_ci * You may obtain a copy of the License at 6ba5c3796Sopenharmony_ci * 7ba5c3796Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8ba5c3796Sopenharmony_ci * 9ba5c3796Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10ba5c3796Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11ba5c3796Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12ba5c3796Sopenharmony_ci * See the License for the specific language governing permissions and 13ba5c3796Sopenharmony_ci * limitations under the License. 14ba5c3796Sopenharmony_ci */ 15ba5c3796Sopenharmony_ci 16ba5c3796Sopenharmony_ci#ifndef OHOS_MEMORY_MEMMGR_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_CLIENT_H 17ba5c3796Sopenharmony_ci#define OHOS_MEMORY_MEMMGR_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_CLIENT_H 18ba5c3796Sopenharmony_ci 19ba5c3796Sopenharmony_ci#include "i_mem_mgr.h" 20ba5c3796Sopenharmony_ci#include "single_instance.h" 21ba5c3796Sopenharmony_ci#include "app_state_subscriber.h" 22ba5c3796Sopenharmony_ci 23ba5c3796Sopenharmony_ciextern "C" { 24ba5c3796Sopenharmony_ci int32_t notify_process_status(int32_t pid, int32_t type, int32_t status, int saId = -1); 25ba5c3796Sopenharmony_ci int32_t set_critical(int32_t pid, bool critical, int32_t saId = -1); 26ba5c3796Sopenharmony_ci} 27ba5c3796Sopenharmony_ci 28ba5c3796Sopenharmony_cinamespace OHOS { 29ba5c3796Sopenharmony_cinamespace Memory { 30ba5c3796Sopenharmony_ciclass MemMgrClient { 31ba5c3796Sopenharmony_ci DECLARE_SINGLE_INSTANCE(MemMgrClient); 32ba5c3796Sopenharmony_ci 33ba5c3796Sopenharmony_cipublic: 34ba5c3796Sopenharmony_ci int32_t GetBundlePriorityList(BundlePriorityList &bundlePrioList); 35ba5c3796Sopenharmony_ci int32_t NotifyDistDevStatus(int32_t pid, int32_t uid, const std::string &name, bool connected); 36ba5c3796Sopenharmony_ci int32_t GetKillLevelOfLmkd(int32_t &killLevel); 37ba5c3796Sopenharmony_ci int32_t RegisterActiveApps(int32_t pid, int32_t uid); 38ba5c3796Sopenharmony_ci int32_t DeregisterActiveApps(int32_t pid, int32_t uid); 39ba5c3796Sopenharmony_ci int32_t SubscribeAppState(const AppStateSubscriber &subscriber); 40ba5c3796Sopenharmony_ci int32_t UnsubscribeAppState(const AppStateSubscriber &subscriber); 41ba5c3796Sopenharmony_ci int32_t GetAvailableMemory(int32_t &memSize); 42ba5c3796Sopenharmony_ci int32_t GetTotalMemory(int32_t &memSize); 43ba5c3796Sopenharmony_ci int32_t GetAvailableMemory(); 44ba5c3796Sopenharmony_ci int32_t GetTotalMemory(); 45ba5c3796Sopenharmony_ci int32_t OnWindowVisibilityChanged(const std::vector<sptr<MemMgrWindowInfo>> &MemMgrWindowInfo); 46ba5c3796Sopenharmony_ci int32_t GetReclaimPriorityByPid(int32_t pid, int32_t &priority); 47ba5c3796Sopenharmony_ci int32_t NotifyProcessStateChangedSync(const MemMgrProcessStateInfo &processStateInfo); 48ba5c3796Sopenharmony_ci int32_t NotifyProcessStateChangedAsync(const MemMgrProcessStateInfo &processStateInfo); 49ba5c3796Sopenharmony_ci int32_t NotifyProcessStatus(int32_t pid, int32_t type, int32_t status, int saId = -1); 50ba5c3796Sopenharmony_ci int32_t SetCritical(int32_t pid, bool critical, int32_t saId = -1); 51ba5c3796Sopenharmony_ci 52ba5c3796Sopenharmony_ciprivate: 53ba5c3796Sopenharmony_ci sptr<IMemMgr> GetMemMgrService(); 54ba5c3796Sopenharmony_ci std::mutex mutex_; 55ba5c3796Sopenharmony_ci sptr<IMemMgr> dpProxy_; 56ba5c3796Sopenharmony_ci}; 57ba5c3796Sopenharmony_ci} // namespace Memory 58ba5c3796Sopenharmony_ci} // namespace OHOS 59ba5c3796Sopenharmony_ci#endif // OHOS_MEMORY_MEMMGR_INTERFACES_INNERKITS_INCLUDE_MEM_MGR_CLIENT_H 60