1 /*
2 * Copyright (C) 2021 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 "native_call_manager_utils.h"
17 #include "call_manager_base.h"
18 #include <securec.h>
19
20 namespace OHOS {
21 namespace Telephony {
22
ReadCallAttributeInfo(MessageParcel & messageParcel)23 CallAttributeInfo NativeCallManagerUtils::ReadCallAttributeInfo(MessageParcel &messageParcel)
24 {
25 CallAttributeInfo info;
26 strncpy_s(info.accountNumber, kMaxNumberLen + 1, messageParcel.ReadCString(), kMaxNumberLen + 1);
27 strncpy_s(info.bundleName, kMaxNumberLen + 1, messageParcel.ReadCString(), kMaxNumberLen + 1);
28 info.speakerphoneOn = messageParcel.ReadBool();
29 info.accountId = messageParcel.ReadInt32();
30 info.videoState = static_cast<VideoStateType>(messageParcel.ReadInt32());
31 info.startTime = messageParcel.ReadInt64();
32 info.isEcc = messageParcel.ReadBool();
33 info.callType = static_cast<CallType>(messageParcel.ReadInt32());
34 info.callId = messageParcel.ReadInt32();
35 info.callState = static_cast<TelCallState>(messageParcel.ReadInt32());
36 info.conferenceState = static_cast<TelConferenceState>(messageParcel.ReadInt32());
37 info.callBeginTime = messageParcel.ReadInt64();
38 info.callEndTime = messageParcel.ReadInt64();
39 info.ringBeginTime = messageParcel.ReadInt64();
40 info.ringEndTime = messageParcel.ReadInt64();
41 info.callDirection = static_cast<CallDirection>(messageParcel.ReadInt32());
42 info.answerType = static_cast<CallAnswerType>(messageParcel.ReadInt32());
43 info.index = messageParcel.ReadInt32();
44 info.crsType = messageParcel.ReadInt32();
45 info.originalCallType = messageParcel.ReadInt32();
46 strncpy_s(info.numberLocation, kMaxNumberLen + 1, messageParcel.ReadCString(), kMaxNumberLen + 1);
47 info.numberMarkInfo.markType = static_cast<MarkType>(messageParcel.ReadInt32());
48 strncpy_s(info.numberMarkInfo.markContent, kMaxNumberLen + 1, messageParcel.ReadCString(), kMaxNumberLen + 1);
49 info.numberMarkInfo.markCount = messageParcel.ReadInt32();
50 strncpy_s(info.numberMarkInfo.markSource, kMaxNumberLen + 1, messageParcel.ReadCString(), kMaxNumberLen + 1);
51 info.numberMarkInfo.isCloud = messageParcel.ReadBool();
52 if (info.callType == CallType::TYPE_VOIP) {
53 info.voipCallInfo.voipCallId = messageParcel.ReadString();
54 info.voipCallInfo.userName = messageParcel.ReadString();
55 info.voipCallInfo.abilityName = messageParcel.ReadString();
56 info.voipCallInfo.extensionId = messageParcel.ReadString();
57 info.voipCallInfo.voipBundleName = messageParcel.ReadString();
58 info.voipCallInfo.showBannerForIncomingCall = messageParcel.ReadBool();
59 info.voipCallInfo.isConferenceCall = messageParcel.ReadBool();
60 info.voipCallInfo.isVoiceAnswerSupported = messageParcel.ReadBool();
61 info.voipCallInfo.hasMicPermission = messageParcel.ReadBool();
62 info.voipCallInfo.uid = messageParcel.ReadInt32();
63 std::vector<uint8_t> userProfile = {};
64 messageParcel.ReadUInt8Vector(&userProfile);
65 (info.voipCallInfo.userProfile).assign(userProfile.begin(), userProfile.end());
66 }
67 return info;
68 }
69
70 } // namespace Telephony
71 } // namespace OHOS