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_SERVICE_H 17 #define OHOS_MEMORY_MEMMGR_SERVICE_H 18 19 #include "mem_mgr_stub.h" 20 #include "single_instance.h" 21 #include "system_ability.h" 22 23 namespace OHOS { 24 namespace Memory { 25 class MemMgrService : public SystemAbility, public MemMgrStub { 26 DECLARE_SYSTEM_ABILITY(MemMgrService); 27 DECLARE_SINGLE_INSTANCE_BASE(MemMgrService); 28 29 public: 30 MemMgrService(); 31 ~MemMgrService() = default; 32 virtual int32_t GetBundlePriorityList(BundlePriorityList &bundlePrioList) override; 33 virtual int32_t NotifyDistDevStatus(int32_t pid, int32_t uid, const std::string &name, bool connected) override; 34 virtual void OnAddSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; 35 virtual void OnRemoveSystemAbility(int32_t systemAbilityId, const std::string& deviceId) override; 36 virtual int Dump(int fd, const std::vector<std::u16string> &args) override; 37 38 protected: 39 void OnStart() override; 40 void OnStop() override; 41 42 private: 43 bool Init(); 44 }; 45 } // namespace Memory 46 } // namespace OHOS 47 #endif // OHOS_MEMORY_MEMMGR_SERVICE_H 48