• 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 #include "applicationInfo.proj.hpp"
16 #include "applicationInfo.impl.hpp"
17 #include "taihe/runtime.hpp"
18 #include "stdexcept"
19 
20 using namespace taihe;
21 using namespace applicationInfo;
22 
23 namespace {
24 // To be implemented.
25 
26 class ApplicationInfoImpl {
27 public:
28     int32_t applicationInfoImpl = 21474;
ApplicationInfoImpl()29     ApplicationInfoImpl() {}
30 
GetName()31     string GetName()
32     {
33         return "ApplicationInfoImpl::getName";
34     }
35 
GetDescription()36     string GetDescription()
37     {
38         return "ApplicationInfoImpl::getDescription";
39     }
40 
GetDescriptionId()41     int32_t GetDescriptionId()
42     {
43         return applicationInfoImpl;
44     }
45 
GetEnabled()46     bool GetEnabled()
47     {
48         return true;
49     }
50 
GetLabel()51     string GetLabel()
52     {
53         return "ApplicationInfoImpl::getLabel";
54     }
55 
GetLabelId()56     int32_t GetLabelId()
57     {
58         return applicationInfoImpl;
59     }
60 
GetIcon()61     string GetIcon()
62     {
63         return "ApplicationInfoImpl::getIcon";
64     }
65 
GetIconId()66     int32_t GetIconId()
67     {
68         return applicationInfoImpl;
69     }
70 
GetProcess()71     string GetProcess()
72     {
73         return "ApplicationInfoImpl::getProcess";
74     }
75 
GetPermissions()76     array<string> GetPermissions()
77     {
78         array<string> res = {"ApplicationInfoImpl::getPermissions"};
79         return res;
80     }
81 
GetCodePath()82     string GetCodePath()
83     {
84         return "ApplicationInfoImpl::getCodePath";
85     }
86 
GetRemovable()87     bool GetRemovable()
88     {
89         return true;
90     }
91 
GetAccessTokenId()92     int32_t GetAccessTokenId()
93     {
94         return applicationInfoImpl;
95     }
96 
GetUid()97     int32_t GetUid()
98     {
99         return applicationInfoImpl;
100     }
101 
GetAppDistributionType()102     string GetAppDistributionType()
103     {
104         return "ApplicationInfoImpl::getAppDistributionType";
105     }
106 
GetAppProvisionType()107     string GetAppProvisionType()
108     {
109         return "ApplicationInfoImpl::getAppProvisionType";
110     }
111 
GetSystemApp()112     bool GetSystemApp()
113     {
114         return true;
115     }
116 
GetDebug()117     bool GetDebug()
118     {
119         return true;
120     }
121 
GetDataUnclearable()122     bool GetDataUnclearable()
123     {
124         return true;
125     }
126 
GetNativeLibraryPath()127     string GetNativeLibraryPath()
128     {
129         return "ApplicationInfoImpl::getNativeLibraryPath";
130     }
131 
GetAppIndex()132     int32_t GetAppIndex()
133     {
134         return applicationInfoImpl;
135     }
136 
GetInstallSource()137     string GetInstallSource()
138     {
139         return "ApplicationInfoImpl::getInstallSource";
140     }
141 
GetReleaseType()142     string GetReleaseType()
143     {
144         return "ApplicationInfoImpl::getReleaseType";
145     }
146 
GetCloudFileSyncEnabled()147     bool GetCloudFileSyncEnabled()
148     {
149         return true;
150     }
151 };
152 
153 class ModuleMetadataImpl {
154 public:
ModuleMetadataImpl()155     ModuleMetadataImpl() {}
156 
GetModuleName()157     string GetModuleName()
158     {
159         return "ModuleMetadataImpl::getModuleName";
160     }
161 };
162 
163 class MultiAppModeImpl {
164 public:
165     int32_t multiAppModeImpl = 21474;
MultiAppModeImpl()166     MultiAppModeImpl() {}
167 
GetMaxCount()168     int32_t GetMaxCount()
169     {
170         return multiAppModeImpl;
171     }
172 };
173 
GetApplicationInfo()174 ApplicationInfo GetApplicationInfo()
175 {
176     return make_holder<ApplicationInfoImpl, ApplicationInfo>();
177 }
178 
GetModuleMetadata()179 ModuleMetadata GetModuleMetadata()
180 {
181     return make_holder<ModuleMetadataImpl, ModuleMetadata>();
182 }
183 
GetMultiAppMode()184 MultiAppMode GetMultiAppMode()
185 {
186     return make_holder<MultiAppModeImpl, MultiAppMode>();
187 }
188 }  // namespace
189 
190 TH_EXPORT_CPP_API_GetApplicationInfo(GetApplicationInfo);
191 TH_EXPORT_CPP_API_GetModuleMetadata(GetModuleMetadata);
192 TH_EXPORT_CPP_API_GetMultiAppMode(GetMultiAppMode);