• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-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 #include "enterprise_device_mgr_stub.h"
17 
18 #include "admin.h"
19 #include "edm_constants.h"
20 #include "ent_info.h"
21 #include "string_ex.h"
22 
23 using namespace OHOS::HiviewDFX;
24 
25 namespace OHOS {
26 namespace EDM {
27 #ifdef EDM_SUPPORT_ALL_ENABLE
28 constexpr int32_t WITHOUT_FUNCTION_CODE = -1;
29 #endif
EnterpriseDeviceMgrStub()30 EnterpriseDeviceMgrStub::EnterpriseDeviceMgrStub() : IRemoteStub(false)
31 {
32     InitSystemCodeList();
33     EDMLOGI("EnterpriseDeviceMgrStub()");
34 }
35 
36 #ifdef EDM_SUPPORT_ALL_ENABLE
CallFuncByCode(uint32_t code,MessageParcel & data,MessageParcel & reply)37 ErrCode EnterpriseDeviceMgrStub::CallFuncByCode(uint32_t code, MessageParcel &data, MessageParcel &reply)
38 {
39     switch (code) {
40         case EdmInterfaceCode::ADD_DEVICE_ADMIN:
41             return EnableAdminInner(data, reply);
42         case EdmInterfaceCode::REMOVE_DEVICE_ADMIN:
43             return DisableAdminInner(data, reply);
44         case EdmInterfaceCode::REMOVE_SUPER_ADMIN:
45             return DisableSuperAdminInner(data, reply);
46         case EdmInterfaceCode::GET_ENABLED_ADMIN:
47             return GetEnabledAdminInner(data, reply);
48         case EdmInterfaceCode::GET_ENT_INFO:
49             return GetEnterpriseInfoInner(data, reply);
50         case EdmInterfaceCode::SET_ENT_INFO:
51             return SetEnterpriseInfoInner(data, reply);
52         case EdmInterfaceCode::IS_SUPER_ADMIN:
53             return IsSuperAdminInner(data, reply);
54         case EdmInterfaceCode::IS_ADMIN_ENABLED:
55             return IsAdminEnabledInner(data, reply);
56         case EdmInterfaceCode::SUBSCRIBE_MANAGED_EVENT:
57             return SubscribeManagedEventInner(data, reply);
58         case EdmInterfaceCode::UNSUBSCRIBE_MANAGED_EVENT:
59             return UnsubscribeManagedEventInner(data, reply);
60         case EdmInterfaceCode::AUTHORIZE_ADMIN:
61             return AuthorizeAdminInner(data, reply);
62         case EdmInterfaceCode::GET_SUPER_ADMIN_WANT_INFO:
63             return GetSuperAdminInner(data, reply);
64         case EdmInterfaceCode::SET_DELEGATED_POLICIES:
65             return SetDelegatedPoliciesInner(data, reply);
66         case EdmInterfaceCode::GET_DELEGATED_POLICIES:
67             return GetDelegatedPoliciesInner(data, reply);
68         case EdmInterfaceCode::GET_DELEGATED_BUNDLE_NAMES:
69             return GetDelegatedBundleNamesInner(data, reply);
70         case EdmInterfaceCode::GET_ADMINS:
71             return GetAdminsInner(data, reply);
72         case EdmInterfaceCode::REPLACE_SUPER_ADMIN:
73             return ReplaceSuperAdminInner(data, reply);
74         default:
75             return WITHOUT_FUNCTION_CODE;
76     }
77 }
78 #endif
79 
InitSystemCodeList()80 void EnterpriseDeviceMgrStub::InitSystemCodeList()
81 {
82     systemCodeList = {
83         EdmInterfaceCode::ADD_DEVICE_ADMIN,
84         EdmInterfaceCode::REMOVE_SUPER_ADMIN,
85         EdmInterfaceCode::GET_ENABLED_ADMIN,
86         EdmInterfaceCode::GET_ENT_INFO,
87         EdmInterfaceCode::SET_ENT_INFO,
88         EdmInterfaceCode::IS_SUPER_ADMIN,
89         EdmInterfaceCode::IS_ADMIN_ENABLED,
90         EdmInterfaceCode::AUTHORIZE_ADMIN,
91         EdmInterfaceCode::GET_SUPER_ADMIN_WANT_INFO,
92         EdmInterfaceCode::GET_ADMINS,
93         EdmInterfaceCode::REPLACE_SUPER_ADMIN,
94     };
95 }
96 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)97 int32_t EnterpriseDeviceMgrStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply,
98     MessageOption &option)
99 {
100 #ifdef EDM_SUPPORT_ALL_ENABLE
101     std::u16string descriptor = GetDescriptor();
102     std::u16string remoteDescriptor = data.ReadInterfaceToken();
103     EDMLOGI("EnterpriseDeviceMgrStub code %{public}u", code);
104     if (descriptor != remoteDescriptor) {
105         EDMLOGE("EnterpriseDeviceMgrStub code %{public}d client and service descriptors are inconsistent", code);
106         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
107         return ERR_OK;
108     }
109     if (SERVICE_FLAG(code)) {
110         if (std::find(systemCodeList.begin(), systemCodeList.end(), code) != systemCodeList.end() &&
111             !PermissionChecker::GetInstance()->CheckIsSystemAppOrNative()) {
112             EDMLOGE("EnterpriseDeviceMgrStub not system app or native process");
113             reply.WriteInt32(EdmReturnErrCode::SYSTEM_API_DENIED);
114             return ERR_OK;
115         }
116         ErrCode ret = CallFuncByCode(code, data, reply);
117         if (ret != WITHOUT_FUNCTION_CODE) {
118             return ret;
119         }
120     }
121     if (POLICY_FLAG(code)) {
122         EDMLOGD("POLICY_FLAG(code:%{public}x)\n", code);
123         int32_t hasUserId;
124         int32_t userId = EdmConstants::DEFAULT_USER_ID;
125         data.ReadInt32(hasUserId);
126         if (hasUserId == 1) {
127             data.ReadInt32(userId);
128         }
129         if (FUNC_TO_POLICY(code) == (std::uint32_t)EdmInterfaceCode::GET_ADMINPROVISION_INFO) {
130             return CheckAndGetAdminProvisionInfoInner(code, data, reply, userId);
131         }
132         if (FUNC_TO_OPERATE(code) == static_cast<int>(FuncOperateType::GET)) {
133             EDMLOGD("GetDevicePolicyInner");
134             return GetDevicePolicyInner(code, data, reply, userId);
135         } else {
136             EDMLOGD("HandleDevicePolicyInner");
137             return HandleDevicePolicyInner(code, data, reply, userId);
138         }
139     } else {
140         EDMLOGE("!POLICY_FLAG(code)");
141     }
142 
143     return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
144 #else
145     EDMLOGI("EnterpriseDeviceMgrStub edm unsupport.");
146     reply.WriteInt32(EdmReturnErrCode::INTERFACE_UNSUPPORTED);
147     return ERR_OK;
148 #endif
149 }
150 
GetExternalManagerFactory()151 std::shared_ptr<IExternalManagerFactory> EnterpriseDeviceMgrStub::GetExternalManagerFactory()
152 {
153     return externalManagerFactory_;
154 }
155 
EnableAdminInner(MessageParcel & data,MessageParcel & reply)156 ErrCode EnterpriseDeviceMgrStub::EnableAdminInner(MessageParcel &data, MessageParcel &reply)
157 {
158     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
159     if (!admin) {
160         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
161         return ERR_OK;
162     }
163     EDMLOGD("EnableAdminInner bundleName:: %{public}s : abilityName : %{public}s ", admin->GetBundleName().c_str(),
164         admin->GetAbilityName().c_str());
165     EntInfo entInfo;
166     if (!EntInfo::Unmarshalling(data, entInfo)) {
167         EDMLOGE("EnterpriseDeviceMgrStub::EnableAdminInner read parcel fail");
168         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
169         return ERR_OK;
170     }
171     int32_t type = data.ReadInt32();
172     int32_t userId = data.ReadInt32();
173     AdminType adminType = AdminType::UNKNOWN;
174     if (type != static_cast<int32_t>(AdminType::NORMAL) && type != static_cast<int32_t>(AdminType::ENT) &&
175         type != static_cast<int32_t>(AdminType::BYOD)) {
176         EDMLOGE("EnableAdminInner: admin type is invalid.");
177         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
178         return ERR_OK;
179     }
180     adminType = static_cast<AdminType>(type);
181     ErrCode retCode = EnableAdmin(*admin, entInfo, adminType, userId);
182     reply.WriteInt32(retCode);
183     return ERR_OK;
184 }
185 
ReplaceSuperAdminInner(MessageParcel & data,MessageParcel & reply)186 ErrCode EnterpriseDeviceMgrStub::ReplaceSuperAdminInner(MessageParcel &data, MessageParcel &reply)
187 {
188     std::unique_ptr<AppExecFwk::ElementName> oldAdmin(data.ReadParcelable<AppExecFwk::ElementName>());
189     if (!oldAdmin) {
190         return EdmReturnErrCode::PARAM_ERROR;
191     }
192     std::unique_ptr<AppExecFwk::ElementName> newAdmin(data.ReadParcelable<AppExecFwk::ElementName>());
193     if (!newAdmin) {
194         return EdmReturnErrCode::PARAM_ERROR;
195     }
196 
197     bool keepPolicy = data.ReadBool();
198     EDMLOGD(
199         "ReplaceSuperAdminInner: oldAdmin.bundlename %{public}s, "
200         "oldAdmin.abilityname:%{public}s "
201         "ReplaceSuperAdminInner: newAdmin.bundlename %{public}s, "
202         "newAdmin.abilityname:%{public}s",
203         oldAdmin->GetBundleName().c_str(),
204         oldAdmin->GetAbilityName().c_str(),
205         newAdmin->GetBundleName().c_str(),
206         newAdmin->GetAbilityName().c_str());
207     return ReplaceSuperAdmin(*oldAdmin, *newAdmin, keepPolicy);
208 }
209 
DisableAdminInner(MessageParcel & data,MessageParcel & reply)210 ErrCode EnterpriseDeviceMgrStub::DisableAdminInner(MessageParcel &data, MessageParcel &reply)
211 {
212     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
213     if (!admin) {
214         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
215         return ERR_OK;
216     }
217     int32_t userId = data.ReadInt32();
218     ErrCode retCode = DisableAdmin(*admin, userId);
219     reply.WriteInt32(retCode);
220     return ERR_OK;
221 }
222 
DisableSuperAdminInner(MessageParcel & data,MessageParcel & reply)223 ErrCode EnterpriseDeviceMgrStub::DisableSuperAdminInner(MessageParcel &data, MessageParcel &reply)
224 {
225     std::string bundleName = data.ReadString();
226     EDMLOGD("DisableSuperAdminInner bundleName:: %{public}s :", bundleName.c_str());
227     ErrCode retCode = DisableSuperAdmin(bundleName);
228     reply.WriteInt32(retCode);
229     return retCode;
230 }
231 
HandleDevicePolicyInner(uint32_t code,MessageParcel & data,MessageParcel & reply,int32_t userId)232 ErrCode EnterpriseDeviceMgrStub::HandleDevicePolicyInner(uint32_t code, MessageParcel &data, MessageParcel &reply,
233     int32_t userId)
234 {
235     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
236     if (!admin) {
237         EDMLOGW("HandleDevicePolicyInner: ReadParcelable failed");
238         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
239         return ERR_OK;
240     }
241     ErrCode errCode = HandleDevicePolicy(code, *admin, data, reply, userId);
242     reply.WriteInt32(errCode);
243     return ERR_OK;
244 }
245 
GetDevicePolicyInner(uint32_t code,MessageParcel & data,MessageParcel & reply,int32_t userId)246 ErrCode EnterpriseDeviceMgrStub::GetDevicePolicyInner(uint32_t code, MessageParcel &data, MessageParcel &reply,
247     int32_t userId)
248 {
249     ErrCode errCode = GetDevicePolicy(code, data, reply, userId);
250     reply.WriteInt32(errCode);
251     return ERR_OK;
252 }
253 
CheckAndGetAdminProvisionInfoInner(uint32_t code,MessageParcel & data,MessageParcel & reply,int32_t userId)254 ErrCode EnterpriseDeviceMgrStub::CheckAndGetAdminProvisionInfoInner(uint32_t code, MessageParcel &data,
255     MessageParcel &reply, int32_t userId)
256 {
257     ErrCode errCode = CheckAndGetAdminProvisionInfo(code, data, reply, userId);
258     reply.WriteInt32(errCode);
259     return ERR_OK;
260 }
261 
GetEnabledAdminInner(MessageParcel & data,MessageParcel & reply)262 ErrCode EnterpriseDeviceMgrStub::GetEnabledAdminInner(MessageParcel &data, MessageParcel &reply)
263 {
264     EDMLOGD("EnterpriseDeviceMgrStub:GetEnabledAdmin");
265     int32_t type = static_cast<int32_t>(AdminType::UNKNOWN);
266     if (!data.ReadInt32(type)) {
267         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
268         EDMLOGE("EnterpriseDeviceMgrStub:GetEnabledAdminInner read type fail %{public}u", type);
269         return ERR_OK;
270     }
271     std::vector<std::string> enabledAdminList;
272     ErrCode res = GetEnabledAdmin((AdminType)type, enabledAdminList);
273     if (FAILED(res)) {
274         EDMLOGE("EnterpriseDeviceMgrStub:GetEnabledAdmin failed:%{public}d", res);
275         reply.WriteInt32(res);
276         return ERR_OK;
277     }
278     reply.WriteInt32(ERR_OK);
279     reply.WriteStringVector(enabledAdminList);
280     return ERR_OK;
281 }
282 
GetEnterpriseInfoInner(MessageParcel & data,MessageParcel & reply)283 ErrCode EnterpriseDeviceMgrStub::GetEnterpriseInfoInner(MessageParcel &data, MessageParcel &reply)
284 {
285     EDMLOGD("EnterpriseDeviceMgrStub:GetEnterpriseInfoInner");
286     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
287     if (!admin) {
288         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
289         return ERR_OK;
290     }
291     EDMLOGD("GetEnterpriseInfoInner bundleName:: %{public}s : abilityName : %{public}s ",
292         admin->GetBundleName().c_str(), admin->GetAbilityName().c_str());
293 
294     return GetEnterpriseInfo(*admin, reply);
295 }
296 
IsSuperAdminInner(MessageParcel & data,MessageParcel & reply)297 ErrCode EnterpriseDeviceMgrStub::IsSuperAdminInner(MessageParcel &data, MessageParcel &reply)
298 {
299     EDMLOGD("EnterpriseDeviceMgrStub:IsSuperAdminInner");
300     std::string bundleName = data.ReadString();
301     EDMLOGD("IsSuperAdminInner bundleName:: %{public}s :", bundleName.c_str());
302     bool ret = IsSuperAdmin(bundleName);
303     reply.WriteInt32(ERR_OK);
304     reply.WriteBool(ret);
305     return ERR_OK;
306 }
307 
IsAdminEnabledInner(MessageParcel & data,MessageParcel & reply)308 ErrCode EnterpriseDeviceMgrStub::IsAdminEnabledInner(MessageParcel &data, MessageParcel &reply)
309 {
310     EDMLOGD("EnterpriseDeviceMgrStub:IsAdminEnabled");
311     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
312     if (!admin) {
313         EDMLOGE("EnterpriseDeviceMgrStub::IsAdminEnabledInner read parcel fail");
314         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
315         return ERR_OK;
316     }
317     int32_t userId = data.ReadInt32();
318     bool ret = IsAdminEnabled(*admin, userId);
319     reply.WriteInt32(ERR_OK);
320     reply.WriteBool(ret);
321     return ERR_OK;
322 }
323 
SetEnterpriseInfoInner(MessageParcel & data,MessageParcel & reply)324 ErrCode EnterpriseDeviceMgrStub::SetEnterpriseInfoInner(MessageParcel &data, MessageParcel &reply)
325 {
326     EDMLOGD("EnterpriseDeviceMgrStub:SetEnterpriseInfoInner");
327     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
328     if (!admin) {
329         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
330         return ERR_OK;
331     }
332     EntInfo entInfo;
333     if (!EntInfo::Unmarshalling(data, entInfo)) {
334         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
335         return ERR_OK;
336     }
337     ErrCode ret = SetEnterpriseInfo(*admin, entInfo);
338     reply.WriteInt32(ret);
339     return ERR_OK;
340 }
341 
SubscribeManagedEventInner(MessageParcel & data,MessageParcel & reply)342 ErrCode EnterpriseDeviceMgrStub::SubscribeManagedEventInner(MessageParcel &data, MessageParcel &reply)
343 {
344     EDMLOGD("EnterpriseDeviceMgrStub:SubscribeManagedEventInner");
345     return SubscribeManagedEventInner(data, reply, true);
346 }
347 
UnsubscribeManagedEventInner(MessageParcel & data,MessageParcel & reply)348 ErrCode EnterpriseDeviceMgrStub::UnsubscribeManagedEventInner(MessageParcel &data, MessageParcel &reply)
349 {
350     EDMLOGD("EnterpriseDeviceMgrStub:UnsubscribeManagedEventInner");
351     return SubscribeManagedEventInner(data, reply, false);
352 }
353 
SubscribeManagedEventInner(MessageParcel & data,MessageParcel & reply,bool subscribe)354 ErrCode EnterpriseDeviceMgrStub::SubscribeManagedEventInner(MessageParcel &data, MessageParcel &reply, bool subscribe)
355 {
356     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
357     if (!admin) {
358         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
359         return ERR_OK;
360     }
361     std::vector<uint32_t> events;
362     data.ReadUInt32Vector(&events);
363     ErrCode code;
364     if (subscribe) {
365         code = SubscribeManagedEvent(*admin, events);
366     } else {
367         code = UnsubscribeManagedEvent(*admin, events);
368     }
369     reply.WriteInt32(code);
370     return ERR_OK;
371 }
372 
AuthorizeAdminInner(MessageParcel & data,MessageParcel & reply)373 ErrCode EnterpriseDeviceMgrStub::AuthorizeAdminInner(MessageParcel &data, MessageParcel &reply)
374 {
375     EDMLOGD("EnterpriseDeviceMgrStub:AuthorizeAdminInner.");
376     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
377     if (!admin) {
378         reply.WriteInt32(EdmReturnErrCode::PARAM_ERROR);
379         return ERR_OK;
380     }
381     std::string bundleName = data.ReadString();
382     ErrCode ret = AuthorizeAdmin(*admin, bundleName);
383     reply.WriteInt32(ret);
384     return ERR_OK;
385 }
386 
GetSuperAdminInner(MessageParcel & data,MessageParcel & reply)387 ErrCode EnterpriseDeviceMgrStub::GetSuperAdminInner(MessageParcel &data, MessageParcel &reply)
388 {
389     EDMLOGD("EnterpriseDeviceMgrStub:IsSuperAdminInner");
390     ErrCode ret = GetSuperAdmin(reply);
391     reply.WriteInt32(ERR_OK);
392     reply.WriteBool(ret);
393     return ERR_OK;
394 }
395 
SetDelegatedPoliciesInner(MessageParcel & data,MessageParcel & reply)396 ErrCode EnterpriseDeviceMgrStub::SetDelegatedPoliciesInner(MessageParcel &data, MessageParcel &reply)
397 {
398     EDMLOGD("EnterpriseDeviceMgrStub:SetDelegatedPoliciesInner.");
399     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
400     if (!admin) {
401         return EdmReturnErrCode::PARAM_ERROR;
402     }
403     std::string bundleName = data.ReadString();
404     std::vector<std::string> policies;
405     data.ReadStringVector(&policies);
406     if (policies.size() > EdmConstants::POLICIES_MAX_SIZE) {
407         return EdmReturnErrCode::PARAM_ERROR;
408     }
409     return SetDelegatedPolicies(admin->GetBundleName(), bundleName, policies);
410 }
411 
GetDelegatedPoliciesInner(MessageParcel & data,MessageParcel & reply)412 ErrCode EnterpriseDeviceMgrStub::GetDelegatedPoliciesInner(MessageParcel &data, MessageParcel &reply)
413 {
414     EDMLOGD("EnterpriseDeviceMgrStub:GetDelegatedPoliciesInner.");
415     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
416     if (!admin) {
417         return EdmReturnErrCode::PARAM_ERROR;
418     }
419     std::string bundleName = data.ReadString();
420     std::vector<std::string> policies;
421     ErrCode ret = GetDelegatedPolicies(admin->GetBundleName(), bundleName, policies);
422     if (FAILED(ret)) {
423         return ret;
424     }
425     reply.WriteUint32(policies.size());
426     reply.WriteStringVector(policies);
427     return ERR_OK;
428 }
429 
GetDelegatedBundleNamesInner(MessageParcel & data,MessageParcel & reply)430 ErrCode EnterpriseDeviceMgrStub::GetDelegatedBundleNamesInner(MessageParcel &data, MessageParcel &reply)
431 {
432     EDMLOGD("EnterpriseDeviceMgrStub:GetDelegatedBundleNamesInner.");
433     std::unique_ptr<AppExecFwk::ElementName> admin(data.ReadParcelable<AppExecFwk::ElementName>());
434     if (!admin) {
435         return EdmReturnErrCode::PARAM_ERROR;
436     }
437     std::string policyName = data.ReadString();
438     std::vector<std::string> bundleNames;
439     ErrCode ret = GetDelegatedBundleNames(admin->GetBundleName(), policyName, bundleNames);
440     if (FAILED(ret)) {
441         return ret;
442     }
443     reply.WriteUint32(bundleNames.size());
444     reply.WriteStringVector(bundleNames);
445     return ERR_OK;
446 }
447 
GetAdminsInner(MessageParcel & data,MessageParcel & reply)448 ErrCode EnterpriseDeviceMgrStub::GetAdminsInner(MessageParcel &data, MessageParcel &reply)
449 {
450     EDMLOGD("EnterpriseDeviceMgrStub:GetAdminsInner");
451     std::string bundleName = data.ReadString();
452     EDMLOGD("GetAdminsInner bundleName:: %{public}s :", bundleName.c_str());
453     std::vector<std::shared_ptr<AAFwk::Want>> wants;
454     ErrCode ret = GetAdmins(wants);
455     if (FAILED(ret)) {
456         return ret;
457     }
458     reply.WriteInt32(ERR_OK);
459     reply.WriteUint32(wants.size());
460     for (std::shared_ptr<AAFwk::Want> want : wants) {
461         reply.WriteParcelable(want.get());
462     }
463     return ERR_OK;
464 }
465 } // namespace EDM
466 } // namespace OHOS