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 "quick_fix_callback_stub.h"
17
18 #include "hilog_tag_wrapper.h"
19
20 namespace OHOS {
21 namespace AppExecFwk {
QuickFixCallbackStub()22 QuickFixCallbackStub::QuickFixCallbackStub() {}
23
~QuickFixCallbackStub()24 QuickFixCallbackStub::~QuickFixCallbackStub() {}
25
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)26 int QuickFixCallbackStub::OnRemoteRequest(
27 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
28 {
29 if (data.ReadInterfaceToken() != IQuickFixCallback::GetDescriptor()) {
30 TAG_LOGE(AAFwkTag::APPMGR, "local descriptor is not equal to remote.");
31 return ERR_INVALID_STATE;
32 }
33
34 switch (code) {
35 case ON_NOTIFY_LOAD_PATCH:
36 return HandleOnLoadPatchDoneInner(data, reply);
37 case ON_NOTIFY_UNLOAD_PATCH:
38 return HandleOnUnloadPatchDoneInner(data, reply);
39 case ON_NOTIFY_RELOAD_PAGE:
40 return HandleOnReloadPageDoneInner(data, reply);
41 }
42
43 TAG_LOGW(AAFwkTag::APPMGR, "default case, need check value of code!");
44 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
45 }
46
HandleOnLoadPatchDoneInner(MessageParcel & data,MessageParcel & reply)47 int32_t QuickFixCallbackStub::HandleOnLoadPatchDoneInner(MessageParcel &data, MessageParcel &reply)
48 {
49 int32_t resultCode = data.ReadInt32();
50 int32_t recordId = data.ReadInt32();
51 OnLoadPatchDone(resultCode, recordId);
52 return ERR_OK;
53 }
54
HandleOnUnloadPatchDoneInner(MessageParcel & data,MessageParcel & reply)55 int32_t QuickFixCallbackStub::HandleOnUnloadPatchDoneInner(MessageParcel &data, MessageParcel &reply)
56 {
57 int32_t resultCode = data.ReadInt32();
58 int32_t recordId = data.ReadInt32();
59 OnUnloadPatchDone(resultCode, recordId);
60 return ERR_OK;
61 }
62
HandleOnReloadPageDoneInner(MessageParcel & data,MessageParcel & reply)63 int32_t QuickFixCallbackStub::HandleOnReloadPageDoneInner(MessageParcel &data, MessageParcel &reply)
64 {
65 int32_t resultCode = data.ReadInt32();
66 int32_t recordId = data.ReadInt32();
67 OnReloadPageDone(resultCode, recordId);
68 return ERR_OK;
69 }
70 } // namespace AAFwk
71 } // namespace OHOS
72