• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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         case static_cast<uint32_t>(ManagedEvent::APP_START):
42             proxy_->OnAppStart(bundleName_);
43             break;
44         case static_cast<uint32_t>(ManagedEvent::APP_STOP):
45             proxy_->OnAppStop(bundleName_);
46             break;
47         default:
48             return;
49     }
50     HILOG_INFO("EnterpriseBundleConnection OnAbilityConnectDone over");
51 }
52 
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)53 void EnterpriseBundleConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int32_t resultCode)
54 {
55     HILOG_INFO("EnterpriseBundleConnection OnAbilityDisconnectDone");
56 }
57 }  // namespace EDM
58 }  // namespace OHOS
59