• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 
2 /*
3  * Copyright (c) 2021 Huawei Device Co., Ltd.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "appexecfwk_errors.h"
18 #include "form_batch_delete_connection.h"
19 #include "form_constants.h"
20 #include "form_supply_callback.h"
21 #include "form_task_mgr.h"
22 #include "form_util.h"
23 #include "hilog_wrapper.h"
24 #include "ipc_types.h"
25 #include "message_parcel.h"
26 #include "want.h"
27 
28 namespace OHOS {
29 namespace AppExecFwk {
FormBatchDeleteConnection(const std::set<int64_t> & formIds,const std::string & bundleName,const std::string & abilityName)30 FormBatchDeleteConnection::FormBatchDeleteConnection(const std::set<int64_t> &formIds,
31     const std::string &bundleName, const std::string &abilityName)
32     :formIds_(formIds)
33 {
34     SetProviderKey(bundleName, abilityName);
35 }
36 /**
37  * @brief OnAbilityConnectDone, AbilityMs notify caller ability the result of connect.
38  * @param element service ability's ElementName.
39  * @param remoteObject the session proxy of service ability.
40  * @param resultCode ERR_OK on success, others on failure.
41  */
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int resultCode)42 void FormBatchDeleteConnection::OnAbilityConnectDone(
43     const AppExecFwk::ElementName &element, const sptr<IRemoteObject> &remoteObject, int resultCode)
44 {
45     HILOG_INFO("%{public}s called.", __func__);
46     if (resultCode != ERR_OK) {
47         HILOG_ERROR("%{public}s, abilityName:%{public}s, resultCode:%{public}d",
48             __func__, element.GetAbilityName().c_str(), resultCode);
49         return;
50     }
51     FormSupplyCallback::GetInstance()->AddConnection(this);
52     Want want;
53     want.SetParam(Constants::FORM_CONNECT_ID, this->GetConnectId());
54     FormTaskMgr::GetInstance().PostProviderBatchDeleteTask(formIds_, want, remoteObject);
55 }
56 }  // namespace AppExecFwk
57 }  // namespace OHOS