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 "hilog_wrapper.h"
18
19 namespace OHOS {
20 namespace Accessibility {
AccessibilityEnableAbilityListsObserverStub()21 AccessibilityEnableAbilityListsObserverStub::AccessibilityEnableAbilityListsObserverStub()
22 {
23 HILOG_DEBUG();
24 }
25
OnRemoteRequest(uint32_t code,MessageParcel & data,MessageParcel & reply,MessageOption & option)26 int AccessibilityEnableAbilityListsObserverStub::OnRemoteRequest(uint32_t code, MessageParcel &data,
27 MessageParcel &reply, MessageOption &option)
28 {
29 HILOG_DEBUG("cmd = %{public}d, flags = %{public}d", code, option.GetFlags());
30 std::u16string descriptor = AccessibilityEnableAbilityListsObserverStub::GetDescriptor();
31 std::u16string remoteDescriptor = data.ReadInterfaceToken();
32 if (descriptor != remoteDescriptor) {
33 HILOG_INFO("local descriptor is not equal to remote");
34 return ERR_INVALID_STATE;
35 }
36
37 if (code == static_cast<uint32_t>(
38 IAccessibilityEnableAbilityListsObserver::Message::ON_ACCESSIBILITY_ENABLE_ABILITY_LISTS_CHANGED)) {
39 return HandleOnAccessibilityEnableAbilityListsChanged(data, reply);
40 }
41 return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
42 }
43
HandleOnAccessibilityEnableAbilityListsChanged(MessageParcel & data,MessageParcel & reply)44 ErrCode AccessibilityEnableAbilityListsObserverStub::HandleOnAccessibilityEnableAbilityListsChanged(
45 MessageParcel &data, MessageParcel &reply)
46 {
47 HILOG_DEBUG();
48 OnAccessibilityEnableAbilityListsChanged();
49 return NO_ERROR;
50 }
51 } // namespace Accessibility
52 } // namespace OHOS