1 /*
2 * Copyright (c) 2021-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 #include "reverse_continuation_scheduler_replica_stub.h"
16
17 #include "hilog_tag_wrapper.h"
18
19 namespace OHOS {
20 namespace AppExecFwk {
ReverseContinuationSchedulerReplicaStub()21 ReverseContinuationSchedulerReplicaStub::ReverseContinuationSchedulerReplicaStub() {}
22
~ReverseContinuationSchedulerReplicaStub()23 ReverseContinuationSchedulerReplicaStub::~ReverseContinuationSchedulerReplicaStub() {}
24
PassPrimaryInner(MessageParcel & data,MessageParcel & reply)25 int32_t ReverseContinuationSchedulerReplicaStub::PassPrimaryInner(MessageParcel &data, MessageParcel &reply)
26 {
27 sptr<IRemoteObject> primary = nullptr;
28 if (data.ReadBool()) {
29 primary = data.ReadRemoteObject();
30 }
31 PassPrimary(primary);
32 return NO_ERROR;
33 }
ReverseContinuationInner(MessageParcel & data,MessageParcel & reply)34 int32_t ReverseContinuationSchedulerReplicaStub::ReverseContinuationInner(MessageParcel &data, MessageParcel &reply)
35 {
36 ReverseContinuation();
37 return NO_ERROR;
38 }
NotifyReverseResultInner(MessageParcel & data,MessageParcel & reply)39 int32_t ReverseContinuationSchedulerReplicaStub::NotifyReverseResultInner(MessageParcel &data, MessageParcel &reply)
40 {
41 int reverseResult = data.ReadInt32();
42 NotifyReverseResult(reverseResult);
43 return NO_ERROR;
44 }
45
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)46 int ReverseContinuationSchedulerReplicaStub::OnRemoteRequest(
47 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
48 {
49 std::u16string remoteDescriptor = data.ReadInterfaceToken();
50 if (remoteDescriptor != ReverseContinuationSchedulerReplicaStub::GetDescriptor()) {
51 TAG_LOGE(AAFwkTag::CONTINUATION, "token is invalid");
52 return ERR_INVALID_STATE;
53 }
54 switch (code) {
55 case static_cast<uint32_t>(IReverseContinuationSchedulerReplica::Message::PASS_PRIMARY):
56 return PassPrimaryInner(data, reply);
57 case static_cast<uint32_t>(IReverseContinuationSchedulerReplica::Message::REVERSE_CONTINUATION):
58 return ReverseContinuationInner(data, reply);
59 case static_cast<uint32_t>(IReverseContinuationSchedulerReplica::Message::NOTIFY_REVERSE_RESULT):
60 return NotifyReverseResultInner(data, reply);
61 }
62 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
63 }
64 } // namespace AppExecFwk
65 } // namespace OHOS
66