1 /*
2 * Copyright (c) 2022 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_bundle_connection.h"
17 #include "enterprise_conn_manager.h"
18 #include "managed_event.h"
19 #include "hilog_wrapper.h"
20
21 namespace OHOS {
22 namespace EDM {
~EnterpriseBundleConnection()23 EnterpriseBundleConnection::~EnterpriseBundleConnection() {}
24
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)25 void EnterpriseBundleConnection::OnAbilityConnectDone(
26 const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, int32_t resultCode)
27 {
28 HILOG_INFO("EnterpriseBundleConnection OnAbilityConnectDone");
29 proxy_ = (new (std::nothrow) EnterpriseAdminProxy(remoteObject));
30 if (proxy_ == nullptr) {
31 HILOG_INFO("EnterpriseBundleConnection get enterpriseAdminProxy failed.");
32 return;
33 }
34 switch (code_) {
35 case static_cast<uint32_t>(ManagedEvent::BUNDLE_ADDED):
36 proxy_->OnBundleAdded(bundleName_);
37 break;
38 case static_cast<uint32_t>(ManagedEvent::BUNDLE_REMOVED):
39 proxy_->OnBundleRemoved(bundleName_);
40 break;
41 default:
42 return;
43 }
44 HILOG_INFO("EnterpriseBundleConnection OnAbilityConnectDone over");
45 }
46
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)47 void EnterpriseBundleConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int32_t resultCode)
48 {
49 HILOG_INFO("EnterpriseBundleConnection OnAbilityDisconnectDone");
50 }
51 } // namespace EDM
52 } // namespace OHOS
53