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_kiosk_connection.h"
17
18 #include "edm_log.h"
19 #include "enterprise_conn_manager.h"
20 #include "managed_event.h"
21
22 namespace OHOS {
23 namespace EDM {
~EnterpriseKioskConnection()24 EnterpriseKioskConnection::~EnterpriseKioskConnection() {}
25
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)26 void EnterpriseKioskConnection::OnAbilityConnectDone(
27 const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, int32_t resultCode)
28 {
29 EDMLOGI("EnterpriseKioskConnection OnAbilityConnectDone");
30 proxy_ = (new (std::nothrow) EnterpriseAdminProxy(remoteObject));
31 if (proxy_ == nullptr) {
32 EDMLOGI("EnterpriseKioskConnection get enterpriseAdminProxy failed.");
33 return;
34 }
35 switch (code_) {
36 case IEnterpriseAdmin::COMMAND_ON_KIOSK_MODE_ENTERING:
37 proxy_->OnKioskModeEntering(bundleName_, accountId_);
38 break;
39 case IEnterpriseAdmin::COMMAND_ON_KIOSK_MODE_EXITING:
40 proxy_->OnKioskModeExiting(bundleName_, accountId_);
41 break;
42 default:
43 return;
44 }
45 EDMLOGI("EnterpriseKioskConnection OnAbilityConnectDone over");
46 }
47
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)48 void EnterpriseKioskConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int32_t resultCode)
49 {
50 EDMLOGI("EnterpriseKioskConnection OnAbilityDisconnectDone");
51 }
52 } // namespace EDM
53 } // namespace OHOS
54