• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright (C) 2025 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 <array>
17 #include <iostream>
18 #include "ani_accessibility_config.h"
19 #include "accessibility_utils_ani.h"
20 #include "hilog_wrapper.h"
21 
22 using namespace OHOS::Accessibility;
23 using namespace OHOS::AccessibilityAni;
24 
SetHighContrastText(ani_env * env,ani_object object,ani_boolean state)25 void ANIAccessibilityConfig::SetHighContrastText(ani_env *env, ani_object object, ani_boolean state)
26 {
27     auto &instance = OHOS::AccessibilityConfig::AccessibilityConfig::GetInstance();
28     auto ret = instance.SetHighContrastTextState(state);
29     if (ret != RET_OK) {
30         ThrowBusinessError(env, QueryRetMsg(ret));
31     }
32     HILOG_INFO("SetHighContrastText ret = %{public}d", static_cast<int32_t>(ret));
33     return;
34 }
35 
GetHighContrastText(ani_env * env,ani_object object)36 ani_boolean ANIAccessibilityConfig::GetHighContrastText(ani_env *env, ani_object object)
37 {
38     auto &instance = OHOS::AccessibilityConfig::AccessibilityConfig::GetInstance();
39     bool state = false;
40     auto ret = instance.GetHighContrastTextState(state);
41     if (ret != RET_OK) {
42         ThrowBusinessError(env, QueryRetMsg(ret));
43     }
44     HILOG_INFO("GetHighContrastText ret = %{public}d", static_cast<int32_t>(ret));
45     return static_cast<ani_boolean>(state);
46 }