• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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_account_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 {
~EnterpriseAccountConnection()24 EnterpriseAccountConnection::~EnterpriseAccountConnection() {}
25 
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)26 void EnterpriseAccountConnection::OnAbilityConnectDone(
27     const AppExecFwk::ElementName& element, const sptr<IRemoteObject>& remoteObject, int32_t resultCode)
28 {
29     EDMLOGI("EnterpriseAccountConnection OnAbilityConnectDone");
30     proxy_ = (new (std::nothrow) EnterpriseAdminProxy(remoteObject));
31     if (proxy_ == nullptr) {
32         EDMLOGI("EnterpriseAccountConnection get enterpriseAdminProxy failed.");
33         return;
34     }
35     switch (code_) {
36         case static_cast<uint32_t>(ManagedEvent::USER_ADDED):
37             proxy_->OnAccountAdded(accountId_);
38             break;
39         case static_cast<uint32_t>(ManagedEvent::USER_SWITCHED):
40             proxy_->OnAccountSwitched(accountId_);
41             break;
42         case static_cast<uint32_t>(ManagedEvent::USER_REMOVED):
43             proxy_->OnAccountRemoved(accountId_);
44             break;
45         default:
46             return;
47     }
48     EDMLOGI("EnterpriseAccountConnection OnAbilityConnectDone over");
49 }
50 
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)51 void EnterpriseAccountConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName& element, int32_t resultCode)
52 {
53     EDMLOGI("EnterpriseAccountConnection OnAbilityDisconnectDone");
54 }
55 }  // namespace EDM
56 }  // namespace OHOS
57