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 
16 #ifndef OHOS_ABILITY_RUNTIME_APP_CONFIG_DATA_MANAGER_H
17 #define OHOS_ABILITY_RUNTIME_APP_CONFIG_DATA_MANAGER_H
18 
19 #include <mutex>
20 #include <vector>
21 
22 #include "distributed_kv_data_manager.h"
23 #include "singleton.h"
24 
25 namespace OHOS {
26 namespace AbilityRuntime {
27 class AppConfigDataManager : public DelayedSingleton<AppConfigDataManager> {
28 public:
29     AppConfigDataManager();
30 
31     virtual ~AppConfigDataManager();
32 
33     int32_t SetAppWaitingDebugInfo(const std::string &bundleName);
34 
35     int32_t ClearAppWaitingDebugInfo();
36 
37     int32_t GetAppWaitingDebugList(std::vector<std::string> &bundleNameList);
38 
39 private:
40     DistributedKv::Status GetKvStore();
41     bool CheckKvStore();
42 
43     static const DistributedKv::AppId APP_ID;
44     static const DistributedKv::StoreId STORE_ID;
45     DistributedKv::DistributedKvDataManager dataManager_;
46     std::shared_ptr<DistributedKv::SingleKvStore> kvStorePtr_;
47     mutable std::mutex kvStorePtrMutex_;
48 };
49 } // namespace AbilityRuntime
50 } // namespace OHOS
51 #endif // OHOS_ABILITY_RUNTIME_APP_CONFIG_DATA_MANAGER_H