• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "ability_manager_errors.h"
17 #include "prepare_terminate_callback_proxy.h"
18 #include "hilog_wrapper.h"
19 #include "iremote_object.h"
20 #include "message_parcel.h"
21 #include "peer_holder.h"
22 #include "want_params.h"
23 
24 namespace OHOS {
25 namespace AAFwk {
DoPrepareTerminate()26 void PrepareTerminateCallbackProxy::DoPrepareTerminate()
27 {
28     HILOG_DEBUG("call");
29     MessageParcel data;
30     if (!data.WriteInterfaceToken(IPrepareTerminateCallback::GetDescriptor())) {
31         HILOG_ERROR("Write interface token failed.");
32         return;
33     }
34     MessageParcel reply;
35     MessageOption option(MessageOption::TF_SYNC);
36     sptr<IRemoteObject> remote = Remote();
37     if (remote == nullptr) {
38         HILOG_ERROR("Remote() is NULL");
39         return;
40     }
41     int error = remote->SendRequest(ON_DO_PREPARE_TERMINATE, data, reply, option);
42     if (error != ERR_OK) {
43         HILOG_ERROR("SendRequest fail, error: %{public}d", error);
44     }
45 }
46 }
47 }
48