1 /* 2 * Copyright (C) 2024 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 APP_DOMAIN_VERIFY_APP_DETAILS_DATA_MGR_H 16 #define APP_DOMAIN_VERIFY_APP_DETAILS_DATA_MGR_H 17 18 #include <cstdint> 19 #include <string> 20 #include <unordered_map> 21 #include "cpp/mutex.h" 22 #include "want.h" 23 #include "lru_cache_util.h" 24 #include "filter_define.h" 25 #include "app_details_filter.h" 26 #include "app_details_rdb_data_manager.h" 27 28 namespace OHOS { 29 namespace AppDomainVerify { 30 enum AppDetailsCode { 31 QUERY_SUCC, 32 QUERY_FAIL 33 }; 34 35 class AppDetailsDataMgr { 36 public: 37 AppDetailsDataMgr(); 38 virtual ~AppDetailsDataMgr(); 39 int QueryAppDetailsWant(const std::string& url, AAFwk::Want& want, std::string& bundleName); 40 private: 41 bool QueryAppDetailsWantByCache(const std::string& url, std::string& bundleName); 42 bool QueryAppDetailsWantByRdb(const std::string& url, std::string& bundleName); 43 void AddInfoToWant(AAFwk::Want& want, const std::string& bundleName); 44 std::shared_ptr<LruCacheUtil<std::string, std::string>> lruCache_; 45 std::shared_ptr<AppDetailsRdbDataMgr> rdbMgr_; 46 std::shared_ptr<AppDetailsFilter> detailsFilter_; 47 int64_t cacheBeginTime_ = 0; 48 std::mutex agWantUrlMutex; 49 std::string agWantUrl_; 50 }; 51 } // namespace AppDomainVerify 52 } // namespace OHOS 53 #endif // APP_DETAILS_DATA_MGR_H