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 16 #ifndef OHOS_FORM_FWK_FORM_TRUST_MGR_H 17 #define OHOS_FORM_FWK_FORM_TRUST_MGR_H 18 19 #include <map> 20 #include <singleton.h> 21 #include <string> 22 23 #include "form_rdb_data_mgr.h" 24 25 namespace OHOS { 26 namespace AppExecFwk { 27 28 /** 29 * @class FormTrustMgr 30 * Form info storage. 31 */ 32 class FormTrustMgr final : public DelayedRefSingleton<FormTrustMgr> { 33 DECLARE_DELAYED_REF_SINGLETON(FormTrustMgr) 34 public: 35 DISALLOW_COPY_AND_MOVE(FormTrustMgr); 36 37 /** 38 * @brief IsTrust or not. 39 * @param bundleName Storage all form info. 40 * @return Returns result. 41 */ 42 bool IsTrust(const std::string &bundleName); 43 44 /** 45 * @brief MarkTrust. 46 * @param bundleName bundleName. 47 * @param isTrust isTrust. 48 * @return Returns result. 49 */ 50 void MarkTrustFlag(const std::string &bundleName, bool isTrust); 51 52 /** 53 * @brief Get the Untrust App Name List object 54 * 55 * @param result 56 */ 57 void GetUntrustAppNameList(std::string &result); 58 private: 59 std::map<std::string, int32_t> unTrustList_; 60 mutable std::mutex rdbStoreMutex_; 61 }; 62 } // namespace AppExecFwk 63 } // namespace OHOS 64 #endif // OHOS_FORM_FWK_FORM_TRUST_MGR_H 65