modify two files at 7/21 09:57

Signed-off-by: zhaolinglan <zhaolinglan@huawei.com>
This commit is contained in:
zhaolinglan
2022-07-21 09:57:52 +08:00
parent bc1daf879c
commit 33dcbbae4c
2 changed files with 16 additions and 2 deletions
@@ -64,10 +64,18 @@ namespace MiscServices {
// should do type check
std::lock_guard<std::recursive_mutex> lk(mapMutex);
if (jsCbMap_.empty() || jsCbMap_.find(type) == jsCbMap_.end()) {
IMSA_HILOGI("methodName %{public}s not registerted!", type.c_str());
IMSA_HILOGI("methodName %{public}s not registered!", type.c_str());
return;
}
jsCbMap_.erase(type);
for (auto it = jsCbMap_[type].begin(); it != jsCbMap_[type].end();) {
if (value->StrictEquals((*it)->Get())) {
jsCbMap_[type].erase(it);
break;
}
}
if (jsCbMap_[type].empty()) {
jsCbMap_.erase(type);
}
}
bool JsInputMethodEngineListener::IfCallbackRegistered(std::string type, NativeValue* jsListenerObject)
@@ -316,6 +316,9 @@ namespace MiscServices {
int32_t userId = getUserId(uid);
auto *parcel = new (std::nothrow) MessageParcel();
if (parcel == nullptr) {
return ErrorCode::ERROR_EX_NULL_POINTER;
}
InputMethodProperty *target = InputMethodProperty::Unmarshalling(data);
parcel->WriteInt32(userId);
if (!target->Marshalling(*parcel)) {
@@ -326,6 +329,9 @@ namespace MiscServices {
}
delete target;
auto *msg = new (std::nothrow) Message(MSG_ID_SWITCH_INPUT_METHOD, parcel);
if (msg == nullptr) {
return ErrorCode::ERROR_EX_NULL_POINTER;
}
MessageHandler::Instance()->SendMessage(msg);
return ErrorCode::NO_ERROR;
}