1eace7efcSopenharmony_ci/* 2eace7efcSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 3eace7efcSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4eace7efcSopenharmony_ci * you may not use this file except in compliance with the License. 5eace7efcSopenharmony_ci * You may obtain a copy of the License at 6eace7efcSopenharmony_ci * 7eace7efcSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8eace7efcSopenharmony_ci * 9eace7efcSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10eace7efcSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11eace7efcSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12eace7efcSopenharmony_ci * See the License for the specific language governing permissions and 13eace7efcSopenharmony_ci * limitations under the License. 14eace7efcSopenharmony_ci */ 15eace7efcSopenharmony_ci 16eace7efcSopenharmony_ci#ifndef OHOS_ABILITY_RUNTIME_ACCESSIBILITY_ABILITY_COMMAND_H 17eace7efcSopenharmony_ci#define OHOS_ABILITY_RUNTIME_ACCESSIBILITY_ABILITY_COMMAND_H 18eace7efcSopenharmony_ci 19eace7efcSopenharmony_ci#include "ability_command.h" 20eace7efcSopenharmony_ci#include "ability_manager_interface.h" 21eace7efcSopenharmony_ci#include "accessibility_ability_info.h" 22eace7efcSopenharmony_ci#include "accessibility_system_ability_client.h" 23eace7efcSopenharmony_ci#include "shell_command.h" 24eace7efcSopenharmony_ci 25eace7efcSopenharmony_cinamespace OHOS { 26eace7efcSopenharmony_cinamespace AAFwk { 27eace7efcSopenharmony_cistruct AccessibilityCommandArgument { 28eace7efcSopenharmony_ci int32_t bundleArgumentNum = 0; 29eace7efcSopenharmony_ci int32_t abilityArgumentNum = 0; 30eace7efcSopenharmony_ci int32_t capabilityNamesArgumentNum = 0; 31eace7efcSopenharmony_ci int32_t unknownArgumentNum = 0; 32eace7efcSopenharmony_ci int32_t setArgumentNum = 0; 33eace7efcSopenharmony_ci std::vector<std::string> unknownArguments; 34eace7efcSopenharmony_ci std::string command = ""; 35eace7efcSopenharmony_ci std::string bundleName = ""; 36eace7efcSopenharmony_ci std::string abilityName = ""; 37eace7efcSopenharmony_ci std::string capabilityNames = ""; 38eace7efcSopenharmony_ci std::string value = ""; 39eace7efcSopenharmony_ci}; 40eace7efcSopenharmony_ci 41eace7efcSopenharmony_ciclass AccessibilityAbilityShellCommand : public ShellCommand { 42eace7efcSopenharmony_cipublic: 43eace7efcSopenharmony_ci AccessibilityAbilityShellCommand(int argc, char* argv[]); 44eace7efcSopenharmony_ci ~AccessibilityAbilityShellCommand() override 45eace7efcSopenharmony_ci {} 46eace7efcSopenharmony_ci 47eace7efcSopenharmony_ciprivate: 48eace7efcSopenharmony_ci ErrCode CreateCommandMap() override; 49eace7efcSopenharmony_ci ErrCode init() override; 50eace7efcSopenharmony_ci ErrCode CreateMessageMap() override; 51eace7efcSopenharmony_ci ErrCode RunAsHelpCommand(); 52eace7efcSopenharmony_ci ErrCode RunAsEnableAbility(); 53eace7efcSopenharmony_ci ErrCode RunAsDisableAbility(); 54eace7efcSopenharmony_ci ErrCode RunAsGetEnabledAbilities(); 55eace7efcSopenharmony_ci ErrCode RunAsGetInstalledAbilities(); 56eace7efcSopenharmony_ci 57eace7efcSopenharmony_ci ErrCode MakeEnableCommandArgumentFromCmd(AccessibilityCommandArgument& argument); 58eace7efcSopenharmony_ci void CheckEnableCommandOption(const int option, AccessibilityCommandArgument& argument); 59eace7efcSopenharmony_ci ErrCode MakeDisableCommandArgumentFromCmd(AccessibilityCommandArgument& argument); 60eace7efcSopenharmony_ci const std::vector<std::string> GetEnabledAbilities(); 61eace7efcSopenharmony_ci const std::vector<Accessibility::AccessibilityAbilityInfo> GetInstalledAbilities(); 62eace7efcSopenharmony_ci bool CheckBundleArgument( 63eace7efcSopenharmony_ci const AccessibilityCommandArgument& argument, 64eace7efcSopenharmony_ci std::string& resultMessage); 65eace7efcSopenharmony_ci bool CheckAbilityArgument( 66eace7efcSopenharmony_ci const AccessibilityCommandArgument& argument, 67eace7efcSopenharmony_ci std::string& resultMessage); 68eace7efcSopenharmony_ci bool CheckCapabilitiesArgument( 69eace7efcSopenharmony_ci const AccessibilityCommandArgument& argument, 70eace7efcSopenharmony_ci std::vector<Accessibility::AccessibilityAbilityInfo>& installedAbilities, 71eace7efcSopenharmony_ci std::string& resultMessage); 72eace7efcSopenharmony_ci bool CheckParamValidity( 73eace7efcSopenharmony_ci const AccessibilityCommandArgument& argument, 74eace7efcSopenharmony_ci std::vector<Accessibility::AccessibilityAbilityInfo>& installedAbilities, 75eace7efcSopenharmony_ci std::string& resultMessage); 76eace7efcSopenharmony_ci ErrCode CheckEnableCommandArgument(const AccessibilityCommandArgument& argument, std::string& resultMessage); 77eace7efcSopenharmony_ci ErrCode CheckDisableCommandArgument(const AccessibilityCommandArgument& argument, std::string& resultMessage); 78eace7efcSopenharmony_ci ErrCode CheckCommandArgument(const AccessibilityCommandArgument& argument, std::string& resultMessage); 79eace7efcSopenharmony_ci ErrCode CheckSetCommandArgument(const AccessibilityCommandArgument& argument, std::string& resultMessage); 80eace7efcSopenharmony_ci 81eace7efcSopenharmony_ci ErrCode RunAsSetScreenMagnificationState(); 82eace7efcSopenharmony_ci ErrCode RunAsSetShortKeyState(); 83eace7efcSopenharmony_ci ErrCode RunAsSetMouseKeyState(); 84eace7efcSopenharmony_ci ErrCode RunAsSetCaptionState(); 85eace7efcSopenharmony_ci ErrCode RunAsSetMouseAutoClick(); 86eace7efcSopenharmony_ci ErrCode RunAsSetShortKeyTarget(); 87eace7efcSopenharmony_ci ErrCode RunAsSetHighContrastTextState(); 88eace7efcSopenharmony_ci ErrCode RunAsSetInvertColorState(); 89eace7efcSopenharmony_ci ErrCode RunAsSetDaltonizationColorFilter(); 90eace7efcSopenharmony_ci ErrCode RunAsSetContentTimeout(); 91eace7efcSopenharmony_ci ErrCode RunAsSetAnimationOffState(); 92eace7efcSopenharmony_ci ErrCode RunAsSetBrightnessDiscount(); 93eace7efcSopenharmony_ci ErrCode RunAsSetAudioMonoState(); 94eace7efcSopenharmony_ci ErrCode RunAsSetAudioBalance(); 95eace7efcSopenharmony_ci ErrCode MakeSetShortKeyTargetCommandArgumentFromCmd(AccessibilityCommandArgument& argument); 96eace7efcSopenharmony_ci ErrCode MakeSetCommandArgumentFromCmd(AccessibilityCommandArgument& argument); 97eace7efcSopenharmony_ci ErrCode MakeCommandArgumentFromCmd(AccessibilityCommandArgument& argument); 98eace7efcSopenharmony_ci void SetArgument(int option, AccessibilityCommandArgument& argument); 99eace7efcSopenharmony_ci 100eace7efcSopenharmony_ci std::shared_ptr<Accessibility::AccessibilitySystemAbilityClient> abilityClientPtr_ = nullptr; 101eace7efcSopenharmony_ci}; 102eace7efcSopenharmony_ci} // namespace AAFwk 103eace7efcSopenharmony_ci} // namespace OHOS 104eace7efcSopenharmony_ci 105eace7efcSopenharmony_ci#endif // OHOS_ABILITY_RUNTIME_ACCESSIBILITY_ABILITY_COMMAND_H 106