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 "spam_call_connection.h"
17
18 #include "telephony_log_wrapper.h"
19 #include "spam_call_proxy.h"
20
21 namespace OHOS {
22 namespace Telephony {
23 constexpr int32_t PARAM_NUM = 3;
24
OnAbilityConnectDone(const AppExecFwk::ElementName & element,const sptr<IRemoteObject> & remoteObject,int32_t resultCode)25 void SpamCallConnection::OnAbilityConnectDone(const AppExecFwk::ElementName &element,
26 const sptr<IRemoteObject> &remoteObject, int32_t resultCode)
27 {
28 TELEPHONY_LOGI("OnAbilityConnectDone, resultCode = %{public}d", resultCode);
29 if (remoteObject == nullptr) {
30 TELEPHONY_LOGE("Connected service is invalid!");
31 return;
32 }
33 SpamCallProxy service(remoteObject);
34 int32_t ret = service.DetectSpamCall(phoneNumber_, slotId_, spamCallAdapter_);
35 TELEPHONY_LOGI("OnAbilityConnectDone, DetectSpamCall ret = %{public}d", ret);
36 }
37
OnAbilityDisconnectDone(const AppExecFwk::ElementName & element,int32_t resultCode)38 void SpamCallConnection::OnAbilityDisconnectDone(const AppExecFwk::ElementName &element,
39 int32_t resultCode)
40 {
41 TELEPHONY_LOGI("OnAbilityDisconnectDone, resultCode = %{public}d", resultCode);
42 }
43 } // namespace Telephony
44 } // namespace OHOS
45