【日志】输入法框架日志打印量超标问题解决

Signed-off-by: Hollokin <taoyuxin2@huawei.com>
This commit is contained in:
Hollokin 2022-11-23 16:29:11 +08:00
parent 13907938c6
commit c5417efe47
8 changed files with 86 additions and 108 deletions

View File

@ -34,7 +34,7 @@ InputMethodCoreProxy::~InputMethodCoreProxy() = default;
int32_t InputMethodCoreProxy::initializeInput(
sptr<IRemoteObject> &startInputToken, int32_t displayId, sptr<IInputControlChannel> &inputControlChannel)
{
IMSA_HILOGI("InputMethodCoreProxy::initializeInput");
IMSA_HILOGD("InputMethodCoreProxy::initializeInput");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -75,7 +75,7 @@ int32_t InputMethodCoreProxy::initializeInput(
int32_t InputMethodCoreProxy::InitInputControlChannel(sptr<IInputControlChannel> &inputControlChannel)
{
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel");
IMSA_HILOGD("InputMethodCoreProxy::InitInputControlChannel");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -105,7 +105,7 @@ int32_t InputMethodCoreProxy::InitInputControlChannel(sptr<IInputControlChannel>
void InputMethodCoreProxy::SetClientState(bool state)
{
IMSA_HILOGI("InputMethodCoreProxy::SetClientState");
IMSA_HILOGD("InputMethodCoreProxy::SetClientState");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -127,7 +127,7 @@ void InputMethodCoreProxy::SetClientState(bool state)
bool InputMethodCoreProxy::startInput(
const sptr<IInputDataChannel> &inputDataChannel, const InputAttribute &editorAttribute, bool supportPhysicalKbd)
{
IMSA_HILOGI("InputMethodCoreProxy::startInput");
IMSA_HILOGD("InputMethodCoreProxy::startInput");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -159,7 +159,7 @@ bool InputMethodCoreProxy::startInput(
int32_t InputMethodCoreProxy::stopInput()
{
IMSA_HILOGI("InputMethodCoreProxy::stopInput");
IMSA_HILOGD("InputMethodCoreProxy::stopInput");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -184,7 +184,7 @@ int32_t InputMethodCoreProxy::stopInput()
int32_t InputMethodCoreProxy::showKeyboard(
const sptr<IInputDataChannel> &inputDataChannel, bool isShowKeyboard, const SubProperty &subProperty)
{
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard");
IMSA_HILOGD("InputMethodCoreProxy::showKeyboard");
return SendRequest(SHOW_KEYBOARD, [&inputDataChannel, &isShowKeyboard, &subProperty](MessageParcel &data) {
return ITypesUtil::Marshal(data, inputDataChannel->AsObject(), isShowKeyboard, subProperty);
});
@ -192,7 +192,7 @@ int32_t InputMethodCoreProxy::showKeyboard(
void InputMethodCoreProxy::StopInputService(std::string imeId)
{
IMSA_HILOGI("InputMethodCoreProxy::StopInputService");
IMSA_HILOGD("InputMethodCoreProxy::StopInputService");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("InputMethodCoreProxy::StopInputService remote is nullptr");
@ -213,7 +213,7 @@ void InputMethodCoreProxy::StopInputService(std::string imeId)
bool InputMethodCoreProxy::hideKeyboard(int32_t flags)
{
IMSA_HILOGI("InputMethodCoreProxy::hideKeyboard");
IMSA_HILOGD("InputMethodCoreProxy::hideKeyboard");
auto remote = Remote();
if (!remote) {
return false;
@ -235,7 +235,7 @@ bool InputMethodCoreProxy::hideKeyboard(int32_t flags)
int32_t InputMethodCoreProxy::setKeyboardType(const KeyboardType &type)
{
IMSA_HILOGI("InputMethodCoreProxy::setKeyboardType");
IMSA_HILOGD("InputMethodCoreProxy::setKeyboardType");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -255,7 +255,7 @@ int32_t InputMethodCoreProxy::setKeyboardType(const KeyboardType &type)
int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t &retHeight)
{
IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight");
IMSA_HILOGD("InputMethodCoreProxy::getKeyboardWindowHeight");
auto remote = Remote();
if (!remote) {
IMSA_HILOGI("remote is nullptr");
@ -278,13 +278,13 @@ int32_t InputMethodCoreProxy::getKeyboardWindowHeight(int32_t &retHeight)
int32_t InputMethodCoreProxy::SetSubtype(const SubProperty &property)
{
IMSA_HILOGI("InputMethodCoreProxy::SetSubtype");
IMSA_HILOGD("InputMethodCoreProxy::SetSubtype");
return SendRequest(SET_SUBTYPE, [&property](MessageParcel &data) { return ITypesUtil::Marshal(data, property); });
}
int32_t InputMethodCoreProxy::SendRequest(int code, ParcelHandler input, ParcelHandler output)
{
IMSA_HILOGI("InputMethodCoreProxy::%{public}s in", __func__);
IMSA_HILOGD("InputMethodCoreProxy::%{public}s in", __func__);
MessageParcel data;
MessageParcel reply;
MessageOption option{ MessageOption::TF_SYNC };

View File

@ -46,7 +46,7 @@ InputMethodCoreStub::~InputMethodCoreStub()
int32_t InputMethodCoreStub::OnRemoteRequest(
uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
{
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest");
IMSA_HILOGD("InputMethodCoreStub::OnRemoteRequest");
auto descriptorToken = data.ReadInterfaceToken();
if (descriptorToken != GetDescriptor()) {
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest descriptorToken is invalid");
@ -146,7 +146,7 @@ int32_t InputMethodCoreStub::OnRemoteRequest(
int32_t InputMethodCoreStub::initializeInput(
sptr<IRemoteObject> &startInputToken, int32_t displayId, sptr<IInputControlChannel> &inputControlChannel)
{
IMSA_HILOGI("InputMethodCoreStub::initializeInput");
IMSA_HILOGD("InputMethodCoreStub::initializeInput");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -168,7 +168,7 @@ int32_t InputMethodCoreStub::initializeInput(
int32_t InputMethodCoreStub::InitInputControlChannel(sptr<IInputControlChannel> &inputControlChannel)
{
IMSA_HILOGI("InputMethodCoreStub::initializeInput");
IMSA_HILOGD("InputMethodCoreStub::initializeInput");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -186,7 +186,7 @@ int32_t InputMethodCoreStub::InitInputControlChannel(sptr<IInputControlChannel>
bool InputMethodCoreStub::startInput(
const sptr<IInputDataChannel> &inputDataChannel, const InputAttribute &editorAttribute, bool supportPhysicalKbd)
{
IMSA_HILOGI("InputMethodCoreStub::startInput");
IMSA_HILOGD("InputMethodCoreStub::startInput");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -204,7 +204,7 @@ bool InputMethodCoreStub::startInput(
int32_t InputMethodCoreStub::stopInput()
{
IMSA_HILOGI("InputMethodCoreStub::stopInput");
IMSA_HILOGD("InputMethodCoreStub::stopInput");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -216,7 +216,7 @@ int32_t InputMethodCoreStub::stopInput()
void InputMethodCoreStub::SetClientState(bool state)
{
IMSA_HILOGI("InputMethodCoreStub::SetClientState");
IMSA_HILOGD("InputMethodCoreStub::SetClientState");
if (!msgHandler_) {
return;
}
@ -229,7 +229,7 @@ void InputMethodCoreStub::SetClientState(bool state)
bool InputMethodCoreStub::hideKeyboard(int32_t flags)
{
IMSA_HILOGI("InputMethodCoreStub::hideKeyboard");
IMSA_HILOGD("InputMethodCoreStub::hideKeyboard");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -244,7 +244,7 @@ bool InputMethodCoreStub::hideKeyboard(int32_t flags)
int32_t InputMethodCoreStub::setKeyboardType(const KeyboardType &type)
{
IMSA_HILOGI("InputMethodCoreStub::setKeyboardType");
IMSA_HILOGD("InputMethodCoreStub::setKeyboardType");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -258,7 +258,7 @@ int32_t InputMethodCoreStub::setKeyboardType(const KeyboardType &type)
void InputMethodCoreStub::StopInputService(std::string imeId)
{
IMSA_HILOGI("InputMethodCoreStub::StopInputService");
IMSA_HILOGD("InputMethodCoreStub::StopInputService");
if (!msgHandler_) {
return;
}
@ -271,7 +271,7 @@ void InputMethodCoreStub::StopInputService(std::string imeId)
int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t &retHeight)
{
IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight");
IMSA_HILOGD("InputMethodCoreStub::getKeyboardWindowHeight");
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
@ -289,7 +289,7 @@ void InputMethodCoreStub::SetMessageHandler(MessageHandler *msgHandler)
void InputMethodCoreStub::ShowKeyboardOnRemote(MessageParcel &data, MessageParcel &reply)
{
IMSA_HILOGI("InputMethodCoreStub::ShowKeyboardOnRemote");
IMSA_HILOGD("InputMethodCoreStub::ShowKeyboardOnRemote");
sptr<IRemoteObject> channel;
bool isShowKeyboard = false;
SubProperty subProperty;
@ -303,7 +303,7 @@ void InputMethodCoreStub::ShowKeyboardOnRemote(MessageParcel &data, MessageParce
void InputMethodCoreStub::SetSubtypeOnRemote(MessageParcel &data, MessageParcel &reply)
{
IMSA_HILOGI("InputMethodCoreStub::SetSubtypeOnRemote");
IMSA_HILOGD("InputMethodCoreStub::SetSubtypeOnRemote");
SubProperty property;
int32_t ret = SendMessage(MessageID::MSG_ID_SET_SUBTYPE, [&data, &property](MessageParcel &parcel) {
return ITypesUtil::Unmarshal(data, property) && ITypesUtil::Marshal(parcel, property);
@ -324,7 +324,7 @@ int32_t InputMethodCoreStub::SetSubtype(const SubProperty &property)
int32_t InputMethodCoreStub::SendMessage(int code, ParcelHandler input)
{
IMSA_HILOGI("InputMethodCoreStub::SendMessage");
IMSA_HILOGD("InputMethodCoreStub::SendMessage");
if (msgHandler_ == nullptr) {
IMSA_HILOGE("InputMethodCoreStub::msgHandler_ is nullptr");
return ErrorCode::ERROR_EX_NULL_POINTER;

View File

@ -286,13 +286,13 @@ using namespace MessageID;
void InputMethodController::HideTextInput()
{
IMSA_HILOGI("InputMethodController::HideTextInput");
IMSA_HILOGD("InputMethodController::HideTextInput");
StopInput(mClient);
}
int32_t InputMethodController::HideCurrentInput()
{
IMSA_HILOGI("InputMethodController::HideCurrentInput");
IMSA_HILOGD("InputMethodController::HideCurrentInput");
auto proxy = GetSystemAbilityProxy();
if (proxy == nullptr) {
IMSA_HILOGE("proxy is nullptr");
@ -320,7 +320,7 @@ using namespace MessageID;
std::lock_guard<std::mutex> lock(textListenerLock_);
textListener = nullptr;
}
IMSA_HILOGI("InputMethodController::Close");
IMSA_HILOGD("InputMethodController::Close");
}
void InputMethodController::PrepareInput(int32_t displayId, sptr<IInputClient> &client,
@ -371,7 +371,7 @@ using namespace MessageID;
std::shared_ptr<Property> InputMethodController::GetCurrentInputMethod()
{
IMSA_HILOGI("InputMethodController::GetCurrentInputMethod");
IMSA_HILOGD("InputMethodController::GetCurrentInputMethod");
auto proxy = GetSystemAbilityProxy();
if (proxy == nullptr) {
IMSA_HILOGE("proxy is nullptr");
@ -387,7 +387,7 @@ using namespace MessageID;
std::shared_ptr<SubProperty> InputMethodController::GetCurrentInputMethodSubtype()
{
IMSA_HILOGI("InputMethodController::GetCurrentInputMethod");
IMSA_HILOGD("InputMethodController::GetCurrentInputMethod");
auto proxy = GetSystemAbilityProxy();
if (proxy == nullptr) {
IMSA_HILOGE("proxy is nullptr");
@ -415,7 +415,7 @@ using namespace MessageID;
void InputMethodController::ReleaseInput(sptr<IInputClient> &client)
{
IMSA_HILOGI("InputMethodController::ReleaseInput");
IMSA_HILOGD("InputMethodController::ReleaseInput");
isStopInput = true;
auto proxy = GetSystemAbilityProxy();
if (proxy == nullptr) {
@ -427,7 +427,7 @@ using namespace MessageID;
void InputMethodController::StopInput(sptr<IInputClient> &client)
{
IMSA_HILOGI("InputMethodController::StopInput");
IMSA_HILOGD("InputMethodController::StopInput");
isStopInput = true;
auto proxy = GetSystemAbilityProxy();
if (proxy == nullptr) {

View File

@ -39,7 +39,7 @@ int32_t InputMethodSystemAbilityProxy::PrepareInput(int32_t displayId, sptr<IInp
int32_t InputMethodSystemAbilityProxy::StartInput(sptr<IInputClient> client, bool isShowKeyboard)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(START_INPUT, [isShowKeyboard, client](MessageParcel &data) {
return data.WriteRemoteObject(client->AsObject()) && data.WriteBool(isShowKeyboard);
});
@ -47,25 +47,25 @@ int32_t InputMethodSystemAbilityProxy::StartInput(sptr<IInputClient> client, boo
int32_t InputMethodSystemAbilityProxy::ShowCurrentInput()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(SHOW_CURRENT_INPUT);
}
int32_t InputMethodSystemAbilityProxy::HideCurrentInput()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(HIDE_CURRENT_INPUT);
}
int32_t InputMethodSystemAbilityProxy::StopInputSession()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(STOP_INPUT_SESSION);
}
int32_t InputMethodSystemAbilityProxy::StopInput(sptr<IInputClient> client)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(STOP_INPUT,
[client](MessageParcel &data) { return data.WriteRemoteObject(client->AsObject()); });
}
@ -84,7 +84,7 @@ int32_t InputMethodSystemAbilityProxy::DisplayOptionalInputMethod()
int32_t InputMethodSystemAbilityProxy::SetCoreAndAgent(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(SET_CORE_AND_AGENT, [core, agent](MessageParcel &data) {
return data.WriteRemoteObject(core->AsObject()) && data.WriteRemoteObject(agent->AsObject());
});
@ -92,14 +92,14 @@ int32_t InputMethodSystemAbilityProxy::SetCoreAndAgent(sptr<IInputMethodCore> co
int32_t InputMethodSystemAbilityProxy::GetKeyboardWindowHeight(int32_t &retHeight)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(GET_KEYBOARD_WINDOW_HEIGHT, nullptr,
[&retHeight](MessageParcel &reply) { return reply.ReadInt32(retHeight); });
}
std::shared_ptr<Property> InputMethodSystemAbilityProxy::GetCurrentInputMethod()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
std::shared_ptr<Property> property = nullptr;
int32_t ret = SendRequest(GET_CURRENT_INPUT_METHOD, nullptr, [&property](MessageParcel &reply) {
property = std::make_shared<Property>();
@ -118,7 +118,7 @@ std::shared_ptr<Property> InputMethodSystemAbilityProxy::GetCurrentInputMethod()
std::shared_ptr<SubProperty> InputMethodSystemAbilityProxy::GetCurrentInputMethodSubtype()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
std::shared_ptr<SubProperty> property = nullptr;
int32_t ret = SendRequest(GET_CURRENT_INPUT_METHOD_SUBTYPE, nullptr, [&property](MessageParcel &reply) {
property = std::make_shared<SubProperty>();
@ -137,7 +137,7 @@ std::shared_ptr<SubProperty> InputMethodSystemAbilityProxy::GetCurrentInputMetho
int32_t InputMethodSystemAbilityProxy::ListInputMethod(InputMethodStatus status, std::vector<Property> &props)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
int32_t ret = SendRequest(
LIST_INPUT_METHOD, [status](MessageParcel &data) { return ITypesUtil::Marshal(data, uint32_t(status)); },
[&props](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, props); });
@ -149,26 +149,26 @@ int32_t InputMethodSystemAbilityProxy::ListInputMethod(InputMethodStatus status,
int32_t InputMethodSystemAbilityProxy::ShowCurrentInputDeprecated()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(SHOW_CURRENT_INPUT_DEPRECATED);
}
int32_t InputMethodSystemAbilityProxy::HideCurrentInputDeprecated()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(HIDE_CURRENT_INPUT_DEPRECATED);
}
int32_t InputMethodSystemAbilityProxy::DisplayOptionalInputMethodDeprecated()
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(DISPLAY_OPTIONAL_INPUT_DEPRECATED);
}
int32_t InputMethodSystemAbilityProxy::SetCoreAndAgentDeprecated(sptr<IInputMethodCore> core,
sptr<IInputMethodAgent> agent)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
return SendRequest(SET_CORE_AND_AGENT_DEPRECATED, [core, agent](MessageParcel &data) {
return data.WriteRemoteObject(core->AsObject()) && data.WriteRemoteObject(agent->AsObject());
});
@ -177,7 +177,7 @@ int32_t InputMethodSystemAbilityProxy::SetCoreAndAgentDeprecated(sptr<IInputMeth
int32_t InputMethodSystemAbilityProxy::ListInputMethodSubtype(
const std::string &name, std::vector<SubProperty> &subProps)
{
IMSA_HILOGI("InputMethodSystemAbilityProxy::ListInputMethodSubtype");
IMSA_HILOGD("InputMethodSystemAbilityProxy::ListInputMethodSubtype");
int32_t ret = SendRequest(
LIST_INPUT_METHOD_SUBTYPE, [&name](MessageParcel &data) { return ITypesUtil::Marshal(data, name); },
[&subProps](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, subProps); });
@ -189,7 +189,7 @@ int32_t InputMethodSystemAbilityProxy::ListInputMethodSubtype(
int32_t InputMethodSystemAbilityProxy::ListCurrentInputMethodSubtype(std::vector<SubProperty> &subProps)
{
IMSA_HILOGI("InputMethodSystemAbilityProxy::ListCurrentInputMethodSubtype");
IMSA_HILOGD("InputMethodSystemAbilityProxy::ListCurrentInputMethodSubtype");
int32_t ret = SendRequest(LIST_CURRENT_INPUT_METHOD_SUBTYPE, nullptr,
[&subProps](MessageParcel &reply) { return ITypesUtil::Unmarshal(reply, subProps); });
if (ret != ErrorCode::NO_ERROR) {
@ -200,14 +200,14 @@ int32_t InputMethodSystemAbilityProxy::ListCurrentInputMethodSubtype(std::vector
int32_t InputMethodSystemAbilityProxy::SwitchInputMethod(const std::string &name, const std::string &subName)
{
IMSA_HILOGI("InputMethodSystemAbilityProxy::SwitchInputMethod");
IMSA_HILOGD("InputMethodSystemAbilityProxy::SwitchInputMethod");
return SendRequest(SWITCH_INPUT_METHOD,
[&name, &subName](MessageParcel &data) { return ITypesUtil::Marshal(data, name, subName); });
}
int32_t InputMethodSystemAbilityProxy::SendRequest(int code, ParcelHandler input, ParcelHandler output)
{
IMSA_HILOGI("%{public}s in", __func__);
IMSA_HILOGD("%{public}s in", __func__);
MessageParcel data;
MessageParcel reply;
MessageOption option{ MessageOption::TF_SYNC };

View File

@ -115,13 +115,11 @@ private:
int userId_; // the id of the user to whom the object is linking
int userState = UserState::USER_STATE_STARTED; // the state of the user to whom the object is linking
int displayId; // the id of the display screen on which the user is
int currentIndex;
std::map<sptr<IRemoteObject>, std::shared_ptr<ClientInfo>> mapClients;
static const int MIN_IME = 2;
static const int MAX_RESTART_NUM = 3;
static const int IME_RESET_TIME_OUT = 300;
static const int MAX_RESET_WAIT_TIME = 1600000;
static const int SLEEP_TIME = 300000;
InputMethodInfo *currentIme[MAX_IME] = { nullptr, nullptr }; // 0 - the default ime. 1 - security ime
@ -132,10 +130,8 @@ private:
int currentKbdIndex[MAX_IME]; // current keyboard index
int lastImeIndex; // The last ime which showed keyboard
InputMethodSetting *inputMethodSetting; // The pointer referred to the object in PerUserSetting
int currentDisplayMode; // the display mode of the current keyboard
sptr<IInputMethodAgent> imsAgent;
InputChannel *imsChannel; // the write channel created by input method service
std::mutex clientLock_;
sptr<IInputClient> currentClient; // the current input client
sptr<IInputClient> needReshowClient = nullptr; // the input client for which keyboard need to re-show
@ -144,7 +140,6 @@ private:
MessageHandler *msgHandler = nullptr; // message handler working with Work Thread
std::thread workThreadHandler; // work thread handler
std::recursive_mutex mtx; // mutex to lock the operations among multi work threads
sptr<AAFwk::AbilityConnectionProxy> connCallback;
std::mutex resetLock;
ResetManager manager[MAX_IME];
@ -172,7 +167,6 @@ private:
int StopInputMethod(int index);
int ShowKeyboard(const sptr<IInputClient> &inputClient, bool isShowKeyboard);
int HideKeyboard(const sptr<IInputClient> &inputClient);
void SetDisplayId(int displayId);
int GetImeIndex(const sptr<IInputClient> &inputClient);
static sptr<AAFwk::IAbilityManager> GetAbilityManagerService();
void SendAgentToSingleClient(const ClientInfo &clientInfo);

View File

@ -22,9 +22,9 @@
#include "input_method_system_ability_stub.h"
#include "ipc_skeleton.h"
#include "iservice_registry.h"
#include "itypes_util.h"
#include "message_handler.h"
#include "system_ability_definition.h"
#include "itypes_util.h"
namespace OHOS {
namespace MiscServices {
@ -34,15 +34,11 @@ std::mutex ImCommonEventManager::instanceLock_;
/*! Constructor
*/
ImCommonEventManager::ImCommonEventManager()
{
}
ImCommonEventManager::ImCommonEventManager() {}
/*! Destructor
*/
ImCommonEventManager::~ImCommonEventManager()
{
}
ImCommonEventManager::~ImCommonEventManager() {}
sptr<ImCommonEventManager> ImCommonEventManager::GetInstance()
{
@ -155,8 +151,7 @@ void ImCommonEventManager::EventSubscriber::HandlePackageRemove(const AAFwk::Wan
auto element = want.GetElement();
std::string bundleName = element.GetBundleName();
int32_t userId = want.GetIntParam("userId", 0);
IMSA_HILOGI("bundleName = %{public}s, userId = %{public}d", bundleName.c_str(), userId);
IMSA_HILOGD("bundleName = %{public}s, userId = %{public}d", bundleName.c_str(), userId);
MessageParcel *parcel = new MessageParcel();
if (!ITypesUtil::Marshal(*parcel, userId, bundleName)) {
IMSA_HILOGE("Failed to write message parcel");

View File

@ -739,7 +739,6 @@ namespace MiscServices {
property.descriptionId = applicationInfo.descriptionId;
property.label = Str8ToStr16(labelString);
property.description = Str8ToStr16(descriptionString);
properties.emplace_back(property);
}
return properties;
}
@ -881,7 +880,7 @@ namespace MiscServices {
OnPackageRemoved(msg);
delete msg;
msg = nullptr;
return;
break;
}
case MSG_ID_SETTING_CHANGED: {
OnSettingChanged(msg);
@ -1366,7 +1365,7 @@ namespace MiscServices {
sptr<AAFwk::IAbilityManager> InputMethodSystemAbility::GetAbilityManagerService()
{
IMSA_HILOGE("InputMethodSystemAbility::GetAbilityManagerService start");
IMSA_HILOGD("InputMethodSystemAbility::GetAbilityManagerService start");
auto systemAbilityManager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr) {
IMSA_HILOGE("SystemAbilityManager is nullptr.");

View File

@ -137,14 +137,6 @@ namespace MiscServices {
}
}
/*! Set display Id
\param displayId the Id of display screen on which the input method keyboard show.
*/
void PerUserSession::SetDisplayId(int displayId)
{
this->displayId = displayId;
}
/*! Set the current input method engine
\param ime the current (default) IME pointer referred to the instance in PerUserSetting.
*/
@ -178,7 +170,7 @@ namespace MiscServices {
*/
void PerUserSession::ResetIme(InputMethodInfo *defaultIme, InputMethodInfo *securityIme)
{
IMSA_HILOGI("PerUserSession::ResetIme");
IMSA_HILOGD("PerUserSession::ResetIme");
std::lock_guard<std::recursive_mutex> lock(mtx);
InputMethodInfo *ime[] = {defaultIme, securityIme};
for (int i = 0; i < MIN_IME; i++) {
@ -224,7 +216,7 @@ namespace MiscServices {
*/
void PerUserSession::OnPackageRemoved(const std::u16string& packageName)
{
IMSA_HILOGI("PerUserSession::OnPackageRemoved");
IMSA_HILOGD("PerUserSession::OnPackageRemoved");
InputMethodSetting tmpSetting;
bool flag = false;
std::lock_guard<std::recursive_mutex> lock(mtx);
@ -255,7 +247,7 @@ namespace MiscServices {
int PerUserSession::AddClient(sptr<IRemoteObject> inputClient, const ClientInfo &clientInfo)
{
IMSA_HILOGI("PerUserSession::AddClient");
IMSA_HILOGD("PerUserSession::AddClient");
std::lock_guard<std::recursive_mutex> lock(mtx);
auto cacheClient = GetClientInfo(inputClient);
if (cacheClient != nullptr) {
@ -287,7 +279,7 @@ namespace MiscServices {
*/
void PerUserSession::RemoveClient(sptr<IRemoteObject> inputClient)
{
IMSA_HILOGE("PerUserSession::RemoveClient");
IMSA_HILOGD("PerUserSession::RemoveClient");
std::lock_guard<std::recursive_mutex> lock(mtx);
auto it = mapClients.find(inputClient);
if (it == mapClients.end()) {
@ -392,7 +384,7 @@ namespace MiscServices {
*/
int PerUserSession::ShowKeyboard(const sptr<IInputClient>& inputClient, bool isShowKeyboard)
{
IMSA_HILOGI("PerUserSession::ShowKeyboard");
IMSA_HILOGD("PerUserSession::ShowKeyboard");
auto clientInfo = GetClientInfo(inputClient->AsObject());
int index = GetImeIndex(inputClient);
if (index == -1 || clientInfo == nullptr) {
@ -427,7 +419,7 @@ namespace MiscServices {
*/
int PerUserSession::HideKeyboard(const sptr<IInputClient>& inputClient)
{
IMSA_HILOGI("PerUserSession::HideKeyboard");
IMSA_HILOGD("PerUserSession::HideKeyboard");
int index = GetImeIndex(inputClient);
if (index == -1) {
IMSA_HILOGE("PerUserSession::HideKeyboard Aborted! ErrorCode::ERROR_CLIENT_NOT_FOUND");
@ -556,7 +548,7 @@ namespace MiscServices {
}
usleep(MAX_RESET_WAIT_TIME);
MessageHandler::Instance()->SendMessage(msg);
IMSA_HILOGI("End...[%{public}d]\n", userId_);
IMSA_HILOGD("End...[%{public}d]\n", userId_);
}
/*! It's called when input method setting data in the system is changed
@ -567,16 +559,15 @@ namespace MiscServices {
*/
int PerUserSession::OnSettingChanged(const std::u16string& key, const std::u16string& value)
{
IMSA_HILOGI("Start...[%{public}d]\n", userId_);
IMSA_HILOGD("Start...[%{public}d]\n", userId_);
std::lock_guard<std::recursive_mutex> lock(mtx);
if (!inputMethodSetting) {
return ErrorCode::ERROR_NULL_POINTER;
}
std::u16string currentValue = inputMethodSetting->GetValue(key);
IMSA_HILOGD("PerUserSession::OnSettingChanged key = %{public}s", Utils::ToStr8(key).c_str());
IMSA_HILOGD("PerUserSession::OnSettingChanged value = %{public}s", Utils::ToStr8(value).c_str());
IMSA_HILOGD("PerUserSession::OnSettingChanged currentValue = %{public}s", Utils::ToStr8(currentValue).c_str());
IMSA_HILOGD("key = %{public}s, value = %{public}s, currentValue = %{public}s", Utils::ToStr8(key).c_str(),
Utils::ToStr8(value).c_str(), Utils::ToStr8(currentValue).c_str());
if (currentValue == value) {
IMSA_HILOGI("End...[%{public}d]\n", userId_);
@ -612,7 +603,7 @@ namespace MiscServices {
inputMethodSetting->SetCurrentKeyboardType(-1);
}
}
IMSA_HILOGI("End...[%{public}d]\n", userId_);
IMSA_HILOGD("End...[%{public}d]\n", userId_);
return ErrorCode::NO_ERROR;
}
@ -682,7 +673,7 @@ namespace MiscServices {
*/
int PerUserSession::OnHideKeyboardSelf(int flags)
{
IMSA_HILOGW("PerUserSession::OnHideKeyboardSelf");
IMSA_HILOGD("PerUserSession::OnHideKeyboardSelf");
(void)flags;
sptr<IInputClient> client = GetCurrentClient();
if (client == nullptr) {
@ -694,7 +685,7 @@ namespace MiscServices {
int PerUserSession::OnShowKeyboardSelf()
{
IMSA_HILOGI("PerUserSession::OnShowKeyboardSelf");
IMSA_HILOGD("PerUserSession::OnShowKeyboardSelf");
sptr<IInputClient> client = GetCurrentClient();
if (client == nullptr) {
IMSA_HILOGE("current client is nullptr");
@ -758,7 +749,6 @@ namespace MiscServices {
*/
void PerUserSession::OnSetDisplayMode(int mode)
{
currentDisplayMode = mode;
sptr<IInputClient> client = GetCurrentClient();
if (client == nullptr) {
IMSA_HILOGE("current client is nullptr");
@ -784,7 +774,7 @@ namespace MiscServices {
if (index < 0 || index >= MAX_IME) {
return;
}
IMSA_HILOGI("Start...[%{public}d]\n", userId_);
IMSA_HILOGD("Start...[%{public}d]\n", userId_);
if (currentIme[index] && currentIme[index]->mImeId == imeId) {
int ret = StartInputMethod(index);
if (needReshowClient && GetImeIndex(needReshowClient) == index) {
@ -794,14 +784,14 @@ namespace MiscServices {
needReshowClient = nullptr;
}
}
IMSA_HILOGI("End...[%{public}d]\n", userId_);
IMSA_HILOGD("End...[%{public}d]\n", userId_);
}
/*! It's called when this user is locked
*/
void PerUserSession::OnUserLocked()
{
IMSA_HILOGI("PerUserSession::OnUserLocked");
IMSA_HILOGD("PerUserSession::OnUserLocked");
std::lock_guard<std::recursive_mutex> lock(mtx);
if (userState == UserState::USER_STATE_STARTED) {
IMSA_HILOGI("End...[%{public}d]\n", userId_);
@ -1052,7 +1042,7 @@ namespace MiscServices {
*/
int32_t PerUserSession::OnPrepareInput(const ClientInfo &clientInfo)
{
IMSA_HILOGI("PerUserSession::OnPrepareInput Start\n");
IMSA_HILOGD("PerUserSession::OnPrepareInput Start\n");
int ret = AddClient(clientInfo.client->AsObject(), clientInfo);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("PerUserSession::OnPrepareInput %{public}s", ErrorCode::ToString(ret));
@ -1064,7 +1054,7 @@ namespace MiscServices {
void PerUserSession::SendAgentToSingleClient(const ClientInfo &clientInfo)
{
IMSA_HILOGI("PerUserSession::SendAgentToSingleClient");
IMSA_HILOGD("PerUserSession::SendAgentToSingleClient");
if (imsAgent == nullptr) {
IMSA_HILOGI("PerUserSession::SendAgentToSingleClient imsAgent is nullptr");
CreateComponentFailed(userId_, ErrorCode::ERROR_NULL_POINTER);
@ -1080,14 +1070,14 @@ namespace MiscServices {
*/
int32_t PerUserSession::OnReleaseInput(sptr<IInputClient> client)
{
IMSA_HILOGI("PerUserSession::OnReleaseInput Start\n");
IMSA_HILOGD("PerUserSession::OnReleaseInput Start\n");
if (imsCore[0] == nullptr) {
return ErrorCode::ERROR_IME_NOT_AVAILABLE;
}
imsCore[0]->SetClientState(false);
HideKeyboard(client);
RemoveClient(client->AsObject());
IMSA_HILOGI("PerUserSession::OnReleaseInput End...[%{public}d]\n", userId_);
IMSA_HILOGD("PerUserSession::OnReleaseInput End...[%{public}d]\n", userId_);
return ErrorCode::NO_ERROR;
}
@ -1098,7 +1088,7 @@ namespace MiscServices {
*/
int32_t PerUserSession::OnStartInput(sptr<IInputClient> client, bool isShowKeyboard)
{
IMSA_HILOGI("PerUserSession::OnStartInput");
IMSA_HILOGD("PerUserSession::OnStartInput");
if (imsCore[0] == nullptr) {
return ErrorCode::ERROR_IME_NOT_AVAILABLE;
}
@ -1108,7 +1098,7 @@ namespace MiscServices {
int32_t PerUserSession::OnSetCoreAndAgent(sptr<IInputMethodCore> core, sptr<IInputMethodAgent> agent)
{
IMSA_HILOGI("PerUserSession::SetCoreAndAgent Start\n");
IMSA_HILOGD("PerUserSession::SetCoreAndAgent Start\n");
if (core == nullptr || agent == nullptr) {
IMSA_HILOGE("PerUserSession::SetCoreAndAgent core or agent nullptr");
return ErrorCode::ERROR_EX_NULL_POINTER;
@ -1127,7 +1117,7 @@ namespace MiscServices {
void PerUserSession::SendAgentToAllClients()
{
IMSA_HILOGI("PerUserSession::SendAgentToAllClients");
IMSA_HILOGD("PerUserSession::SendAgentToAllClients");
std::lock_guard<std::recursive_mutex> lock(mtx);
if (imsAgent == nullptr) {
IMSA_HILOGE("PerUserSession::SendAgentToAllClients imsAgent is nullptr");
@ -1144,7 +1134,7 @@ namespace MiscServices {
void PerUserSession::InitInputControlChannel()
{
IMSA_HILOGI("PerUserSession::InitInputControlChannel");
IMSA_HILOGD("PerUserSession::InitInputControlChannel");
sptr<IInputControlChannel> inputControlChannel = new InputControlChannelStub(userId_);
int ret = imsCore[0]->InitInputControlChannel(inputControlChannel);
if (ret != ErrorCode::NO_ERROR) {
@ -1159,13 +1149,13 @@ namespace MiscServices {
*/
int32_t PerUserSession::OnStopInput(sptr<IInputClient> client)
{
IMSA_HILOGI("PerUserSession::OnStopInput");
IMSA_HILOGD("PerUserSession::OnStopInput");
return HideKeyboard(client);
}
void PerUserSession::StopInputService(std::string imeId)
{
IMSA_HILOGI("PerUserSession::StopInputService");
IMSA_HILOGD("PerUserSession::StopInputService");
if (imsCore[0] == nullptr) {
IMSA_HILOGE("imsCore[0] is nullptr");
return;
@ -1177,7 +1167,7 @@ namespace MiscServices {
bool PerUserSession::IsRestartIme(uint32_t index)
{
IMSA_HILOGI("PerUserSession::IsRestartIme");
IMSA_HILOGD("PerUserSession::IsRestartIme");
std::lock_guard<std::mutex> lock(resetLock);
auto now = time(nullptr);
if (difftime(now, manager[index].last) > IME_RESET_TIME_OUT) {
@ -1221,7 +1211,7 @@ namespace MiscServices {
int32_t PerUserSession::OnInputMethodSwitched(const Property &property, const SubProperty &subProperty)
{
IMSA_HILOGI("PerUserSession::OnInputMethodSwitched");
IMSA_HILOGD("PerUserSession::OnInputMethodSwitched");
std::lock_guard<std::recursive_mutex> lock(mtx);
for (const auto &client : mapClients) {
auto clientInfo = client.second;
@ -1254,14 +1244,14 @@ namespace MiscServices {
SubProperty PerUserSession::GetCurrentSubProperty()
{
IMSA_HILOGI("PerUserSession::GetCurrentSubProperty");
IMSA_HILOGD("PerUserSession::GetCurrentSubProperty");
std::lock_guard<std::mutex> lock(propertyLock_);
return currentSubProperty;
}
void PerUserSession::SetCurrentSubProperty(const SubProperty &subProperty)
{
IMSA_HILOGI("PerUserSession::SetCurrentSubProperty");
IMSA_HILOGD("PerUserSession::SetCurrentSubProperty");
std::lock_guard<std::mutex> lock(propertyLock_);
currentSubProperty = subProperty;
}