mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2024-11-27 00:41:04 +00:00
AI 检视告警修改
Signed-off-by: “wwx1139321” <wangdongqi2@h-partners.com>
This commit is contained in:
parent
4f0beb6340
commit
e62c869d20
@ -25,7 +25,10 @@ void LogTimeStamp()
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, nullptr);
|
||||
struct tm nowTime;
|
||||
localtime_r(&tv.tv_sec, &nowTime);
|
||||
auto localTime = localtime_r(&tv.tv_sec, &nowTime);
|
||||
if (localTime == nullptr) {
|
||||
return;
|
||||
}
|
||||
int32_t millSec = 1000;
|
||||
printf("%02d-%02d %02d:%02d:%02d.%03d\t", nowTime.tm_mon, nowTime.tm_mday, nowTime.tm_hour, nowTime.tm_min,
|
||||
nowTime.tm_sec, static_cast<int32_t>(tv.tv_usec) / millSec);
|
||||
|
@ -281,15 +281,15 @@ napi_value JsKeyboardDelegateSetting::UnSubscribe(napi_env env, napi_callback_in
|
||||
napi_value JsKeyboardDelegateSetting::GetResultOnKeyEvent(napi_env env, int32_t keyCode, int32_t keyStatus)
|
||||
{
|
||||
napi_value KeyboardDelegate = nullptr;
|
||||
napi_create_object(env, &KeyboardDelegate);
|
||||
NAPI_CALL(env, napi_create_object(env, &KeyboardDelegate));
|
||||
|
||||
napi_value jsKeyCode = nullptr;
|
||||
napi_create_int32(env, keyCode, &jsKeyCode);
|
||||
napi_set_named_property(env, KeyboardDelegate, "keyCode", jsKeyCode);
|
||||
NAPI_CALL(env, napi_create_int32(env, keyCode, &jsKeyCode));
|
||||
NAPI_CALL(env, napi_set_named_property(env, KeyboardDelegate, "keyCode", jsKeyCode));
|
||||
|
||||
napi_value jsKeyAction = nullptr;
|
||||
napi_create_int32(env, keyStatus, &jsKeyAction);
|
||||
napi_set_named_property(env, KeyboardDelegate, "keyAction", jsKeyAction);
|
||||
NAPI_CALL(env, napi_create_int32(env, keyStatus, &jsKeyAction));
|
||||
NAPI_CALL(env, napi_set_named_property(env, KeyboardDelegate, "keyAction", jsKeyAction));
|
||||
|
||||
return KeyboardDelegate;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ std::shared_ptr<AppExecFwk::EventHandler> JsGetInputMethodSetting::handler_{ nul
|
||||
napi_value JsGetInputMethodSetting::Init(napi_env env, napi_value exports)
|
||||
{
|
||||
napi_value maxTypeNumber = nullptr;
|
||||
napi_create_int32(env, MAX_TYPE_NUM, &maxTypeNumber);
|
||||
NAPI_CALL(env, napi_create_int32(env, MAX_TYPE_NUM, &maxTypeNumber));
|
||||
|
||||
napi_property_descriptor descriptor[] = {
|
||||
DECLARE_NAPI_FUNCTION("getInputMethodSetting", GetInputMethodSetting),
|
||||
|
@ -268,15 +268,17 @@ export struct InputMethodListDialog {
|
||||
}
|
||||
Scroll() {
|
||||
Column() {
|
||||
ForEach(this.subTypes, (item: InputMethodSubtype, index: number) => {
|
||||
this.InputMethodItem(this.activeSubtypes[index].name,
|
||||
this.isDefaultInputMethodCurrentSubType(item.id) ? this.selectedFontColor : this.fontColor,
|
||||
this.isDefaultInputMethodCurrentSubType(item.id) ? this.selectedColor : this.listBgColor,
|
||||
this.pressedColor, this.inputMethods.length > 1 || index < this.subTypes.length,
|
||||
() => {
|
||||
this.switchMethodSub(item);
|
||||
})
|
||||
}, (item: inputMethod.InputMethodProperty) => JSON.stringify(item));
|
||||
if (this.activeSubtypes.length === this.subTypes.length) {
|
||||
ForEach(this.subTypes, (item: InputMethodSubtype, index: number) => {
|
||||
this.InputMethodItem(this.activeSubtypes[index].name,
|
||||
this.isDefaultInputMethodCurrentSubType(item.id) ? this.selectedFontColor : this.fontColor,
|
||||
this.isDefaultInputMethodCurrentSubType(item.id) ? this.selectedColor : this.listBgColor,
|
||||
this.pressedColor, this.inputMethods.length > 1 || index < this.subTypes.length,
|
||||
() => {
|
||||
this.switchMethodSub(item);
|
||||
})
|
||||
}, (item: inputMethod.InputMethodProperty) => JSON.stringify(item));
|
||||
}
|
||||
|
||||
ForEach(this.inputMethods, (item: inputMethod.InputMethodProperty, index: number) => {
|
||||
if (this.subTypes.length === 0 || (this.defaultInputMethod && item.name !== this.defaultInputMethod.name)) {
|
||||
|
@ -32,7 +32,7 @@ napi_value JsInputMethodPanel::Init(napi_env env, napi_value exports)
|
||||
napi_value JsInputMethodPanel::GetJsPanelTypeProperty(napi_env env)
|
||||
{
|
||||
napi_value obj = nullptr;
|
||||
napi_create_object(env, &obj);
|
||||
NAPI_CALL(env, napi_create_object(env, &obj));
|
||||
|
||||
auto ret = JsUtil::Object::WriteProperty(env, obj, "SOFT_KEYBOARD", static_cast<int32_t>(PanelType::SOFT_KEYBOARD));
|
||||
ret = ret && JsUtil::Object::WriteProperty(env, obj, "STATUS_BAR", static_cast<int32_t>(PanelType::STATUS_BAR));
|
||||
@ -45,7 +45,7 @@ napi_value JsInputMethodPanel::GetJsPanelTypeProperty(napi_env env)
|
||||
napi_value JsInputMethodPanel::GetJsPanelFlagProperty(napi_env env)
|
||||
{
|
||||
napi_value obj = nullptr;
|
||||
napi_create_object(env, &obj);
|
||||
NAPI_CALL(env, napi_create_object(env, &obj));
|
||||
|
||||
auto ret = JsUtil::Object::WriteProperty(env, obj, "FLAG_FIXED", static_cast<int32_t>(PanelFlag::FLG_FIXED));
|
||||
ret = ret &&
|
||||
|
@ -25,6 +25,7 @@ public:
|
||||
static sptr<IInputMethodSystemAbility> GetImsaProxy();
|
||||
|
||||
private:
|
||||
static std::mutex abilityLock_;
|
||||
static sptr<IInputMethodSystemAbility> abilityManager_; // for tdd test
|
||||
};
|
||||
} // namespace MiscServices
|
||||
|
@ -20,9 +20,11 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace MiscServices {
|
||||
std::mutex ImaUtils::abilityLock_;
|
||||
sptr<IInputMethodSystemAbility> ImaUtils::abilityManager_{ nullptr }; // for tdd test
|
||||
sptr<IInputMethodSystemAbility> ImaUtils::GetImsaProxy()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(abilityLock_);
|
||||
IMSA_HILOGD("ImaUtils::GetImsaProxy start.");
|
||||
// for tdd test begin
|
||||
if (abilityManager_ != nullptr) {
|
||||
|
@ -30,6 +30,11 @@ InputMethodAgentProxy::InputMethodAgentProxy(const sptr<IRemoteObject> &object)
|
||||
int32_t InputMethodAgentProxy::DispatchKeyEvent(const std::shared_ptr<MMI::KeyEvent> &keyEvent,
|
||||
sptr<IKeyEventConsumer> &consumer)
|
||||
{
|
||||
if (consumer == nullptr) {
|
||||
IMSA_HILOGE("consumer is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
int32_t res = -1;
|
||||
int32_t ret = SendRequest(
|
||||
DISPATCH_KEY_EVENT,
|
||||
|
@ -33,6 +33,11 @@ InputMethodCoreProxy::~InputMethodCoreProxy() = default;
|
||||
|
||||
int32_t InputMethodCoreProxy::InitInputControlChannel(const sptr<IInputControlChannel> &inputControlChannel)
|
||||
{
|
||||
if (inputControlChannel == nullptr) {
|
||||
IMSA_HILOGE("inputControlChannel is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(INIT_INPUT_CONTROL_CHANNEL, [&inputControlChannel](MessageParcel &data) {
|
||||
return ITypesUtil::Marshal(data, inputControlChannel->AsObject());
|
||||
});
|
||||
|
@ -32,6 +32,11 @@ InputMethodSystemAbilityProxy::InputMethodSystemAbilityProxy(const sptr<IRemoteO
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::StartInput(InputClientInfo &inputClientInfo, sptr<IRemoteObject> &agent)
|
||||
{
|
||||
if (inputClientInfo.client == nullptr) {
|
||||
IMSA_HILOGE("client is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(
|
||||
static_cast<uint32_t>(InputMethodInterfaceCode::START_INPUT),
|
||||
[&inputClientInfo](MessageParcel &data) {
|
||||
@ -69,18 +74,33 @@ int32_t InputMethodSystemAbilityProxy::StopInputSession()
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::ShowInput(sptr<IInputClient> client)
|
||||
{
|
||||
if (client == nullptr) {
|
||||
IMSA_HILOGE("client is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::SHOW_INPUT),
|
||||
[client](MessageParcel &data) { return data.WriteRemoteObject(client->AsObject()); });
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::HideInput(sptr<IInputClient> client)
|
||||
{
|
||||
if (client == nullptr) {
|
||||
IMSA_HILOGE("client is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::HIDE_INPUT),
|
||||
[client](MessageParcel &data) { return data.WriteRemoteObject(client->AsObject()); });
|
||||
}
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::ReleaseInput(sptr<IInputClient> client)
|
||||
{
|
||||
if (client == nullptr) {
|
||||
IMSA_HILOGE("client is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::RELEASE_INPUT),
|
||||
[client](MessageParcel &data) { return data.WriteRemoteObject(client->AsObject()); });
|
||||
}
|
||||
@ -108,6 +128,11 @@ int32_t InputMethodSystemAbilityProxy::DisplayOptionalInputMethod()
|
||||
int32_t InputMethodSystemAbilityProxy::SetCoreAndAgent(const sptr<IInputMethodCore> &core,
|
||||
const sptr<IRemoteObject> &agent)
|
||||
{
|
||||
if (core == nullptr) {
|
||||
IMSA_HILOGE("core is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::SET_CORE_AND_AGENT),
|
||||
[core, agent](MessageParcel &data) {
|
||||
return data.WriteRemoteObject(core->AsObject()) && data.WriteRemoteObject(agent);
|
||||
@ -139,6 +164,11 @@ int32_t InputMethodSystemAbilityProxy::GetSecurityMode(int32_t &security)
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::UnRegisteredProxyIme(UnRegisteredType type, const sptr<IInputMethodCore> &core)
|
||||
{
|
||||
if (core == nullptr) {
|
||||
IMSA_HILOGE("core is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::UNREGISTERED_PROXY_IME),
|
||||
[&type, &core](
|
||||
MessageParcel &data) { return ITypesUtil::Marshal(data, static_cast<int32_t>(type), core->AsObject()); });
|
||||
@ -246,6 +276,11 @@ int32_t InputMethodSystemAbilityProxy::PanelStatusChange(const InputWindowStatus
|
||||
|
||||
int32_t InputMethodSystemAbilityProxy::UpdateListenEventFlag(InputClientInfo &clientInfo, uint32_t eventFlag)
|
||||
{
|
||||
if (clientInfo.client == nullptr) {
|
||||
IMSA_HILOGE("client is nullptr.");
|
||||
return ErrorCode::ERROR_EX_NULL_POINTER;
|
||||
}
|
||||
|
||||
return SendRequest(static_cast<uint32_t>(InputMethodInterfaceCode::UPDATE_LISTEN_EVENT_FLAG),
|
||||
[&clientInfo, eventFlag](MessageParcel &data) {
|
||||
return ITypesUtil::Marshal(data, clientInfo, clientInfo.client->AsObject(), clientInfo.channel, eventFlag);
|
||||
|
@ -77,6 +77,10 @@ void InputEventCallback::SetKeyHandle(KeyHandle handle)
|
||||
void InputEventCallback::TriggerSwitch()
|
||||
{
|
||||
auto state = KeyboardEvent::META_MASK | KeyboardEvent::SPACE_MASK;
|
||||
if (keyHandler_ == nullptr) {
|
||||
IMSA_HILOGI("keyHandler_ is nullptr.");
|
||||
return;
|
||||
}
|
||||
int32_t ret = keyHandler_(state);
|
||||
IMSA_HILOGI("handle combinationkey ret: %{public}d.", ret);
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ private:
|
||||
private:
|
||||
static std::mutex instanceMutex_;
|
||||
static sptr<SettingsDataUtils> instance_;
|
||||
std::mutex tokenMutex_;
|
||||
std::mutex remoteObjMutex_;
|
||||
sptr<IRemoteObject> remoteObj_ = nullptr;
|
||||
std::mutex observerListMutex_;
|
||||
std::vector<sptr<SettingsDataObserver>> observerList_;
|
||||
|
@ -25,7 +25,11 @@ std::mutex SettingsDataUtils::instanceMutex_;
|
||||
sptr<SettingsDataUtils> SettingsDataUtils::instance_ = nullptr;
|
||||
SettingsDataUtils::~SettingsDataUtils()
|
||||
{
|
||||
remoteObj_ = nullptr;
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(remoteObjMutex_);
|
||||
remoteObj_ = nullptr;
|
||||
}
|
||||
std::lock_guard<decltype(observerListMutex_)> lock(observerListMutex_);
|
||||
if (!observerList_.empty()) {
|
||||
for (auto &iter : observerList_) {
|
||||
UnregisterObserver(iter);
|
||||
@ -198,7 +202,7 @@ int32_t SettingsDataUtils::GetStringValue(const std::string &uriProxy, const std
|
||||
|
||||
sptr<IRemoteObject> SettingsDataUtils::GetToken()
|
||||
{
|
||||
std::lock_guard<std::mutex> autoLock(tokenMutex_);
|
||||
std::lock_guard<std::mutex> autoLock(remoteObjMutex_);
|
||||
if (remoteObj_ != nullptr) {
|
||||
return remoteObj_;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user