mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-18 17:24:37 -04:00
Signed-off-by: GlaryCastle <yangpeng190@huawei.com>
Changes to be committed: modified: services/dfx/include/inputmethod_dump.h modified: services/dfx/include/inputmethod_sysevent.h modified: services/dfx/include/inputmethod_trace.h modified: services/dfx/src/inputmethod_dump.cpp modified: services/dfx/src/inputmethod_sysevent.cpp modified: services/dfx/src/inputmethod_trace.cpp modified: services/include/input_method_system_ability.h modified: services/src/input_method_system_ability.cpp
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2022 Huawei Device Co., Ltd.
|
||||
* 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
|
||||
|
||||
@@ -56,6 +56,7 @@ namespace MiscServices {
|
||||
int32_t listInputMethod(std::vector<InputMethodProperty*> *properties) override;
|
||||
int32_t listInputMethodByUserId(int32_t userId, std::vector<InputMethodProperty*> *properties) override;
|
||||
int32_t listKeyboardType(const std::u16string& imeId, std::vector<KeyboardType*> *types) override;
|
||||
void GetInputMethodParam(std::vector<InputMethodProperty *> properties_, std::string ¶ms_);
|
||||
int Dump(int fd, const std::vector<std::u16string> &args) override;
|
||||
void DumpAllMethod(int fd);
|
||||
|
||||
|
||||
@@ -139,6 +139,30 @@ namespace MiscServices {
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
void InputMethodSystemAbility::GetInputMethodParam(
|
||||
std::vector<InputMethodProperty *> properties_, std::string ¶ms_)
|
||||
{
|
||||
std::string defaultIme = ParaHandle::GetDefaultIme(userId_);
|
||||
std::vector<InputMethodProperty *>::iterator it;
|
||||
for (it = properties_.begin(); it < properties_.end(); ++it) {
|
||||
if (it == properties_.begin()) {
|
||||
params_ += "{\"imeList\":[";
|
||||
} else {
|
||||
params_ += "},";
|
||||
}
|
||||
InputMethodProperty *property = (InputMethodProperty *)*it;
|
||||
std::string imeId = Str16ToStr8(property->mPackageName) + "/" + Str16ToStr8(property->mAbilityName);
|
||||
params_ += "{\"ime\": \"" + imeId + "\",";
|
||||
params_ += "\"labelId\": \"" + std::to_string(property->labelId) + "\",";
|
||||
params_ += "\"descriptionId\": \"" + std::to_string(property->descriptionId) + "\",";
|
||||
std::string isDefaultIme = defaultIme == imeId ? "true" : "false";
|
||||
params_ += "\"isDefaultIme\": \"" + isDefaultIme + "\",";
|
||||
params_ += "\"label\": \"" + Str16ToStr8(property->label) + "\",";
|
||||
params_ += "\"description\": \"" + Str16ToStr8(property->description) + "\"";
|
||||
}
|
||||
params_ += "}]}";
|
||||
}
|
||||
|
||||
void InputMethodSystemAbility::DumpAllMethod(int fd)
|
||||
{
|
||||
IMSA_HILOGI("InputMethodSystemAbility::DumpAllMethod");
|
||||
@@ -151,27 +175,8 @@ namespace MiscServices {
|
||||
dprintf(fd, "\n - dump has no ime:\n");
|
||||
return;
|
||||
}
|
||||
std::string defaultIme = ParaHandle::GetDefaultIme(userId_);
|
||||
std::string params = "";
|
||||
std::vector<InputMethodProperty *>::iterator it;
|
||||
for (it = properties.begin(); it < properties.end(); ++it) {
|
||||
if (it == properties.begin()) {
|
||||
params += "{\"imeList\":[";
|
||||
} else {
|
||||
params += "},";
|
||||
}
|
||||
InputMethodProperty *property = (InputMethodProperty *)*it;
|
||||
std::string imeId = Str16ToStr8(property->mPackageName) + "/" + Str16ToStr8(property->mAbilityName);
|
||||
params += "{\"ime\": \"" + imeId + "\",";
|
||||
params += "\"labelId\": \"" + std::to_string(property->labelId) + "\",";
|
||||
params += "\"descriptionId\": \"" + std::to_string(property->descriptionId) + "\",";
|
||||
std::string isDefaultIme = defaultIme == imeId ? "true" : "false";
|
||||
params += "\"isDefaultIme\": \"" + isDefaultIme + "\",";
|
||||
params += "\"label\": \"" + Str16ToStr8(property->label) + "\",";
|
||||
params += "\"description\": \"" + Str16ToStr8(property->description) + "\"";
|
||||
}
|
||||
params += "}]}";
|
||||
|
||||
GetInputMethodParam(properties,params);
|
||||
dprintf(fd, "\n - dump all input methods:%s\n\n", params.c_str());
|
||||
IMSA_HILOGI("InputMethodSystemAbility::DumpAllMethod end.");
|
||||
}
|
||||
@@ -1003,28 +1008,8 @@ namespace MiscServices {
|
||||
IMSA_HILOGI("InputMethodSystemAbility::OnDisplayOptionalInputMethod has no ime");
|
||||
return;
|
||||
}
|
||||
|
||||
std::string defaultIme = ParaHandle::GetDefaultIme(userId_);
|
||||
std::string params = "";
|
||||
std::vector<InputMethodProperty*>::iterator it;
|
||||
for (it = properties.begin(); it < properties.end(); ++it) {
|
||||
if (it == properties.begin()) {
|
||||
params += "{\"imeList\":[";
|
||||
} else {
|
||||
params += "},";
|
||||
}
|
||||
InputMethodProperty *property = (InputMethodProperty*)*it;
|
||||
std::string imeId = Str16ToStr8(property->mPackageName) + "/" + Str16ToStr8(property->mAbilityName);
|
||||
params += "{\"ime\": \"" + imeId + "\",";
|
||||
params += "\"labelId\": \"" + std::to_string(property->labelId) + "\",";
|
||||
params += "\"descriptionId\": \"" + std::to_string(property->descriptionId) + "\",";
|
||||
std::string isDefaultIme = defaultIme == imeId ? "true" : "false";
|
||||
params += "\"isDefaultIme\": \"" + isDefaultIme + "\",";
|
||||
params += "\"label\": \"" + Str16ToStr8(property->label) + "\",";
|
||||
params += "\"description\": \"" + Str16ToStr8(property->description) + "\"";
|
||||
}
|
||||
params += "}]}";
|
||||
|
||||
GetInputMethodParam(properties,params);
|
||||
IMSA_HILOGI("InputMethodSystemAbility::OnDisplayOptionalInputMethod param : %{public}s", params.c_str());
|
||||
const int TITLE_HEIGHT = 62;
|
||||
const int SINGLE_IME_HEIGHT = 66;
|
||||
|
||||
Reference in New Issue
Block a user