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 "module_external/inner_receiver_impl.h"
17
18 #include "b_error/b_error.h"
19 #include "filemgmt_libhilog.h"
20 #include "module_ipc/svc_session_manager.h"
21 #include "module_sched/sched_scheduler.h"
22 #include "module_ipc/service.h"
23
24 namespace OHOS::FileManagement::Backup {
OnStatusNotify(const int progress)25 void InnerReceiverImpl::OnStatusNotify(const int progress)
26 {
27 HILOGI("OnStatusNotify %{public}d", progress);
28 }
OnFinished(const int32_t resultCode,const std::string & resultMsg)29 void InnerReceiverImpl::OnFinished(const int32_t resultCode, const std::string &resultMsg)
30 {
31 HILOGI("Finished to install %{public}s, resultCode = %{public}d resultMsg = %{public}s", bundleName_.c_str(),
32 resultCode, resultMsg.c_str());
33
34 auto sched = sched_.promote();
35 if (sched == nullptr) {
36 throw BError(BError::Codes::SA_INVAL_ARG, std::string("Failed to promote bundleContext"));
37 }
38 sched->InstallSuccess(bundleName_, resultCode);
39 }
GetBundleName()40 std::string InnerReceiverImpl::GetBundleName()
41 {
42 return bundleName_;
43 }
44 } // namespace OHOS::FileManagement::Backup