同步操作将从 OpenHarmony/inputmethod_imf 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
/** Copyright (c) 2022-2022 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/#include "inputmethod_dump.h"#include <cstdint>#include <functional>#include <list>#include <string>#include <vector>#include "global.h"namespace OHOS {namespace MiscServices {constexpr int32_t MAX_RECORD_ERROR = 10;constexpr int32_t SUB_CMD_NAME = 0;constexpr int32_t CMD_ONE_PARAM = 1;constexpr const char *CMD_HELP = "-h";constexpr const char *CMD_ALL_DUMP = "-a";static const std::string ILLEGAL_INFO = "input dump parameter error,enter '-h' for usage.\n";void InputmethodDump::AddDumpAllMethod(const DumpNoParamFunc dumpAllMethod){if (dumpAllMethod == nullptr) {return;}dumpAllMethod_ = dumpAllMethod;}void InputmethodDump::AddErrorInfo(const std::string &error){std::lock_guard<std::mutex> lock(hidumperMutex_);if (errorInfo_.size() + 1 > MAX_RECORD_ERROR) {errorInfo_.pop_front();errorInfo_.push_back(error);} else {errorInfo_.push_back(error);}}bool InputmethodDump::Dump(int fd, const std::vector<std::string> &args){IMSA_HILOGI("InputmethodDump::Dump start.");std::string command = "";if (args.size() == CMD_ONE_PARAM) {command = args.at(SUB_CMD_NAME);} else {ShowIllealInformation(fd);}if (command == CMD_HELP) {ShowHelp(fd);} else if (command == CMD_ALL_DUMP) {if (!dumpAllMethod_) {return false;}dumpAllMethod_(fd);} else {ShowIllealInformation(fd);}IMSA_HILOGI("InputmethodDump::Dump command=%{public}s.", command.c_str());return true;}void InputmethodDump::ShowHelp(int fd){std::string result;result.append("Usage:dump <command> [options]\n").append("Description:\n").append("-h show help\n").append("-a dump all input methods\n");dprintf(fd, "%s\n", result.c_str());}void InputmethodDump::ShowIllealInformation(int fd){dprintf(fd, "%s\n", ILLEGAL_INFO.c_str());}} // namespace MiscServices} // namespace OHOS
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。