1 /*
2 * Copyright (C) 2022 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 "accessibility_enable_ability_lists_observer_stub.h"
17 #include "accessibility_ipc_interface_code.h"
18 #include "hilog_wrapper.h"
19
20 namespace OHOS {
21 namespace Accessibility {
AccessibilityEnableAbilityListsObserverStub()22 AccessibilityEnableAbilityListsObserverStub::AccessibilityEnableAbilityListsObserverStub()
23 {
24 HILOG_DEBUG();
25 }
26
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)27 int AccessibilityEnableAbilityListsObserverStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
28 MessageParcel &reply, MessageOption &option)
29 {
30 HILOG_DEBUG("cmd = %{public}d, flags = %{public}d", code, option.GetFlags());
31 std::u16string descriptor = AccessibilityEnableAbilityListsObserverStub::GetDescriptor();
32 std::u16string remoteDescriptor = data.ReadInterfaceToken();
33 if (descriptor != remoteDescriptor) {
34 HILOG_INFO("local descriptor is not equal to remote");
35 return ERR_INVALID_STATE;
36 }
37
38 if (code == static_cast<uint32_t>(
39 AccessibilityInterfaceCode::ON_ACCESSIBILITY_ENABLE_ABILITY_LISTS_CHANGED)) {
40 return HandleOnAccessibilityEnableAbilityListsChanged(data, reply);
41 }
42 if (code == static_cast<uint32_t>(
43 AccessibilityInterfaceCode::ON_ACCESSIBILITY_INSTALL_ABILITY_LISTS_CHANGED)) {
44 return HandleOnAccessibilityInstallAbilityListsChanged(data, reply);
45 }
46 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
47 }
48
HandleOnAccessibilityEnableAbilityListsChanged(MessageParcel & data,MessageParcel & reply)49 ErrCode AccessibilityEnableAbilityListsObserverStub::HandleOnAccessibilityEnableAbilityListsChanged(
50 MessageParcel &data, MessageParcel &reply)
51 {
52 HILOG_DEBUG();
53 OnAccessibilityEnableAbilityListsChanged();
54 return NO_ERROR;
55 }
56
HandleOnAccessibilityInstallAbilityListsChanged(MessageParcel & data,MessageParcel & reply)57 ErrCode AccessibilityEnableAbilityListsObserverStub::HandleOnAccessibilityInstallAbilityListsChanged(
58 MessageParcel &data, MessageParcel &reply)
59 {
60 HILOG_DEBUG();
61 OnAccessibilityInstallAbilityListsChanged();
62 return NO_ERROR;
63 }
64 } // namespace Accessibility
65 } // namespace OHOS