1/*
2 * Copyright (C) 2024 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 "call_ability_connection.h"
17
18#include "telephony_log_wrapper.h"
19
20namespace OHOS {
21namespace Telephony {
22constexpr int32_t PARAM_NUM = 3;
23
24void CallAbilityConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element,
25    const sptr<IRemoteObject> &remoteObject, int32_t resultCode)
26{
27    TELEPHONY_LOGW("OnAbilityConnectDone, resultCode = %{public}d", resultCode);
28    if (remoteObject == nullptr) {
29        TELEPHONY_LOGE("remote object is nullptr");
30        return;
31    }
32    MessageParcel data;
33    MessageParcel reply;
34    MessageOption option;
35    data.WriteInt32(PARAM_NUM);
36    data.WriteString16(u"bundleName");
37    data.WriteString16(u"com.ohos.callui");
38    data.WriteString16(u"abilityName");
39    data.WriteString16(u"com.ohos.callui.CallFailedDialogAbility");
40    data.WriteString16(u"parameters");
41    data.WriteString16(Str8ToStr16(commandStr_));
42    int32_t sendRequestRet = remoteObject->SendRequest(AAFwk::IAbilityConnection::ON_ABILITY_CONNECT_DONE,
43        data, reply, option);
44    TELEPHONY_LOGI("OnAbilityConnectDone, sendRequestRet = %{public}d", sendRequestRet);
45}
46
47void CallAbilityConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
48    int32_t resultCode)
49{
50    TELEPHONY_LOGW("OnAbilityDisconnectDone, resultCode = %{public}d", resultCode);
51}
52} // namespace Telephony
53} // namespace OHOS