1 /*
2  * Copyright (c) 2022-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 "mission_continue_stub.h"
17 
18 #include "hilog_tag_wrapper.h"
19 #include "ipc_types.h"
20 #include "message_parcel.h"
21 #include "want.h"
22 
23 namespace OHOS {
24 namespace AAFwk {
MissionContinueStub()25 MissionContinueStub::MissionContinueStub()
26 {}
27 
~MissionContinueStub()28 MissionContinueStub::~MissionContinueStub()
29 {}
30 
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)31 int32_t MissionContinueStub::OnRemoteRequest(
32     uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option)
33 {
34     if (data.ReadInterfaceToken() != GetDescriptor()) {
35         TAG_LOGE(AAFwkTag::MISSION, "invalid descriptor");
36         return ERR_INVALID_STATE;
37     }
38 
39     switch (code) {
40         case IMissionContinue::NOTIFY_CONTINUATION_RESULT: {
41             int32_t result = data.ReadInt32();
42             TAG_LOGI(AAFwkTag::MISSION, "NOTIFY_CONTINUATION_RESULT result: %{public}d", result);
43             OnContinueDone(result);
44             return NO_ERROR;
45         }
46         default: {
47             TAG_LOGW(AAFwkTag::MISSION, "code: %{public}d", code);
48             return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
49         }
50     }
51 }
52 } // namespace AAFwk
53 } // namespace OHOS
54