1 /*
2  * Copyright (c) 2022-2023 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_admin_stub_impl.h"
17 #include "edm_log.h"
18 
19 namespace OHOS {
20 namespace EDM {
OnAdminEnabled()21 void EnterpriseAdminStubImpl::OnAdminEnabled()
22 {
23     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
24     auto extension = extension_.lock();
25     if (extension != nullptr) {
26         extension->OnAdminEnabled();
27         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
28     }
29 }
30 
OnAdminDisabled()31 void EnterpriseAdminStubImpl::OnAdminDisabled()
32 {
33     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
34     auto extension = extension_.lock();
35     if (extension != nullptr) {
36         extension->OnAdminDisabled();
37         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
38     }
39 }
40 
OnBundleAdded(const std::string & bundleName,int32_t accountId)41 void EnterpriseAdminStubImpl::OnBundleAdded(const std::string &bundleName, int32_t accountId)
42 {
43     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
44     auto extension = extension_.lock();
45     if (extension != nullptr) {
46         extension->OnBundleAdded(bundleName, accountId);
47         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
48     }
49 }
50 
OnBundleRemoved(const std::string & bundleName,int32_t accountId)51 void EnterpriseAdminStubImpl::OnBundleRemoved(const std::string &bundleName, int32_t accountId)
52 {
53     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
54     auto extension = extension_.lock();
55     if (extension != nullptr) {
56         extension->OnBundleRemoved(bundleName, accountId);
57         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
58     }
59 }
60 
OnAppStart(const std::string & bundleName)61 void EnterpriseAdminStubImpl::OnAppStart(const std::string &bundleName)
62 {
63     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
64     auto extension = extension_.lock();
65     if (extension != nullptr) {
66         extension->OnAppStart(bundleName);
67         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
68     }
69 }
70 
OnAppStop(const std::string & bundleName)71 void EnterpriseAdminStubImpl::OnAppStop(const std::string &bundleName)
72 {
73     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
74     auto extension = extension_.lock();
75     if (extension != nullptr) {
76         extension->OnAppStop(bundleName);
77         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
78     }
79 }
80 
OnSystemUpdate(const UpdateInfo & updateInfo)81 void EnterpriseAdminStubImpl::OnSystemUpdate(const UpdateInfo &updateInfo)
82 {
83     EDMLOGI("EnterpriseAdminStubImpl %{public}s begin.", __func__);
84     auto extension = extension_.lock();
85     if (extension != nullptr) {
86         extension->OnSystemUpdate(updateInfo);
87         EDMLOGD("EnterpriseAdminStubImpl %{public}s end successfully.", __func__);
88     }
89 }
90 } // namespace EDM
91 } // namespace OHOS