mirror of
https://github.com/openharmony/distributedschedule_samgr.git
synced 2026-07-20 22:47:20 -04:00
ef4a1f8cdc
Signed-off-by: chen <chenkang40@huawei.com> Change-Id: Ib586531fa848329cb83265b5aed3626b8dcbd970
51 lines
2.2 KiB
C++
51 lines
2.2 KiB
C++
/*
|
|
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include "rpc_callback_imp.h"
|
|
#include "system_ability_manager.h"
|
|
#include "sam_log.h"
|
|
#include "tools.h"
|
|
|
|
namespace OHOS {
|
|
sptr<IRemoteObject> RpcCallbackImp::GetSystemAbilityFromRemote(int32_t systemAbilityId)
|
|
{
|
|
return SystemAbilityManager::GetInstance()->GetSystemAbilityFromRemote(systemAbilityId);
|
|
}
|
|
|
|
bool RpcCallbackImp::LoadSystemAbilityFromRemote(const std::string& srcNetworkId, int32_t systemAbilityId)
|
|
{
|
|
HILOGI("LoadSystemAbilityFromRemote! deviceId : %{public}s, said : %{public}d",
|
|
AnonymizeDeviceId(srcNetworkId).c_str(), systemAbilityId);
|
|
sptr<LoadCallbackImp> loadCallback = new LoadCallbackImp(srcNetworkId);
|
|
return SystemAbilityManager::GetInstance()->LoadSystemAbilityFromRpc(srcNetworkId,
|
|
systemAbilityId, loadCallback);
|
|
}
|
|
|
|
void RpcCallbackImp::LoadCallbackImp::OnLoadSystemAbilitySuccess(int32_t systemAbilityId,
|
|
const sptr<IRemoteObject>& remoteObject)
|
|
{
|
|
HILOGI("LoadCallbackImp OnLoadSystemAbilitySuccess! deviceId : %{public}s, said : %{public}d",
|
|
AnonymizeDeviceId(srcNetWorkId_).c_str(), systemAbilityId);
|
|
SystemAbilityManager::GetInstance()->NotifyRpcLoadCompleted(srcNetWorkId_, systemAbilityId, remoteObject);
|
|
}
|
|
|
|
void RpcCallbackImp::LoadCallbackImp::OnLoadSystemAbilityFail(int32_t systemAbilityId)
|
|
{
|
|
HILOGW("LoadCallbackImp OnLoadSystemAbilityFail! deviceId : %{public}s, said : %{public}d",
|
|
AnonymizeDeviceId(srcNetWorkId_).c_str(), systemAbilityId);
|
|
SystemAbilityManager::GetInstance()->NotifyRpcLoadCompleted(srcNetWorkId_, systemAbilityId, nullptr);
|
|
}
|
|
}
|