Signed-off-by: GlaryCastle <yangpeng190@huawei.com>

Changes to be committed:
	modified:   services/include/input_method_system_ability.h
	modified:   services/src/input_method_system_ability.cpp
This commit is contained in:
GlaryCastle
2022-07-08 19:42:44 +08:00
parent 1d5d0dc323
commit 6b2070a34b
2 changed files with 12 additions and 12 deletions
@@ -56,7 +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 &params_);
void GetInputMethodParam(std::vector<InputMethodProperty *> properties, std::string &params);
int Dump(int fd, const std::vector<std::u16string> &args) override;
void DumpAllMethod(int fd);
+11 -11
View File
@@ -140,27 +140,27 @@ namespace MiscServices {
}
void InputMethodSystemAbility::GetInputMethodParam(
std::vector<InputMethodProperty *> properties_, std::string &params_)
std::vector<InputMethodProperty *> properties, std::string &params)
{
std::string defaultIme = ParaHandle::GetDefaultIme(userId_);
std::vector<InputMethodProperty *>::iterator it;
for (it = properties_.begin(); it < properties_.end(); ++it) {
if (it == properties_.begin()) {
for (it = properties.begin(); it < properties.end(); ++it) {
if (it == properties.begin()) {
params_ += "{\"imeList\":[";
} else {
params_ += "},";
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) + "\",";
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 += "\"isDefaultIme\": \"" + isDefaultIme + "\",";
params += "\"label\": \"" + Str16ToStr8(property->label) + "\",";
params += "\"description\": \"" + Str16ToStr8(property->description) + "\"";
}
params_ += "}]}";
params += "}]}";
}
void InputMethodSystemAbility::DumpAllMethod(int fd)