• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2025 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 ATOMICSERVICE_BASIC_ENGINE_PLUGIN
17 #define ATOMICSERVICE_BASIC_ENGINE_PLUGIN
18 
19 #include <dlfcn.h>
20 #include <mutex>
21 #include <string>
22 
23 #include "parcel.h"
24 
25 namespace OHOS::Rosen {
26 #ifdef WINDOW_ATOMIC_SERVICE_ATTRIBUTION_ENABLE
27 class AtomicserviceIconInfo : public virtual Parcelable {
28 public:
29     AtomicserviceIconInfo();
30     virtual ~AtomicserviceIconInfo() = default;
31 
32     // The following functions are used to get data
33     std::string GetBundleName() const;
34     std::string GetModuleName() const;
35     std::string GetAbilityName() const;
36     std::string GetCircleIcon() const;
37     std::string GetEyelashRingIcon() const;
38     std::string GetAppName() const;
39     std::vector<std::string> GetDeviceTypes() const;
40     int32_t GetResizable() const;
41     std::vector<std::string> GetSupportWindowMode() const;
42 
43     // The following functions are used to set data
44     void SetBundleName(const std::string& val);
45     void SetModuleName(const std::string& val);
46     void SetAbilityName(const std::string& val);
47     void SetCircleIcon(const std::string& val);
48     void SetEyelashRingIcon(const std::string& val);
49     void SetAppName(const std::string& val);
50     void SetDeviceTypes(const std::vector<std::string>& val);
51     void SetResizable(int32_t val);
52     void SetSupportWindowMode(const std::vector<std::string>& val);
53 
54     // The following functions are used for serialization and deserialization
55     bool Marshalling(Parcel& parcel) const override;
56     static AtomicserviceIconInfo* Unmarshalling(Parcel& parcel);
57 
58 private:
59     // Member variable
60     std::string bundleName_;
61     std::string moduleName_;
62     std::string abilityName_;
63     std::string circleIcon_;
64     std::string eyelashRingIcon_;
65     std::string appName_;
66     std::vector<std::string> deviceTypes_;
67     int32_t resizable_;
68     std::vector<std::string> supportWindowMode_;
69 };
70 
71 class AtomicServiceBasicEnginePlugin {
72 public:
73     static AtomicServiceBasicEnginePlugin& GetInstance();
74     int32_t ReleaseData();
75     AtomicserviceIconInfo* GetParamsFromAtomicServiceBasicEngine(const std::string& bundleName);
76 
77 private:
78     AtomicServiceBasicEnginePlugin();
79     ~AtomicServiceBasicEnginePlugin();
80 
81     typedef int32_t GetAtomicserviceIconInfoPlugin(
82         std::string bundleName, AtomicserviceIconInfo** atomicserviceIconInfo);
83     typedef void FreeData(AtomicserviceIconInfo* data);
84 
85     std::mutex mutex_;
86     void* atomicServiceBasicEngine_ = nullptr;
87     AtomicserviceIconInfo* atomicserviceIconInfo_ = nullptr;
88     GetAtomicserviceIconInfoPlugin* getAtomicserviceIconInfoPlugin_ = nullptr;
89     FreeData* freeData_ = nullptr;
90 }; // AtomicServiceBasicEnginePlugin
91 #endif // WINDOW_ATOMIC_SERVICE_ATTRIBUTION_ENABLE
92 } // namespace OHOS::Rosen
93 #endif // ATOMICSERVICE_BASIC_ENGINE_PLUGIN
94