1 /* 2 * Copyright (c) 2023 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 #ifndef OHOS_RESOURCE_MANAGER_SYSTEMRESOURCEMANAGER_H 16 #define OHOS_RESOURCE_MANAGER_SYSTEMRESOURCEMANAGER_H 17 18 #include "resource_manager_impl.h" 19 20 namespace OHOS { 21 namespace Global { 22 namespace Resource { 23 class SystemResourceManager { 24 public: 25 SystemResourceManager(); 26 27 ~SystemResourceManager(); 28 29 /** 30 * Get system resource manager, the added system resource is sandbox path. This method should call 31 * after the sandbox mount. 32 * 33 * @return pointer of system resource manager 34 */ 35 static ResourceManagerImpl *GetSystemResourceManager(); 36 37 /** 38 * Get system resource manager, the added system resource is no sandbox path. This method should call 39 * before the sandbox mount, for example appspawn. 40 * 41 * @return pointer of system resource manager 42 */ 43 static ResourceManagerImpl *GetSystemResourceManagerNoSandBox(); 44 45 private: 46 static std::mutex mutex_; 47 48 static ResourceManagerImpl *resourceManager_; 49 50 static const std::string SYSTEM_RESOURCE_PATH; 51 52 static const std::string SYSTEM_RESOURCE_PATH_COMPRESSED; 53 54 static const std::string SYSTEM_RESOURCE_OVERLAY_PATH; 55 56 static const std::string SYSTEM_RESOURCE_OVERLAY_PATH_COMPRESSED; 57 58 static const std::string SYSTEM_RESOURCE_NO_SAND_BOX_PKG_PATH; 59 60 static const std::string SYSTEM_RESOURCE_NO_SAND_BOX_HAP_PATH; 61 62 static const std::string SYSTEM_RESOURCE_EXT_NO_SAND_BOX_HAP_PATH; 63 64 static bool LoadSystemResource(ResourceManagerImpl *impl, bool isSandbox = true); 65 66 static bool CreateSystemResourceManager(bool isSandbox = true); 67 }; 68 } // namespace Resource 69 } // namespace Global 70 } // namespace OHOS 71 #endif