fix warning

Signed-off-by: zhouyongfei <zhouyongfei@huawei.com>
This commit is contained in:
zhouyongfei 2022-03-26 08:36:32 +00:00
parent 5b5ef7d12b
commit e33063b4c7
86 changed files with 427 additions and 385 deletions

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_INPUTMETHOD_PARA_HANDLE_H
#define OHOS_MISCSERVICES_INPUTMETHOD_PARA_HANDLE_H
#ifndef ETC_PARA_INCLUDE_PARA_HANDLE_H
#define ETC_PARA_INCLUDE_PARA_HANDLE_H
#include <string>
namespace OHOS {
namespace MiscServices {

View File

@ -22,9 +22,9 @@ namespace OHOS {
bool ParaHandle::SetDefaultIme(int32_t userId, const std::string &imeName)
{
if (userId != main_userId) {
return SetParameter(DEFAULT_IME_KEY + userId, imeName.data()) == 0;
return !SetParameter(DEFAULT_IME_KEY + userId, imeName.data());
} else {
return SetParameter(DEFAULT_IME_KEY, imeName.data()) == 0;
return !SetParameter(DEFAULT_IME_KEY, imeName.data());
}
}

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IINPUTMETHODAGENT_H
#define FM_IMMS_PROJECT_IINPUTMETHODAGENT_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_AGENT_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_AGENT_H
#include "iremote_broker.h"
#include "global.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IINPUTMETHODCORE_H
#define FM_IMMS_PROJECT_IINPUTMETHODCORE_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_CORE_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_I_INPUT_METHOD_CORE_H
#include "iremote_broker.h"
#include "i_input_data_channel.h"
#include "i_input_control_channel.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTMETHODABILITY_H
#define FM_IMMS_PROJECT_INPUTMETHODABILITY_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_ABILITY_H
#include <thread>
#include "js_input_method_engine_listener.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTMETHODAGENTPROXY_H
#define FM_IMC_PROJECT_INPUTMETHODAGENTPROXY_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_PROXY_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_PROXY_H
#include "iremote_proxy.h"
#include "i_input_method_agent.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTMETHODAGENTSTUB_H
#define FM_IMC_PROJECT_INPUTMETHODAGENTSTUB_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_STUB_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_AGENT_STUB_H
#include "iremote_stub.h"
#include "message_parcel.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTMETHODCOREPROXY_H
#define FM_IMC_PROJECT_INPUTMETHODCOREPROXY_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_PROXY_H
#include "iremote_proxy.h"
#include "iremote_object.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H
#define FM_IMMS_PROJECT_INPUTCONTROLCHANNEL_SK_H
#ifndef FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_STUB_H
#define FRAMEWORKS_INPUTMETHOD_ABILITY_INCLUDE_INPUT_METHOD_CORE_STUB_H
#include <mutex>
#include <condition_variable>

View File

@ -41,7 +41,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::~InputMethodAbility");
instance_ = nullptr;
if (msgHandler != nullptr) {
if (msgHandler) {
delete msgHandler;
msgHandler = nullptr;
}
@ -51,9 +51,9 @@ namespace MiscServices {
sptr<InputMethodAbility> InputMethodAbility::GetInstance()
{
IMSA_HILOGI("InputMethodAbility::GetInstance");
if (instance_ == nullptr) {
if (!instance_) {
std::lock_guard<std::mutex> autoLock(instanceLock_);
if (instance_ == nullptr) {
if (!instance_) {
IMSA_HILOGI("InputMethodAbility::GetInstance need new IMA");
instance_ = new InputMethodAbility();
}
@ -66,13 +66,13 @@ namespace MiscServices {
IMSA_HILOGI("InputMethodAbility::GetImsaProxy");
sptr<ISystemAbilityManager> systemAbilityManager =
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr) {
if (!systemAbilityManager) {
IMSA_HILOGI("InputMethodAbility::GetImsaProxy systemAbilityManager is nullptr");
return nullptr;
}
auto systemAbility = systemAbilityManager->GetSystemAbility(INPUT_METHOD_SYSTEM_ABILITY_ID, "");
if (systemAbility == nullptr) {
if (!systemAbility) {
IMSA_HILOGI("InputMethodAbility::GetImsaProxy systemAbility is nullptr");
return nullptr;
}
@ -85,7 +85,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::SetCoreAndAgent");
mImms = GetImsaProxy();
if (mImms == nullptr) {
if (!mImms) {
IMSA_HILOGI("InputMethodAbility::SetCoreAndAgent() mImms is nullptr");
return;
}
@ -120,7 +120,7 @@ namespace MiscServices {
void InputMethodAbility::setImeListener(sptr<JsInputMethodEngineListener> &imeListener)
{
IMSA_HILOGI("InputMethodAbility::setImeListener");
if (imeListener_ == nullptr) {
if (!imeListener_) {
imeListener_ = imeListener;
}
}
@ -128,7 +128,7 @@ namespace MiscServices {
void InputMethodAbility::setKdListener(sptr<JsKeyboardDelegateListener> &kdListener)
{
IMSA_HILOGI("InputMethodAbility::setKdListener");
if (kdListener_ == nullptr) {
if (!kdListener_) {
kdListener_ = kdListener;
}
}
@ -178,7 +178,7 @@ namespace MiscServices {
case MSG_ID_STOP_INPUT_SERVICE:{
MessageParcel *data = msg->msgContent_;
std::string imeId = Str16ToStr8(data->ReadString16());
if (imeListener_ != nullptr) {
if (imeListener_) {
imeListener_->OnInputStop(imeId);
}
break;
@ -198,13 +198,13 @@ namespace MiscServices {
MessageParcel *data = msg->msgContent_;
displyId = data->ReadInt32();
sptr<IRemoteObject> channelObject = data->ReadRemoteObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("InputMethodAbility::OnInitialInput channelObject is nullptr");
return;
}
sptr<InputControlChannelProxy> channelProxy = new InputControlChannelProxy(channelObject);
inputControlChannel = channelProxy;
if (inputControlChannel == nullptr) {
if (!inputControlChannel) {
IMSA_HILOGI("InputMethodAbility::OnInitialInput inputControlChannel is nullptr");
return;
}
@ -215,13 +215,13 @@ namespace MiscServices {
IMSA_HILOGI("InputMethodAbility::OnInitInputControlChannel");
MessageParcel *data = msg->msgContent_;
sptr<IRemoteObject> channelObject = data->ReadRemoteObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("InputMethodAbility::OnInitInputControlChannel channelObject is nullptr");
return;
}
sptr<InputControlChannelProxy> channelProxy = new InputControlChannelProxy(channelObject);
inputControlChannel = channelProxy;
if (inputControlChannel == nullptr) {
if (!inputControlChannel) {
IMSA_HILOGI("InputMethodAbility::OnInitInputControlChannel inputControlChannel is nullptr");
}
}
@ -232,11 +232,12 @@ namespace MiscServices {
MessageParcel *data = msg->msgContent_;
sptr<InputDataChannelProxy> channalProxy = new InputDataChannelProxy(data->ReadRemoteObject());
inputDataChannel = channalProxy;
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::OnStartInput inputDataChannel is nullptr");
return;
}
editorAttribute = data->ReadParcelable<InputAttribute>();
if (editorAttribute == nullptr) {
if (!editorAttribute) {
IMSA_HILOGI("InputMethodAbility::OnStartInput editorAttribute is nullptr");
}
mSupportPhysicalKbd = data->ReadBool();
@ -248,7 +249,7 @@ namespace MiscServices {
MessageParcel *data = msg->msgContent_;
sptr<InputDataChannelProxy> channalProxy = new InputDataChannelProxy(data->ReadRemoteObject());
inputDataChannel = channalProxy;
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::OnShowKeyboard inputDataChannel is nullptr");
}
ShowInputWindow();
@ -263,7 +264,7 @@ namespace MiscServices {
void InputMethodAbility::OnStopInput(Message *msg)
{
IMSA_HILOGI("InputMethodAbility::OnStopInput");
if (writeInputChannel != nullptr) {
if (writeInputChannel) {
delete writeInputChannel;
writeInputChannel = nullptr;
}
@ -277,7 +278,7 @@ namespace MiscServices {
IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent abort. no client");
return false;
}
if (kdListener_ == nullptr) {
if (!kdListener_) {
IMSA_HILOGI("InputMethodAbility::DispatchKeyEvent kdListener_ is nullptr");
return false;
}
@ -291,7 +292,7 @@ namespace MiscServices {
int32_t positionX = data->ReadInt32();
int32_t positionY = data->ReadInt32();
int32_t height = data->ReadInt32();
if (kdListener_ == nullptr) {
if (!kdListener_) {
IMSA_HILOGI("InputMethodAbility::OnCursorUpdate kdListener_ is nullptr");
return;
}
@ -308,7 +309,7 @@ namespace MiscServices {
int32_t newBegin = data->ReadInt32();
int32_t newEnd = data->ReadInt32();
if (kdListener_ == nullptr) {
if (!kdListener_) {
IMSA_HILOGI("InputMethodAbility::OnSelectionChange kdListener_ is nullptr");
return;
}
@ -320,13 +321,13 @@ namespace MiscServices {
void InputMethodAbility::ShowInputWindow()
{
IMSA_HILOGI("InputMethodAbility::ShowInputWindow");
if (imeListener_ == nullptr) {
if (!imeListener_) {
IMSA_HILOGI("InputMethodAbility::ShowInputWindow imeListener_ is nullptr");
return;
}
imeListener_->OnInputStart();
imeListener_->OnKeyboardStatus(true);
if (inputDataChannel != nullptr) {
if (inputDataChannel) {
inputDataChannel->SendKeyboardStatus(KEYBOARD_SHOW);
}
}
@ -334,12 +335,12 @@ namespace MiscServices {
void InputMethodAbility::DissmissInputWindow()
{
IMSA_HILOGI("InputMethodAbility::DissmissInputWindow");
if (imeListener_ == nullptr) {
if (!imeListener_) {
IMSA_HILOGI("InputMethodAbility::DissmissInputWindow imeListener_ is nullptr");
return;
}
imeListener_->OnKeyboardStatus(false);
if (inputDataChannel != nullptr) {
if (inputDataChannel) {
inputDataChannel->SendKeyboardStatus(KEYBOARD_HIDE);
}
}
@ -347,7 +348,7 @@ namespace MiscServices {
bool InputMethodAbility::InsertText(const std::string text)
{
IMSA_HILOGI("InputMethodAbility::InsertText");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::InsertText inputDataChanel is nullptr");
return false;
}
@ -358,7 +359,7 @@ namespace MiscServices {
void InputMethodAbility::DeleteForward(int32_t length)
{
IMSA_HILOGI("InputMethodAbility::DeleteForward");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::DeleteForward inputDataChanel is nullptr");
return;
}
@ -368,7 +369,7 @@ namespace MiscServices {
void InputMethodAbility::DeleteBackward(int32_t length)
{
IMSA_HILOGI("InputMethodAbility::DeleteBackward");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::DeleteBackward inputDataChanel is nullptr");
return;
}
@ -378,7 +379,7 @@ namespace MiscServices {
void InputMethodAbility::SendFunctionKey(int32_t funcKey)
{
IMSA_HILOGI("InputMethodAbility::SendFunctionKey");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::SendFunctionKey inputDataChanel is nullptr");
return;
}
@ -395,7 +396,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::GetTextBeforeCursor");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::GetTextBeforeCursor inputDataChanel is nullptr");
return u"";
}
@ -406,7 +407,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::GetTextAfterCursor");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::GetTextAfterCursor inputDataChanel is nullptr");
return u"";
}
@ -417,7 +418,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::MoveCursor");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::MoveCursor inputDataChanel is nullptr");
return;
}
@ -430,7 +431,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::GetEnterKeyType");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::GetEnterKeyType inputDataChanel is nullptr");
return 0;
}
@ -441,7 +442,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::GetInputPattern");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::GetInputPattern inputDataChanel is nullptr");
return 0;
}
@ -452,7 +453,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodAbility::StopInput");
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodAbility::StopInput inputDataChanel is nullptr");
return;
}

View File

@ -75,7 +75,7 @@ namespace MiscServices {
bool InputMethodAgentStub::DispatchKeyEvent(MessageParcel& data)
{
IMSA_HILOGI("InputMethodAgentStub::DispatchKeyEvent");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return false;
}
return InputMethodAbility::GetInstance()->DispatchKeyEvent(data.ReadInt32(), data.ReadInt32());
@ -84,7 +84,7 @@ namespace MiscServices {
void InputMethodAgentStub::OnCursorUpdate(int32_t positionX, int32_t positionY, int height)
{
IMSA_HILOGI("InputMethodAgentStub::OnCursorUpdate");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return;
}
MessageParcel *data = new MessageParcel();
@ -99,7 +99,7 @@ namespace MiscServices {
int32_t newBegin, int32_t newEnd)
{
IMSA_HILOGI("InputMethodAgentStub::OnSelectionChange");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return;
}
MessageParcel *data = new MessageParcel();

View File

@ -33,15 +33,15 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::initializeInput");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
if (startInputToken == nullptr) {
if (!startInputToken) {
IMSA_HILOGI("InputMethodCoreProxy::initializeInput startInputToken is nullptr");
}
if (inputControlChannel == nullptr) {
if (!inputControlChannel) {
IMSA_HILOGI("InputMethodCoreProxy::initializeInput inputControlChannel is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -50,7 +50,7 @@ namespace MiscServices {
data.WriteInterfaceToken(GetDescriptor());
data.WriteInt32(displayId);
sptr<IRemoteObject> channelObject = inputControlChannel->AsObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("InputMethodCoreProxy::initializeInput channelObject is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -76,18 +76,18 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
if (inputControlChannel == nullptr) {
if (!inputControlChannel) {
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel inputControlChannel is nullptr");
return ErrorCode::ERROR_EX_NULL_POINTER;
}
MessageParcel data, reply;
data.WriteInterfaceToken(GetDescriptor());
sptr<IRemoteObject> channelObject = inputControlChannel->AsObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("InputMethodCoreProxy::InitInputControlChannel channelObject is nullptr");
return ErrorCode::ERROR_EX_NULL_POINTER;
}
@ -108,7 +108,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::SetClientState");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return;
}
@ -133,11 +133,11 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::startInput");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return false;
}
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodCoreProxy::startInput inputDataChannel is nullptr");
return false;
}
@ -169,7 +169,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::stopInput");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -195,7 +195,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("InputMethodCoreProxy::showKeyboard remote is nullptr");
return false;
}
@ -221,7 +221,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::StopInputService");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("InputMethodCoreProxy::StopInputService remote is nullptr");
return;
}
@ -245,7 +245,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::hideKeyboard");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
return false;
}
@ -269,7 +269,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::setKeyboardType");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -291,7 +291,7 @@ namespace MiscServices {
{
IMSA_HILOGI("InputMethodCoreProxy::getKeyboardWindowHeight");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
IMSA_HILOGI("remote is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -305,7 +305,7 @@ namespace MiscServices {
return status;
}
int32_t code = reply.ReadException();
if (code != 0) {
if (code) {
return code;
}
retHeight = reply.ReadInt32();

View File

@ -57,11 +57,11 @@ namespace MiscServices {
int32_t displayId = data.ReadInt32();
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest displayId = %{public}d", displayId);
sptr<IRemoteObject> channelObject = data.ReadRemoteObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest channelObject is nullptr");
}
sptr<IInputControlChannel> inputControlChannel = new InputControlChannelProxy(channelObject);
if (inputControlChannel == nullptr) {
if (!inputControlChannel) {
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest inputControlChannel is nullptr");
}
@ -71,11 +71,11 @@ namespace MiscServices {
}
case INIT_INPUT_CONTROL_CHANNEL: {
sptr<IRemoteObject> channelObject = data.ReadRemoteObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest channelObject is nullptr");
}
sptr<IInputControlChannel> inputControlChannel = new InputControlChannelProxy(channelObject);
if (inputControlChannel == nullptr) {
if (!inputControlChannel) {
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest inputControlChannel is nullptr");
}
@ -88,7 +88,7 @@ namespace MiscServices {
InputAttribute *editorAttribute = data.ReadParcelable<InputAttribute>();
bool supportPhysicalKbd = data.ReadBool();
if (inputDataChannel == nullptr) {
if (!inputDataChannel) {
IMSA_HILOGI("InputMethodCoreStub::OnRemoteRequest START_INPUT inputDataChannel is nulltpr");
}
startInput(inputDataChannel, *editorAttribute, supportPhysicalKbd);
@ -148,17 +148,17 @@ namespace MiscServices {
sptr<IInputControlChannel>& inputControlChannel)
{
IMSA_HILOGI("InputMethodCoreStub::initializeInput");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
if (startInputToken == nullptr) {
if (!startInputToken) {
IMSA_HILOGI("InputMethodCoreStub::initializeInput startInputToken is nullptr");
}
MessageParcel *data = new MessageParcel();
data->WriteInt32(displayId);
if (inputControlChannel != nullptr) {
if (inputControlChannel) {
IMSA_HILOGI("InputMethodCoreStub::initializeInput. inputControlChannel is not nullptr");
data->WriteRemoteObject(inputControlChannel->AsObject());
}
@ -170,12 +170,12 @@ namespace MiscServices {
int32_t InputMethodCoreStub::InitInputControlChannel(sptr<IInputControlChannel>& inputControlChannel)
{
IMSA_HILOGI("InputMethodCoreStub::initializeInput");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
MessageParcel *data = new MessageParcel();
if (inputControlChannel != nullptr) {
if (inputControlChannel) {
IMSA_HILOGI("InputMethodCoreStub::initializeInput. inputControlChannel is not nullptr");
data->WriteRemoteObject(inputControlChannel->AsObject());
}
@ -188,11 +188,11 @@ namespace MiscServices {
const InputAttribute& editorAttribute, bool supportPhysicalKbd)
{
IMSA_HILOGI("InputMethodCoreStub::startInput");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
MessageParcel *data = new MessageParcel();
if (inputDataChannel != nullptr) {
if (inputDataChannel) {
IMSA_HILOGI("InputMethodCoreStub::startInput inputDataChannel is not nullptr");
data->WriteRemoteObject(inputDataChannel->AsObject());
}
@ -206,7 +206,7 @@ namespace MiscServices {
int32_t InputMethodCoreStub::stopInput()
{
IMSA_HILOGI("InputMethodCoreStub::stopInput");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
MessageParcel *data = new MessageParcel();
@ -218,7 +218,7 @@ namespace MiscServices {
void InputMethodCoreStub::SetClientState(bool state)
{
IMSA_HILOGI("InputMethodCoreStub::SetClientState");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return;
}
MessageParcel *data = new MessageParcel();
@ -231,11 +231,11 @@ namespace MiscServices {
bool InputMethodCoreStub::showKeyboard(const sptr<IInputDataChannel>& inputDataChannel)
{
IMSA_HILOGI("InputMethodCoreStub::showKeyboard");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return false;
}
MessageParcel *data = new MessageParcel();
if (inputDataChannel != nullptr) {
if (inputDataChannel) {
IMSA_HILOGI("InputMethodCoreStub::showKeyboard inputDataChannel is not nullptr");
data->WriteRemoteObject(inputDataChannel->AsObject());
}
@ -248,7 +248,7 @@ namespace MiscServices {
bool InputMethodCoreStub::hideKeyboard(int32_t flags)
{
IMSA_HILOGI("InputMethodCoreStub::hideKeyboard");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
MessageParcel *data = new MessageParcel();
@ -263,7 +263,7 @@ namespace MiscServices {
int32_t InputMethodCoreStub::setKeyboardType(const KeyboardType& type)
{
IMSA_HILOGI("InputMethodCoreStub::setKeyboardType");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
MessageParcel *data = new MessageParcel();
@ -277,7 +277,7 @@ namespace MiscServices {
void InputMethodCoreStub::StopInputService(std::string imeId)
{
IMSA_HILOGI("InputMethodCoreStub::StopInputService");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return;
}
MessageParcel *data = new MessageParcel();
@ -290,7 +290,7 @@ namespace MiscServices {
int32_t InputMethodCoreStub::getKeyboardWindowHeight(int32_t retHeight)
{
IMSA_HILOGI("InputMethodCoreStub::getKeyboardWindowHeight");
if (msgHandler_ == nullptr) {
if (!msgHandler_) {
return ErrorCode::ERROR_NULL_POINTER;
}
MessageParcel *data = new MessageParcel();

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IINPUTCLIENT_H
#define FM_IMMS_PROJECT_IINPUTCLIENT_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_CLIENT_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_CLIENT_H
#include "iremote_broker.h"
#include "i_input_method_agent.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IINPUTDATACHANNEL_H
#define FM_IMMS_PROJECT_IINPUTDATACHANNEL_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_I_INPUT_DATA_CHANNEL_H
#include <errors.h>
#include "iremote_broker.h"
#include "global.h"

View File

@ -14,8 +14,8 @@
*/
#ifndef FM_IMC_PROJECT_INPUTCLIENTPROXY_H
#define FM_IMC_PROJECT_INPUTCLIENTPROXY_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_PROXY_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_PROXY_H
#include "iremote_proxy.h"
#include "i_input_client.h"

View File

@ -14,8 +14,8 @@
*/
#ifndef FM_IMC_PROJECT_INPUTCLIENTSTUB_H
#define FM_IMC_PROJECT_INPUTCLIENTSTUB_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_STUB_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_CLIENT_STUB_H
#include "iremote_stub.h"
#include "i_input_client.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTDATACHANNELPROXY_H
#define FM_IMC_PROJECT_INPUTDATACHANNELPROXY_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_PROXY_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_PROXY_H
#include "iremote_proxy.h"
#include "i_input_data_channel.h"

View File

@ -14,8 +14,8 @@
*/
#ifndef FM_IMC_PROJECT_INPUTDATACHANNELSTUB_H
#define FM_IMC_PROJECT_INPUTDATACHANNELSTUB_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_STUB_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_DATA_CHANNEL_STUB_H
#include "i_input_data_channel.h"
#include "iremote_stub.h"

View File

@ -14,8 +14,8 @@
*/
#ifndef FM_IMC_PROJECT_INPUTMETHODCONTROLLER_H
#define FM_IMC_PROJECT_INPUTMETHODCONTROLLER_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_CONTROLLER_H
#include <mutex>
#include <thread>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUTMETHODSYSTEMABILITYPROXY_H
#define FM_IMC_PROJECT_INPUTMETHODSYSTEMABILITYPROXY_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_PROXY_H
#include <vector>
#include "iremote_proxy.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMC_PROJECT_INPUT_METHOD_UTILS_H
#define FM_IMC_PROJECT_INPUT_METHOD_UTILS_H
#ifndef FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H
#define FRAMEWORKS_INPUTMETHOD_CONTROLLER_INCLUDE_INPUT_METHOD_UTILS_H
#include <stdint.h>

View File

@ -36,7 +36,7 @@ namespace MiscServices {
}
switch (code) {
case ON_INPUT_READY: {
if (msgHandler == nullptr) {
if (!msgHandler) {
break;
}
MessageParcel *parcel = new MessageParcel();
@ -47,7 +47,7 @@ namespace MiscServices {
break;
}
case ON_INPUT_RELEASED: {
if (msgHandler == nullptr) {
if (!msgHandler) {
break;
}
MessageParcel *parcel = new MessageParcel();
@ -57,7 +57,7 @@ namespace MiscServices {
break;
}
case SET_DISPLAY_MODE: {
if (msgHandler == nullptr) {
if (!msgHandler) {
break;
}
MessageParcel *parcel = new MessageParcel();

View File

@ -24,7 +24,7 @@ namespace MiscServices {
InputDataChannelStub::~InputDataChannelStub()
{
if (msgHandler != nullptr) {
if (msgHandler) {
delete msgHandler;
msgHandler = nullptr;
}
@ -103,7 +103,7 @@ namespace MiscServices {
bool InputDataChannelStub::InsertText(const std::u16string& text)
{
IMSA_HILOGI("InputDataChannelStub::InsertText");
if (msgHandler != nullptr) {
if (msgHandler) {
MessageParcel *parcel = new MessageParcel;
parcel->WriteString16(text);
Message *msg = new Message(MessageID::MSG_ID_INSERT_CHAR, parcel);
@ -117,7 +117,7 @@ namespace MiscServices {
bool InputDataChannelStub::DeleteForward(int32_t length)
{
IMSA_HILOGI("InputDataChannelStub::DeleteForward");
if (msgHandler == nullptr) {
if (!msgHandler) {
return false;
}
MessageParcel *parcel = new MessageParcel;
@ -131,7 +131,7 @@ namespace MiscServices {
bool InputDataChannelStub::DeleteBackward(int32_t length)
{
IMSA_HILOGI("InputDataChannelStub::DeleteBackward");
if (msgHandler != nullptr) {
if (msgHandler) {
MessageParcel *parcel = new MessageParcel;
parcel->WriteInt32(length);
Message *msg = new Message(MessageID::MSG_ID_DELETE_BACKWARD, parcel);
@ -178,7 +178,7 @@ namespace MiscServices {
void InputDataChannelStub::SendKeyboardStatus(int32_t status)
{
IMSA_HILOGI("InputDataChannelStub::SendKeyboardStatus");
if (msgHandler != nullptr) {
if (msgHandler) {
MessageParcel *parcel = new MessageParcel;
parcel->WriteInt32(status);
Message *msg = new Message(MessageID::MSG_ID_SEND_KEYBOARD_STATUS, parcel);
@ -189,7 +189,7 @@ namespace MiscServices {
void InputDataChannelStub::SendFunctionKey(int32_t funcKey)
{
IMSA_HILOGI("InputDataChannelStub::SendFunctionKey");
if (msgHandler != nullptr) {
if (msgHandler) {
MessageParcel *parcel = new MessageParcel;
parcel->WriteInt32(funcKey);
Message *msg = new Message(MessageID::MSG_ID_SEND_FUNCTION_KEY, parcel);
@ -200,7 +200,7 @@ namespace MiscServices {
void InputDataChannelStub::MoveCursor(int32_t keyCode)
{
IMSA_HILOGI("InputDataChannelStub::MoveCursor");
if (msgHandler != nullptr) {
if (msgHandler) {
MessageParcel *parcel = new MessageParcel;
parcel->WriteInt32(keyCode);
Message *msg = new Message(MessageID::MSG_ID_MOVE_CURSOR, parcel);

View File

@ -32,7 +32,7 @@ using namespace MessageID;
InputMethodController::~InputMethodController()
{
if (msgHandler != nullptr) {
if (msgHandler) {
delete msgHandler;
msgHandler = nullptr;
stop_ = false;
@ -41,9 +41,9 @@ using namespace MessageID;
sptr<InputMethodController> InputMethodController::GetInstance()
{
if (instance_ == nullptr) {
if (!instance_) {
std::lock_guard<std::mutex> autoLock(instanceLock_);
if (instance_ == nullptr) {
if (!instance_) {
IMSA_HILOGI("InputMethodController::GetInstance instance_ is nullptr");
instance_ = new InputMethodController();
}
@ -77,18 +77,18 @@ using namespace MessageID;
IMSA_HILOGI("InputMethodController::GetImsaProxy");
sptr<ISystemAbilityManager> systemAbilityManager =
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr) {
if (!systemAbilityManager) {
IMSA_HILOGI("InputMethodController::GetImsaProxy systemAbilityManager is nullptr");
return nullptr;
}
auto systemAbility = systemAbilityManager->GetSystemAbility(INPUT_METHOD_SYSTEM_ABILITY_ID, "");
if (systemAbility == nullptr) {
if (!systemAbility) {
IMSA_HILOGI("InputMethodController::GetImsaProxy systemAbility is nullptr");
return nullptr;
}
if (deathRecipient_ == nullptr) {
if (!deathRecipient_) {
deathRecipient_ = new ImsaDeathRecipient();
}
systemAbility->AddDeathRecipient(deathRecipient_);
@ -106,7 +106,7 @@ using namespace MessageID;
MessageParcel *data = msg->msgContent_;
std::u16string text = data->ReadString16();
IMSA_HILOGI("InputMethodController::WorkThread InsertText");
if (textListener != nullptr) {
if (textListener) {
textListener->InsertText(text);
}
break;
@ -116,7 +116,7 @@ using namespace MessageID;
MessageParcel *data = msg->msgContent_;
int32_t length = data->ReadInt32();
IMSA_HILOGI("InputMethodController::WorkThread DeleteForward");
if (textListener != nullptr) {
if (textListener) {
textListener->DeleteForward(length);
}
break;
@ -125,7 +125,7 @@ using namespace MessageID;
MessageParcel *data = msg->msgContent_;
int32_t length = data->ReadInt32();
IMSA_HILOGI("InputMethodController::WorkThread DeleteBackward");
if (textListener != nullptr) {
if (textListener) {
textListener->DeleteBackward(length);
}
break;
@ -139,7 +139,7 @@ using namespace MessageID;
case MSG_ID_ON_INPUT_READY: {
MessageParcel *data = msg->msgContent_;
sptr<IRemoteObject> object = data->ReadRemoteObject();
if (object != nullptr) {
if (object) {
mAgent = new InputMethodAgentProxy(object);
}
break;
@ -157,7 +157,7 @@ using namespace MessageID;
KeyboardInfo *info = new KeyboardInfo();
info->SetKeyboardStatus(ret);
IMSA_HILOGI("InputMethodController::WorkThread SendKeyboardInfo");
if (textListener != nullptr) {
if (textListener) {
textListener->SendKeyboardInfo(*info);
}
delete info;
@ -169,7 +169,7 @@ using namespace MessageID;
KeyboardInfo *info = new KeyboardInfo();
info->SetFunctionKey(ret);
IMSA_HILOGI("InputMethodController::WorkThread SendKeyboardInfo");
if (textListener != nullptr) {
if (textListener) {
textListener->SendKeyboardInfo(*info);
}
delete info;
@ -179,7 +179,7 @@ using namespace MessageID;
MessageParcel *data = msg->msgContent_;
int32_t ret = data->ReadInt32();
IMSA_HILOGI("InputMethodController::WorkThread MoveCursor");
if (textListener != nullptr) {
if (textListener) {
Direction direction = static_cast<Direction>(ret);
textListener->MoveCursor(direction);
}
@ -217,7 +217,7 @@ using namespace MessageID;
void InputMethodController::HideCurrentInput()
{
IMSA_HILOGI("InputMethodController::HideCurrentInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@ -238,7 +238,7 @@ using namespace MessageID;
sptr<InputDataChannelStub> &channel, InputAttribute &attribute)
{
IMSA_HILOGI("InputMethodController::PrepareInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@ -255,7 +255,7 @@ using namespace MessageID;
void InputMethodController::DisplayOptionalInputMethod()
{
IMSA_HILOGI("InputMethodController::DisplayOptionalInputMethod");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@ -269,7 +269,7 @@ using namespace MessageID;
{
IMSA_HILOGI("InputMethodController::listInputMethod");
std::vector<InputMethodProperty*> properties;
if (mImms == nullptr) {
if (!mImms) {
return properties;
}
mImms->listInputMethod(&properties);
@ -279,7 +279,7 @@ using namespace MessageID;
void InputMethodController::StartInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::StartInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@ -293,7 +293,7 @@ using namespace MessageID;
void InputMethodController::ReleaseInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::ReleaseInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@ -307,7 +307,7 @@ using namespace MessageID;
void InputMethodController::StopInput(sptr<InputClientStub> &client)
{
IMSA_HILOGI("InputMethodController::StopInput");
if (mImms == nullptr) {
if (!mImms) {
return;
}
MessageParcel data;
@ -334,7 +334,7 @@ using namespace MessageID;
void InputMethodController::OnCursorUpdate(CursorInfo cursorInfo)
{
if (mAgent == nullptr) {
if (!mAgent) {
IMSA_HILOGI("InputMethodController::OnCursorUpdate mAgent is nullptr");
return;
}
@ -358,7 +358,7 @@ using namespace MessageID;
mSelectOldEnd = mSelectNewEnd;
mSelectNewBegin = start;
mSelectNewEnd = end;
if (mAgent == nullptr) {
if (!mAgent) {
IMSA_HILOGI("InputMethodController::OnSelectionChange mAgent is nullptr");
return;
}
@ -395,7 +395,7 @@ using namespace MessageID;
bool InputMethodController::dispatchKeyEvent(std::shared_ptr<MMI::KeyEvent> keyEvent)
{
IMSA_HILOGI("InputMethodController::dispatchKeyEvent");
if (mAgent == nullptr) {
if (!mAgent) {
IMSA_HILOGI("InputMethodController::dispatchKeyEvent mAgent is nullptr");
return false;
}

View File

@ -120,7 +120,7 @@ namespace MiscServices {
IMSA_HILOGI("InputMethodSystemAbilityProxy::SetCoreAndAgent");
auto remote = Remote();
if (remote == nullptr) {
if (!remote) {
return;
}
MessageParcel reply;
@ -307,7 +307,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbilityProxy::getCurrentKeyboardType(KeyboardType *retType)
{
if (retType == nullptr) {
if (!retType) {
return ERROR_NULL_POINTER;
}
@ -329,7 +329,7 @@ namespace MiscServices {
}
KeyboardType *keyType = reply.ReadParcelable<KeyboardType>();
if (keyType == nullptr) {
if (!keyType) {
return ERROR_NULL_POINTER;
}
*retType = *keyType;
@ -340,7 +340,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbilityProxy::listInputMethodEnabled(std::vector<InputMethodProperty*> *properties)
{
if (properties == nullptr) {
if (!properties) {
return ERROR_NULL_POINTER;
}
@ -373,7 +373,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbilityProxy::listInputMethod(std::vector<InputMethodProperty*> *properties)
{
if (properties == nullptr) {
if (!properties) {
return ERROR_NULL_POINTER;
}
@ -408,7 +408,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbilityProxy::listKeyboardType(const std::u16string& imeId,
std::vector<KeyboardType*> *types)
{
if (types == nullptr) {
if (!types) {
return ERROR_NULL_POINTER;
}

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_CONTROLLER_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_CONTROLLER_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_CONTROLLER_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_CONTROLLER_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"
#include "global.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_REGISTRY_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_REGISTRY_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_REGISTRY_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_REGISTRY_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_SETTING_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_SETTING_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_SETTING_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_SETTING_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"
#include "global.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_UTILS_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_UTILS_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_UTILS_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHOD_INCLUDE_JS_INPUT_METHOD_UTILS_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"
#include "global.h"

View File

@ -86,13 +86,13 @@ namespace MiscServices {
{
IMSA_HILOGI("JsInputMethodRegistryInit() is called!");
if (engine == nullptr || exportObj == nullptr) {
if (!engine || !exportObj) {
IMSA_HILOGI("engine or exportObj null");
return nullptr;
}
NativeObject* object = ConvertNativeValueTo<NativeObject>(exportObj);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("object null");
return nullptr;
}

View File

@ -64,7 +64,7 @@ namespace MiscServices {
}
std::vector<InputMethodProperty*> properties = InputMethodController::GetInstance()->ListInputMethod();
if (properties.size() == 0) {
if (!properties.size()) {
IMSA_HILOGI("JsInputMethodSetting::ListInputMethod has no ime");
return engine.CreateUndefined();
}

View File

@ -28,7 +28,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodSetting is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodSetting Failed to get object");
return nullptr;
}
@ -46,7 +46,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodController is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("JsInputMethodUtils::CreateInputMethodController Failed to get object");
return nullptr;
}

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_EDITOR_ATTRIBUTE_H
#define OHOS_MISCSERVICES_JS_EDITOR_ATTRIBUTE_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_EDITOR_ATTRIBUTE_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_EDITOR_ATTRIBUTE_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"
#include "js_runtime_utils.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_H
#include "js_runtime_utils.h"
#include "native_engine/native_engine.h"

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_JS_INPUT_METHOD_ENGINE_LISTENER_H
#define FM_IMMS_PROJECT_JS_INPUT_METHOD_ENGINE_LISTENER_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_LISTENER_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_LISTENER_H
#include <map>
#include <mutex>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_REGISTRY_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_REGISTRY_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_REGISTRY_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_ENGINE_REGISTRY_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_UTILS_H
#define OHOS_MISCSERVICES_JS_INPUT_METHOD_ENGINE_UTILS_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_UTILS_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_INPUT_METHOD_UTILS_H
#include "js_runtime_utils.h"
#include "native_engine/native_engine.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_KEYBOARD_CONTROLLER_H
#define OHOS_MISCSERVICES_JS_KEYBOARD_CONTROLLER_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_CONTROLLER_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_CONTROLLER_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"
#include "js_runtime_utils.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_KEYBOARD_DELEGATE_H
#define OHOS_MISCSERVICES_JS_KEYBOARD_DELEGATE_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_H
#include "js_runtime_utils.h"
#include "native_engine/native_engine.h"

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_JS_KEYBOARD_DELEGATE_LISTENER_H
#define FM_IMMS_PROJECT_JS_KEYBOARD_DELEGATE_LISTENER_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_LISTENER_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_KEYBOARD_DELEGATE_LISTENER_H
#include <map>
#include <mutex>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef OHOS_MISCSERVICES_JS_TEXT_INPUT_CLIENT_H
#define OHOS_MISCSERVICES_JS_TEXT_INPUT_CLIENT_H
#ifndef INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_TEXT_INPUT_CLIENT_H
#define INTERFACE_KITS_JS_NAPI_INPUTMETHODENGINE_INCLUDE_JS_TEXT_INPUT_CLIENT_H
#include "native_engine/native_engine.h"
#include "native_engine/native_value.h"
#include "js_runtime_utils.h"

View File

@ -52,13 +52,13 @@ namespace MiscServices {
NativeValue* JsInputMethodEngine::RegisterCallback(NativeEngine* engine, NativeCallbackInfo* info)
{
JsInputMethodEngine* me = CheckParamsAndGetThis<JsInputMethodEngine>(engine, info);
return (me != nullptr) ? me->OnRegisterCallback(*engine, *info) : nullptr;
return (me) ? me->OnRegisterCallback(*engine, *info) : nullptr;
}
NativeValue* JsInputMethodEngine::UnRegisterCallback(NativeEngine* engine, NativeCallbackInfo* info)
{
JsInputMethodEngine* me = CheckParamsAndGetThis<JsInputMethodEngine>(engine, info);
return (me != nullptr) ? me->OnUnRegisterCallback(*engine, *info) : nullptr;
return (me) ? me->OnUnRegisterCallback(*engine, *info) : nullptr;
}
NativeValue* JsInputMethodEngine::OnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info)
@ -83,7 +83,7 @@ namespace MiscServices {
NativeValue* JsInputMethodEngine::OnUnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info)
{
IMSA_HILOGI("JsInputMethodEngine::OnUnRegisterCallback is called!");
if (info.argc == 0) {
if (!info.argc) {
IMSA_HILOGI("JsInputMethodEngine::OnUnRegisterCallback Params not match");
return engine.CreateUndefined();
}

View File

@ -106,7 +106,7 @@ namespace MiscServices {
void JsInputMethodEngineListener::CallJsMethod(std::string methodName, NativeValue* const* argv, size_t argc)
{
IMSA_HILOGI("JsInputMethodEngineListener::CallJsMethod");
if (engine_ == nullptr) {
if (!engine_) {
IMSA_HILOGI("engine_ nullptr");
return;
}
@ -125,7 +125,7 @@ namespace MiscServices {
NativeValue* const* argv, size_t argc)
{
IMSA_HILOGI("JsInputMethodEngineListener::CallJsMethodReturnBool");
if (engine_ == nullptr) {
if (!engine_) {
IMSA_HILOGI("engine_ nullptr");
return false;
}
@ -154,7 +154,7 @@ namespace MiscServices {
auto task = [this, isShow] () {
NativeValue* nativeValue = engine_->CreateObject();
NativeObject* object = ConvertNativeValueTo < NativeObject >(nativeValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("Failed to convert rect to jsObject");
return;
}

View File

@ -48,19 +48,19 @@ namespace MiscServices {
static NativeValue* GetInputMethodEngine(NativeEngine* engine, NativeCallbackInfo* info)
{
JsInputMethodEngineRegistry* me = CheckParamsAndGetThis<JsInputMethodEngineRegistry>(engine, info);
return (me != nullptr) ? me->OnGetInputMethodEngine(*engine, *info) : nullptr;
return (me) ? me->OnGetInputMethodEngine(*engine, *info) : nullptr;
}
static NativeValue* GetKeyboardDelegate(NativeEngine* engine, NativeCallbackInfo* info)
{
JsInputMethodEngineRegistry* me = CheckParamsAndGetThis<JsInputMethodEngineRegistry>(engine, info);
return (me != nullptr) ? me->OnGetKeyboardDelegate(*engine, *info) : nullptr;
return (me) ? me->OnGetKeyboardDelegate(*engine, *info) : nullptr;
}
static NativeValue* MoveCursor(NativeEngine* engine, NativeCallbackInfo* info)
{
JsInputMethodEngineRegistry* me = CheckParamsAndGetThis<JsInputMethodEngineRegistry>(engine, info);
return (me != nullptr) ? me->OnMoveCursor(*engine, *info) : nullptr;
return (me) ? me->OnMoveCursor(*engine, *info) : nullptr;
}
private:
NativeValue* OnGetInputMethodEngine(NativeEngine& engine, NativeCallbackInfo& info)
@ -114,13 +114,13 @@ namespace MiscServices {
{
IMSA_HILOGI("JsInputMethodEngineRegistryInit() is called!");
if (engine == nullptr || exportObj == nullptr) {
if (!engine || !exportObj) {
IMSA_HILOGI("engine or exportObj null");
return nullptr;
}
NativeObject* object = ConvertNativeValueTo<NativeObject>(exportObj);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("object null");
return nullptr;
}

View File

@ -32,7 +32,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodEngineUtils::CreateInputMethodEngine is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("JsInputMethodEngineUtils::CreateInputMethodEngine Failed to get object");
return nullptr;
}
@ -50,7 +50,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodEngineUtils::CreateKeyboardController is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("CreateKeyboardController Failed to get object");
return nullptr;
}
@ -68,7 +68,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodEngineUtils::CreateTextInputClient is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("CreateTextInputClient Failed to get object");
return nullptr;
}
@ -91,7 +91,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodEngineUtils::CreateKeyboardDelegate is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("CreateKeyboardDelegate Failed to get object");
return nullptr;
}
@ -109,7 +109,7 @@ namespace OHOS {
IMSA_HILOGI("JsInputMethodEngineUtils::CreateEditorAttribute is called");
NativeValue *objValue = engine.CreateObject();
NativeObject *object = ConvertNativeValueTo<NativeObject>(objValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("CreateEditorAttribute Failed to get object");
return nullptr;
}

View File

@ -33,7 +33,7 @@ namespace MiscServices {
NativeValue* JsKeyboardController::HideKeyboardSelf(NativeEngine* engine, NativeCallbackInfo* info)
{
JsKeyboardController* me = CheckParamsAndGetThis<JsKeyboardController>(engine, info);
return (me != nullptr) ? me->OnHideKeyboardSelf(*engine, *info) : nullptr;
return (me) ? me->OnHideKeyboardSelf(*engine, *info) : nullptr;
}
NativeValue* JsKeyboardController::OnHideKeyboardSelf(NativeEngine& engine, NativeCallbackInfo& info)

View File

@ -52,13 +52,13 @@ namespace MiscServices {
NativeValue* JsKeyboardDelegate::RegisterCallback(NativeEngine* engine, NativeCallbackInfo* info)
{
JsKeyboardDelegate* me = CheckParamsAndGetThis<JsKeyboardDelegate>(engine, info);
return (me != nullptr) ? me->OnRegisterCallback(*engine, *info) : nullptr;
return (me) ? me->OnRegisterCallback(*engine, *info) : nullptr;
}
NativeValue* JsKeyboardDelegate::UnRegisterCallback(NativeEngine* engine, NativeCallbackInfo* info)
{
JsKeyboardDelegate* me = CheckParamsAndGetThis<JsKeyboardDelegate>(engine, info);
return (me != nullptr) ? me->OnUnRegisterCallback(*engine, *info) : nullptr;
return (me) ? me->OnUnRegisterCallback(*engine, *info) : nullptr;
}
NativeValue* JsKeyboardDelegate::OnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info)
@ -83,7 +83,7 @@ namespace MiscServices {
NativeValue* JsKeyboardDelegate::OnUnRegisterCallback(NativeEngine& engine, NativeCallbackInfo& info)
{
IMSA_HILOGI("JsKeyboardDelegate::OnUnRegisterCallback is called!");
if (info.argc == 0) {
if (!info.argc) {
IMSA_HILOGI("JsKeyboardDelegate::OnUnRegisterCallback Params not match");
return engine.CreateUndefined();
}

View File

@ -104,7 +104,7 @@ namespace MiscServices {
void JsKeyboardDelegateListener::CallJsMethod(std::string methodName, NativeValue* const* argv, size_t argc)
{
IMSA_HILOGI("JsKeyboardDelegateListener::CallJsMethod");
if (engine_ == nullptr) {
if (!engine_) {
IMSA_HILOGI("engine_ nullptr");
return;
}
@ -123,7 +123,7 @@ namespace MiscServices {
NativeValue* const* argv, size_t argc)
{
IMSA_HILOGI("JsKeyboardDelegateListener::CallJsMethodReturnBool");
if (engine_ == nullptr) {
if (!engine_) {
IMSA_HILOGI("engine_ nullptr");
return false;
}
@ -153,7 +153,7 @@ namespace MiscServices {
auto task = [this, keyCode, keyStatus, &result] () {
NativeValue* nativeValue = engine_->CreateObject();
NativeObject* object = ConvertNativeValueTo<NativeObject>(nativeValue);
if (object == nullptr) {
if (!object) {
IMSA_HILOGI("Failed to convert rect to jsObject");
return;
}

View File

@ -36,43 +36,43 @@ namespace MiscServices {
NativeValue* JsTextInputClient::InsertText(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnInsertText(*engine, *info) : nullptr;
return (me) ? me->OnInsertText(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::DeleteForward(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnDeleteForward(*engine, *info) : nullptr;
return (me) ? me->OnDeleteForward(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::DeleteBackward(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnDeleteBackward(*engine, *info) : nullptr;
return (me) ? me->OnDeleteBackward(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::SendFunctionKey(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnSendFunctionKey(*engine, *info) : nullptr;
return (me) ? me->OnSendFunctionKey(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::GetForward(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnGetForward(*engine, *info) : nullptr;
return (me) ? me->OnGetForward(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::GetBackward(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnGetBackward(*engine, *info) : nullptr;
return (me) ? me->OnGetBackward(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::GetEditorAttribute(NativeEngine* engine, NativeCallbackInfo* info)
{
JsTextInputClient* me = CheckParamsAndGetThis<JsTextInputClient>(engine, info);
return (me != nullptr) ? me->OnGetEditorAttribute(*engine, *info) : nullptr;
return (me) ? me->OnGetEditorAttribute(*engine, *info) : nullptr;
}
NativeValue* JsTextInputClient::OnInsertText(NativeEngine& engine, NativeCallbackInfo& info)

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container {
display: flex;
flex-direction: column;

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
<div class="container" onswipe="touchMove">
<text class="title">
{{ dialogTitle }}
@ -8,7 +23,7 @@
<div class="normal">
<div class="imeMessage">
<text class="imeName">{{ $item.label }}</text>
<text class="imeDecription">{{ $item.discription }}</text>
<text class="imeDecription">{{ $item.description }}</text>
</div>
<circle class="circle" cx="12fp" cy="12fp" r="12fp" stroke-width="10fp" fill="white" stroke="blue"
show="{{ $item.isDefaultIme == 'true' ? true : false }}">

View File

@ -1,3 +1,18 @@
/*
* Copyright (c) 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@ohos.router'
export default {

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_GLOBAL_H
#define FM_IMMS_PROJECT_GLOBAL_H
#ifndef SERVICES_INCLUDE_GLOBAL_H
#define SERVICES_INCLUDE_GLOBAL_H
#include <errno.h>
#include <time.h>
@ -31,8 +31,6 @@ namespace MiscServices {
using BRemoteObject = IPCObjectStub;
#define INPUTMETHOD_DEBUG 0
#define LOG_INFO(fmt, args...) \
LogTimeStamp(); printf("I %s:%d %s - " fmt, basename(__FILE__), __LINE__, __FUNCTION__, ##args)

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IINPUTCONTROLCHANNEL_H
#define FM_IMMS_PROJECT_IINPUTCONTROLCHANNEL_H
#ifndef SERVICES_INCLUDE_I_INPUT_CONTROL_CHANNEL_H
#define SERVICES_INCLUDE_I_INPUT_CONTROL_CHANNEL_H
#include "iremote_broker.h"
#include "input_channel.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IINPUTMETHODSYSTEMABILITY_H
#define FM_IMMS_PROJECT_IINPUTMETHODSYSTEMABILITY_H
#ifndef SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H
#define SERVICES_INCLUDE_I_INPUT_METHOD_SYSTEM_ABILITY_H
#include <vector>
#include <errors.h>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IPLATFORMAPI_H
#define FM_IMMS_PROJECT_IPLATFORMAPI_H
#ifndef SERVICES_INCLUDE_I_PLATFORM_API_H
#define SERVICES_INCLUDE_I_PLATFORM_API_H
#include <vector>
#include <string>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IPLATFORMCALLBACK_H
#define FM_IMMS_PROJECT_IPLATFORMCALLBACK_H
#ifndef SERVICES_INCLUDE_I_PLATFORM_CALLBACK_H
#define SERVICES_INCLUDE_I_PLATFORM_CALLBACK_H
#include <vector>
#include <string>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_IMCOMMONEVENTMANAGER_H
#define FM_IMMS_PROJECT_IMCOMMONEVENTMANAGER_H
#ifndef SERVICES_INCLUDE_IM_COMMON_EVENT_MANAGER_H
#define SERVICES_INCLUDE_IM_COMMON_EVENT_MANAGER_H
#include <mutex>
#include "common_event_subscriber.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTATTRIBUTE_H
#define FM_IMMS_PROJECT_INPUTATTRIBUTE_H
#ifndef SERVICES_INCLUDE_INPUT_ATTRIBUTE_H
#define SERVICES_INCLUDE_INPUT_ATTRIBUTE_H
#include "parcel.h"
namespace OHOS {

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT__INPUTCHANNEL_H
#define FM_IMMS_PROJECT__INPUTCHANNEL_H
#ifndef SERVICES_INCLUDE_INPUT_CHANNEL_H
#define SERVICES_INCLUDE_INPUT_CHANNEL_H
#include <string>
#include "parcel.h"
#include "global.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTCONTROLCHANNELPROXY_H
#define FM_IMMS_PROJECT_INPUTCONTROLCHANNELPROXY_H
#ifndef SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_PROXY_H
#define SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_PROXY_H
#include "parcel.h"
#include "iremote_broker.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTCONTROLCHANNELSTUB_H
#define FM_IMMS_PROJECT_INPUTCONTROLCHANNELSTUB_H
#ifndef SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_STUB_H
#define SERVICES_INCLUDE_INPUT_CONTROL_CHANNEL_STUB_H
#include <mutex>
#include <condition_variable>

View File

@ -12,8 +12,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SERVICES_INPUTMETHODABILITYCONNECTIONSTUB_H
#define SERVICES_INPUTMETHODABILITYCONNECTIONSTUB_H
#ifndef SERVICES_INCLUDE_INPUT_METHOD_ABILITY_CONNECTION_STUB_H
#define SERVICES_INCLUDE_INPUT_METHOD_ABILITY_CONNECTION_STUB_H
#include "ability_connect_callback_stub.h"
#include "want.h"
#include "element_name.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTMETHODPROPERTY_H
#define FM_IMMS_PROJECT_INPUTMETHODPROPERTY_H
#ifndef SERVICES_INCLUDE_INPUT_METHOD_PROPERTY_H
#define SERVICES_INCLUDE_INPUT_METHOD_PROPERTY_H
#include <vector>
#include <string>
#include "parcel.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTMETHODSETTING_H
#define FM_IMMS_PROJECT_INPUTMETHODSETTING_H
#ifndef SERVICES_INCLUDE_INPUT_METHOD_SETTING_H
#define SERVICES_INCLUDE_INPUT_METHOD_SETTING_H
#include <map>
#include <vector>
#include "string.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_H
#define FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_H
#ifndef SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_H
#define SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_H
#include <thread>
#include <map>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_SK_H
#define FM_IMMS_PROJECT_INPUTMETHODSYSTEMABILITY_SK_H
#ifndef SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H
#define SERVICES_INCLUDE_INPUT_METHOD_SYSTEM_ABILITY_STUB_H
#include <errors.h>
#include "refbase.h"
#include "i_input_method_system_ability.h"

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_KEYBOARDTYPE_H
#define FM_IMMS_PROJECT_KEYBOARDTYPE_H
#ifndef SERVICES_INCLUDE_KEYBOARD_TYPE_H
#define SERVICES_INCLUDE_KEYBOARD_TYPE_H
#include <vector>
#include <string>

View File

@ -14,8 +14,8 @@
*/
/*! \file MessageHandler.h */
#ifndef FM_IMMS_PROJECT_MESSAGE_H
#define FM_IMMS_PROJECT_MESSAGE_H
#ifndef SERVICES_INCLUDE_MESSAGE_H
#define SERVICES_INCLUDE_MESSAGE_H
#include "global.h"
#include "message_parcel.h"

View File

@ -14,8 +14,8 @@
*/
/*! \file MessageHandler.h */
#ifndef FM_IMMS_PROJECT_MESSAGEHANDLER_H
#define FM_IMMS_PROJECT_MESSAGEHANDLER_H
#ifndef SERVICES_INCLUDE_MESSAGE_HANDLER_H
#define SERVICES_INCLUDE_MESSAGE_HANDLER_H
#include <queue>
#include <mutex>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_PERUSERSESSION_H
#define FM_IMMS_PROJECT_PERUSERSESSION_H
#ifndef SERVICES_INCLUDE_PERUSER_SESSION_H
#define SERVICES_INCLUDE_PERUSER_SESSION_H
#include <thread>
#include <mutex>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_PERUSERSETTING_H
#define FM_IMMS_PROJECT_PERUSERSETTING_H
#ifndef SERVICES_INCLUDE_PERUSER_SETTING_H
#define SERVICES_INCLUDE_PERUSER_SETTING_H
#include <map>
#include <string>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_PLATFORMAPI_H
#define FM_IMMS_PROJECT_PLATFORMAPI_H
#ifndef SERVICES_INCLUDE_PLATFORM_H
#define SERVICES_INCLUDE_PLATFORM_H
#include <vector>
#include <string>

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef FM_IMMS_PROJECT_PLATFORMCALLBACK_SK_H
#define FM_IMMS_PROJECT_PLATFORMCALLBACK_SK_H
#ifndef SERVICES_INCLUDE_PLATFORM_CALLBACK_STUB_H
#define SERVICES_INCLUDE_PLATFORM_CALLBACK_STUB_H
#include <string>
#include "iremote_stub.h"

View File

@ -15,8 +15,8 @@
/*! \file utils.h */
#ifndef FM_IMMS_PROJECT_UTILS_H
#define FM_IMMS_PROJECT_UTILS_H
#ifndef SERVICES_INCLUDE_UTILS_H
#define SERVICES_INCLUDE_UTILS_H
#include <string>
#include <codecvt>

View File

@ -40,9 +40,9 @@ namespace MiscServices {
sptr<ImCommonEventManager> ImCommonEventManager::GetInstance()
{
if (instance_ == nullptr) {
if (!instance_) {
std::lock_guard<std::mutex> autoLock(instanceLock_);
if (instance_ == nullptr) {
if (!instance_) {
IMSA_HILOGI("ImCommonEventManager::GetInstance instance_ is nullptr");
instance_ = new ImCommonEventManager();
}
@ -58,7 +58,7 @@ namespace MiscServices {
EventFwk::CommonEventSubscribeInfo subscriberInfo(matchingSkills);
std::shared_ptr<EventSubscriber> subscriber = std::make_shared<EventSubscriber>(subscriberInfo);
if (subscriber == nullptr) {
if (!subscriber) {
IMSA_HILOGI("ImCommonEventManager::SubscribeEvent subscriber is nullptr");
return false;
}

View File

@ -89,10 +89,7 @@ namespace MiscServices {
*/
bool InputAttribute::GetSecurityFlag()
{
if (inputPattern == PATTERN_PASSWORD) {
return true;
}
return false;
return inputPattern == PATTERN_PASSWORD;
}
/*! Set input pattern.

View File

@ -32,7 +32,7 @@ namespace MiscServices {
const sptr<IRemoteObject> &remoteObject, int resultCode)
{
IMSA_HILOGE("ConnectAbility: OnAbilityConnectDone.");
if (messageHandler != nullptr) {
if (messageHandler) {
MessageParcel *data = new MessageParcel();
data->WriteParcelable(&element);
data->WriteRemoteObject(remoteObject);
@ -46,7 +46,7 @@ namespace MiscServices {
int resultCode)
{
IMSA_HILOGE("ConnectAbility: OnAbilityDisconnectDone.");
if (messageHandler != nullptr) {
if (messageHandler) {
MessageParcel *data = new MessageParcel();
data->WriteParcelable(&element);
data->WriteInt32(mIndex);

View File

@ -103,7 +103,7 @@ namespace MiscServices {
return false;
int32_t size = (int32_t)mTypes.size();
parcel.WriteInt32(size);
if (size == 0) {
if (!size) {
return true;
}
for (int i = 0; i < size; i++) {
@ -132,7 +132,7 @@ namespace MiscServices {
info->description = parcel.ReadString16();
int32_t size = parcel.ReadInt32();
if (size == 0)
if (!size)
return info;
for (int i = 0; i < size; i++) {
info->mTypes.push_back(parcel.ReadParcelable<KeyboardType>());

View File

@ -97,9 +97,9 @@ namespace MiscServices {
sptr<InputMethodSystemAbility> InputMethodSystemAbility::GetInstance()
{
if (instance_ == nullptr) {
if (!instance_) {
std::lock_guard<std::mutex> autoLock(instanceLock_);
if (instance_ == nullptr) {
if (!instance_) {
instance_ = new InputMethodSystemAbility;
}
}
@ -156,7 +156,7 @@ namespace MiscServices {
void InputMethodSystemAbility::InitServiceHandler()
{
IMSA_HILOGI("InitServiceHandler started.");
if (serviceHandler_ != nullptr) {
if (serviceHandler_) {
IMSA_HILOGI("InitServiceHandler already init.");
return;
}
@ -209,7 +209,7 @@ namespace MiscServices {
if (it == msgHandlers.end()) {
IMSA_HILOGE("InputMethodSystemAbility::StartInputService() need start handler");
MessageHandler *handler = new MessageHandler();
if (session != nullptr) {
if (session) {
IMSA_HILOGE("InputMethodSystemAbility::OnPrepareInput session is not nullptr");
session->CreateWorkThread(*handler);
msgHandlers.insert(std::pair<int32_t, MessageHandler*>(MAIN_USER_ID, handler));
@ -218,13 +218,13 @@ namespace MiscServices {
bool isStartSuccess = false;
sptr<AAFwk::IAbilityManager> abms = GetAbilityManagerService();
if (abms != nullptr) {
if (abms) {
AAFwk::Want want;
want.SetAction("action.system.inputmethod");
std::string::size_type pos = imeId.find("/");
want.SetElementName(imeId.substr(0, pos), imeId.substr(pos + 1));
int32_t result = abms->StartAbility(want);
if (result != 0) {
if (result) {
IMSA_HILOGE("InputMethodSystemAbility::StartInputService fail. result = %{public}d", result);
isStartSuccess = false;
} else {
@ -243,7 +243,7 @@ namespace MiscServices {
{
IMSA_HILOGE("InputMethodSystemAbility::StopInputService(%{public}s)", imeId.c_str());
PerUserSession *session = GetUserSession(MAIN_USER_ID);
if (session == nullptr){
if (!session){
IMSA_HILOGE("InputMethodSystemAbility::StopInputService abort session is nullptr");
return;
}
@ -259,7 +259,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbility::GetUserState(int32_t userId)
{
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr) {
if (!setting) {
return UserState::USER_STATE_NOT_AVAILABLE;
}
return setting->GetUserState();
@ -290,7 +290,7 @@ namespace MiscServices {
int32_t uid = IPCSkeleton::GetCallingUid();
int32_t userId = getUserId(uid);
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -309,7 +309,7 @@ namespace MiscServices {
int32_t uid = IPCSkeleton::GetCallingUid();
int32_t userId = getUserId(uid);
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -333,17 +333,17 @@ namespace MiscServices {
int32_t uid = IPCSkeleton::GetCallingUid();
int32_t userId = getUserId(uid);
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
PerUserSession *userSession = GetUserSession(userId);
if (userSession == nullptr) {
if (user!session) {
return ErrorCode::ERROR_NULL_POINTER;
}
KeyboardType *type = userSession->GetCurrentKeyboardType();
if (type == nullptr) {
if (!type) {
return ErrorCode::ERROR_NULL_POINTER;
}
*retType = *type;
@ -361,7 +361,7 @@ namespace MiscServices {
int32_t uid = IPCSkeleton::GetCallingUid();
int32_t userId = getUserId(uid);
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -400,7 +400,7 @@ namespace MiscServices {
}
for (auto extension : extensionInfos) {
std::shared_ptr<Global::Resource::ResourceManager> resourceManager(Global::Resource::CreateResourceManager());
if (resourceManager == nullptr) {
if (!resourceManager) {
IMSA_HILOGI("InputMethodSystemAbility::listInputMethodByUserId resourcemanager is nullptr");
break;
}
@ -434,7 +434,7 @@ namespace MiscServices {
int32_t uid = IPCSkeleton::GetCallingUid();
int32_t userId = getUserId(uid);
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("%s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -540,7 +540,7 @@ namespace MiscServices {
Message *destMsg = new Message(MSG_ID_EXIT_SERVICE, nullptr);
handler->SendMessage(destMsg);
PerUserSession *userSession = GetUserSession(it->first);
if (userSession == nullptr) {
if (user!session) {
IMSA_HILOGE("getUserSession fail.");
return;
}
@ -568,7 +568,7 @@ namespace MiscServices {
int32_t InputMethodSystemAbility::OnUserStarted(const Message *msg)
{
IMSA_HILOGI("InputMethodSystemAbility::OnUserStarted Start...\n");
if (msg->msgContent_ == nullptr) {
if (!msg->msgContent_) {
IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS));
return ErrorCode::ERROR_BAD_PARAMETERS;
}
@ -585,7 +585,7 @@ namespace MiscServices {
}
PerUserSetting *setting = GetUserSetting(userId);
if (setting != nullptr) {
if (setting) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_ALREADY_STARTED), userId);
return ErrorCode::ERROR_USER_ALREADY_STARTED;
}
@ -607,14 +607,14 @@ namespace MiscServices {
int32_t InputMethodSystemAbility::OnUserStopped(const Message *msg)
{
IMSA_HILOGI("Start...\n");
if (msg->msgContent_ == nullptr) {
if (!msg->msgContent_) {
IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS));
return ErrorCode::ERROR_BAD_PARAMETERS;
}
int32_t userId = msg->msgContent_->ReadInt32();
PerUserSetting *setting = GetUserSetting(userId);
PerUserSession *session = GetUserSession(userId);
if (setting == nullptr || session == nullptr) {
if (!setting || !session) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_STARTED), userId);
return ErrorCode::ERROR_USER_NOT_STARTED;
}
@ -643,14 +643,14 @@ namespace MiscServices {
int32_t InputMethodSystemAbility::OnUserUnlocked(const Message *msg)
{
IMSA_HILOGI("Start...\n");
if (msg->msgContent_ == nullptr) {
if (!msg->msgContent_) {
IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS));
return ErrorCode::ERROR_BAD_PARAMETERS;
}
int32_t userId = msg->msgContent_->ReadInt32();
PerUserSetting *setting = GetUserSetting(userId);
PerUserSession *session = GetUserSession(userId);
if (setting == nullptr || session == nullptr) {
if (!setting || !session) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_STARTED), userId);
return ErrorCode::ERROR_USER_NOT_STARTED;
}
@ -678,13 +678,13 @@ namespace MiscServices {
int32_t InputMethodSystemAbility::OnUserLocked(const Message *msg)
{
IMSA_HILOGI("Start...\n");
if (msg->msgContent_ == nullptr) {
if (!msg->msgContent_) {
IMSA_HILOGE("Aborted! %s\n", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS));
return ErrorCode::ERROR_BAD_PARAMETERS;
}
int32_t userId = msg->msgContent_->ReadInt32();
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -692,10 +692,10 @@ namespace MiscServices {
if (it != msgHandlers.end()) {
MessageHandler *handler = it->second;
Message *destMsg = new Message(MSG_ID_USER_LOCK, nullptr);
if (destMsg != nullptr) {
if (destMsg) {
handler->SendMessage(destMsg);
PerUserSession *userSession = GetUserSession(userId);
if (userSession != nullptr) {
if (userSession) {
userSession->JoinWorkThread();
}
msgHandlers.erase(it);
@ -719,10 +719,10 @@ namespace MiscServices {
MessageParcel *data = msg->msgContent_;
int32_t userId = data->ReadInt32();
PerUserSetting *setting = GetUserSetting(MAIN_USER_ID);
if (setting == nullptr) {
if (!setting) {
IMSA_HILOGE("InputMethodSystemAbility::OnHandleMessage Aborted! setting is nullptr");
}
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("InputMethodSystemAbility::OnHandleMessage Aborted! userId = %{public}d,", userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -755,7 +755,7 @@ namespace MiscServices {
}
std::u16string packageName = data->ReadString16();
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -785,7 +785,7 @@ namespace MiscServices {
{
IMSA_HILOGI("Start...\n");
MessageParcel *data = msg->msgContent_;
if (data == nullptr) {
if (!data) {
IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved data is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -798,12 +798,12 @@ namespace MiscServices {
}
std::u16string packageName = data->ReadString16();
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
PerUserSession *session = GetUserSession(userId);
if (session == nullptr) {
if (!session) {
IMSA_HILOGI("InputMethodSystemAbility::OnPackageRemoved session is nullptr");
return ErrorCode::ERROR_NULL_POINTER;
}
@ -842,12 +842,12 @@ namespace MiscServices {
std::u16string updatedKey = data->ReadString16();
std::u16string updatedValue = data->ReadString16();
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
PerUserSession *session = GetUserSession(userId);
if (session == nullptr) {
if (!session) {
return ErrorCode::ERROR_NULL_POINTER;
}
int32_t ret = session->OnSettingChanged(updatedKey, updatedValue);
@ -864,7 +864,7 @@ namespace MiscServices {
}
ret = setting->OnSettingChanged(updatedKey, updatedValue);
if (ret != 0) {
if (ret) {
IMSA_HILOGI("End...No need to update\n");
return ret;
}
@ -881,7 +881,7 @@ namespace MiscServices {
IMSA_HILOGI("InputMethodSystemAbility::OnDisplayOptionalInputMethod");
std::vector<InputMethodProperty*> properties;
listInputMethodByUserId(userId, &properties);
if (properties.size() == 0) {
if (!properties.size()) {
IMSA_HILOGI("InputMethodSystemAbility::OnDisplayOptionalInputMethod has no ime");
return;
}
@ -899,11 +899,11 @@ namespace MiscServices {
std::string imeId = Str16ToStr8(property->mPackageName) + "/" + Str16ToStr8(property->mAbilityName);
params += "{\"ime\": \"" + imeId + "\",";
params += "\"labelId\": \"" + std::to_string(property->labelId) + "\",";
params += "\"discriptionId\": \"" + std::to_string(property->descriptionId) + "\",";
params += "\"descriptionId\": \"" + std::to_string(property->descriptionId) + "\",";
std::string isDefaultIme = defaultIme == imeId ? "true" : "false";
params += "\"isDefaultIme\": \"" + isDefaultIme + "\",";
params += "\"label\": \"" + Str16ToStr8(property->label) + "\",";
params += "\"discription\": \"" + Str16ToStr8(property->description) + "\"";
params += "\"description\": \"" + Str16ToStr8(property->description) + "\"";
}
params += "}]}";
@ -951,7 +951,7 @@ namespace MiscServices {
int32_t userId = data->ReadInt32();
std::u16string imeId = data->ReadString16();
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -977,7 +977,7 @@ namespace MiscServices {
int32_t userId = data->ReadInt32();
bool isCurrentIme = data->ReadBool();
PerUserSetting *setting = GetUserSetting(userId);
if (setting == nullptr || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
if (!setting || setting->GetUserState() != UserState::USER_STATE_UNLOCKED) {
IMSA_HILOGE("Aborted! %s %d\n", ErrorCode::ToString(ErrorCode::ERROR_USER_NOT_UNLOCKED), userId);
return ErrorCode::ERROR_USER_NOT_UNLOCKED;
}
@ -999,7 +999,7 @@ namespace MiscServices {
IMSA_HILOGI("InputMethodSystemAbility::GetBundleMgr");
sptr<ISystemAbilityManager> systemAbilityManager =
SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager();
if (systemAbilityManager == nullptr) {
if (!systemAbilityManager) {
IMSA_HILOGI("InputMethodSystemAbility::GetBundleMgr systemAbilityManager is nullptr");
return nullptr;
}
@ -1013,7 +1013,7 @@ namespace MiscServices {
IMSA_HILOGE("InputMethodSystemAbility::GetAbilityManagerService start");
sptr<IRemoteObject> abilityMsObj =
OHOS::DelayedSingleton<AAFwk::SaMgrClient>::GetInstance()->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
if (abilityMsObj == nullptr) {
if (!abilityMsObj) {
IMSA_HILOGE("failed to get ability manager service");
return nullptr;
}

View File

@ -36,7 +36,7 @@ namespace MiscServices {
Message::Message(const Message& msg)
{
msgId_ = msg.msgId_;
if (msgContent_ != nullptr) {
if (msgContent_) {
delete msgContent_;
msgContent_ = nullptr;
}
@ -53,7 +53,7 @@ namespace MiscServices {
return *this;
}
msgId_ = msg.msgId_;
if (msgContent_ != nullptr) {
if (msgContent_) {
delete msgContent_;
msgContent_ = nullptr;
}

View File

@ -28,7 +28,7 @@ namespace MiscServices {
MessageHandler::~MessageHandler()
{
std::unique_lock<std::mutex> lock(mMutex);
while (! mQueue.empty()) {
while (!mQueue.empty()) {
Message *msg = mQueue.front();
mQueue.pop();
delete msg;
@ -71,7 +71,7 @@ namespace MiscServices {
MessageHandler *MessageHandler::Instance()
{
static MessageHandler *handler = nullptr;
if (handler == nullptr) {
if (!handler) {
handler = new MessageHandler();
}
return handler;

View File

@ -118,7 +118,7 @@ namespace MiscServices {
*/
void PerUserSession::WorkThread()
{
if (msgHandler == nullptr) {
if (!msgHandler) {
return;
}
while (1) {
@ -239,7 +239,7 @@ namespace MiscServices {
std::unique_lock<std::mutex> lock(mtx);
InputMethodProperty *ime[] = {defaultIme, securityIme};
for (int i = 0; i < MIN_IME; i++) {
if (currentIme[i] == ime[i] && ime[i] != nullptr) {
if (currentIme[i] == ime[i] && ime[i]) {
continue;
}
if (imsCore[i]) {
@ -247,7 +247,7 @@ namespace MiscServices {
}
IncreaseOrResetImeError(true, i);
currentIme[i] = ime[i];
if (currentIme[i] == nullptr) {
if (!currentIme[i]) {
if (needReshowClient && GetImeIndex(needReshowClient) == i) {
needReshowClient = nullptr;
}
@ -327,13 +327,13 @@ namespace MiscServices {
{
IMSA_HILOGI("PerUserSession::AddClient");
ClientInfo *clientInfo = GetClientInfo(inputClient);
if (clientInfo != nullptr) {
if (clientInfo) {
IMSA_HILOGE("PerUserSession::AddClient clientInfo is exist, not need add.");
return ErrorCode::NO_ERROR;
}
sptr<IRemoteObject> obj = inputClient->AsObject();
if (obj == nullptr) {
if (!obj) {
IMSA_HILOGE("PerUserSession::AddClient inputClient AsObject is nullptr");
return ErrorCode::ERROR_REMOTE_CLIENT_DIED;
}
@ -399,7 +399,7 @@ namespace MiscServices {
{
IMSA_HILOGI("PerUserSession::StartInputMethod index = %{public}d [%{public}d]\n", index, userId_);
if (imsCore[index] == nullptr) {
if (!imsCore[index]) {
IMSA_HILOGI("PerUserSession::StartInputMethod imscore is null");
return ErrorCode::ERROR_IME_BIND_FAILED;
}
@ -433,11 +433,11 @@ namespace MiscServices {
IMSA_HILOGE("Aborted! %{public}s", ErrorCode::ToString(ErrorCode::ERROR_BAD_PARAMETERS));
return ErrorCode::ERROR_BAD_PARAMETERS;
}
if (imsCore[index] == nullptr || currentIme[index] == nullptr) {
if (!imsCore[index] || !currentIme[index]) {
IMSA_HILOGE("Aborted! %{public}s", ErrorCode::ToString(ErrorCode::ERROR_IME_NOT_STARTED));
return ErrorCode::ERROR_IME_NOT_STARTED;
}
if (currentIme[index] == currentIme[1 - index] && imsCore[1 - index] != nullptr) {
if (currentIme[index] == currentIme[1 - index] && imsCore[1 - index]) {
imsCore[index] = nullptr;
inputControlChannel[index] = nullptr;
localControlChannel[index] = nullptr;
@ -482,12 +482,12 @@ namespace MiscServices {
IMSA_HILOGI("PerUserSession::ShowKeyboard");
ClientInfo *clientInfo = GetClientInfo(inputClient);
int index = GetImeIndex(inputClient);
if (index == -1 || clientInfo == nullptr) {
if (index == -1 || !clientInfo) {
IMSA_HILOGE("PerUserSession::ShowKeyboard Aborted! index = -1 or clientInfo is nullptr");
return ErrorCode::ERROR_CLIENT_NOT_FOUND;
}
if (imsCore[0] == nullptr) {
if (!imsCore[0]) {
IMSA_HILOGE("PerUserSession::ShowKeyboard Aborted! imsCore[%{public}d] is nullptr", index);
return ErrorCode::ERROR_NULL_POINTER;
}
@ -516,10 +516,10 @@ namespace MiscServices {
return ErrorCode::ERROR_CLIENT_NOT_FOUND;
}
ClientInfo *clientInfo = GetClientInfo(inputClient);
if (clientInfo == nullptr) {
if (!clientInfo) {
IMSA_HILOGE("PerUserSession::HideKeyboard GetClientInfo pointer nullptr");
}
if (imsCore[0] == nullptr) {
if (!imsCore[0]) {
IMSA_HILOGE("PerUserSession::HideKeyboard imsCore[index] is nullptr");
return ErrorCode::ERROR_IME_NOT_STARTED;
}
@ -527,7 +527,7 @@ namespace MiscServices {
bool ret = imsCore[0]->hideKeyboard(1);
if (!ret) {
IMSA_HILOGE("PerUserSession::HideKeyboard [imsCore->hideKeyboard] failed");
ret = ErrorCode::ERROR_KBD_HIDE_FAILED;
return ErrorCode::ERROR_KBD_HIDE_FAILED;
}
return ErrorCode::NO_ERROR;
@ -535,7 +535,7 @@ namespace MiscServices {
/*! Get the display mode of the current keyboard showing
\return return display mode.
\n 0 - part sceen mode, 1 - full sceen mode
\n 0 - part screen mode, 1 - full screen mode
*/
int PerUserSession::GetDisplayMode()
{
@ -548,7 +548,7 @@ namespace MiscServices {
*/
int PerUserSession::GetKeyboardWindowHeight(int retHeight)
{
if (imsCore[lastImeIndex] != nullptr) {
if (imsCore[lastImeIndex]) {
int ret = imsCore[lastImeIndex]->getKeyboardWindowHeight(retHeight);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("getKeyboardWindowHeight return : %{public}s", ErrorCode::ToString(ret));
@ -566,7 +566,7 @@ namespace MiscServices {
*/
KeyboardType *PerUserSession::GetCurrentKeyboardType()
{
if (inputMethodSetting == nullptr || currentIme[DEFAULT_IME] == nullptr) {
if (!inputMethodSetting || !currentIme[DEFAULT_IME]) {
IMSA_HILOGI("Ime has not started ! [%{public}d]\n", userId_);
return nullptr;
}
@ -576,7 +576,7 @@ namespace MiscServices {
int hashCode = inputMethodSetting->GetCurrentKeyboardType(); // To be checked.
if (hashCode == -1) {
std::vector<int> hashCodeList = inputMethodSetting->GetEnabledKeyboardTypes(currentIme[DEFAULT_IME]->mImeId);
if (hashCodeList.size() == 0) {
if (!hashCodeList.size()) {
IMSA_HILOGE("Cannot find any keyboard types for the current ime [%{public}d]\n", userId_);
return nullptr;
}
@ -614,7 +614,7 @@ namespace MiscServices {
sptr<IInputClient> client = it->second->client;
int remainClientNum = 0;
if (currentClient != nullptr) {
if (currentClient) {
HideKeyboard(client);
}
RemoveClient(client, remainClientNum);
@ -630,7 +630,7 @@ namespace MiscServices {
IMSA_HILOGI("Start...[%{public}d]\n", userId_);
int index = 0;
for (int i = 0; i < MAX_IME; i++) {
if (imsCore[i] == nullptr) {
if (!imsCore[i]) {
continue;
}
sptr<IRemoteObject> b = imsCore[i]->AsObject();
@ -680,7 +680,7 @@ namespace MiscServices {
{
IMSA_HILOGI("Start...[%{public}d]\n", userId_);
std::unique_lock<std::mutex> lock(mtx);
if (inputMethodSetting == nullptr) {
if (!inputMethodSetting) {
return ErrorCode::ERROR_NULL_POINTER;
}
std::u16string currentValue = inputMethodSetting->GetValue(key);
@ -699,11 +699,11 @@ namespace MiscServices {
} else if (key == InputMethodSetting::CURRENT_SYS_KEYBOARD_TYPE_TAG) {
return OnCurrentKeyboardTypeChanged(SECURITY_IME, value);
} else if (key == InputMethodSetting::CURRENT_INPUT_METHOD_TAG) {
if (currentIme[DEFAULT_IME] == nullptr ||
if (!currentIme[DEFAULT_IME] ||
value == currentIme[DEFAULT_IME]->mImeId) {
return ErrorCode::NO_ERROR;
}
if (currentClient != nullptr && GetImeIndex(currentClient) == DEFAULT_IME) {
if (currentClient && GetImeIndex(currentClient) == DEFAULT_IME) {
needReshowClient = currentClient;
HideKeyboard(currentClient);
}
@ -714,7 +714,7 @@ namespace MiscServices {
} else if (key == InputMethodSetting::ENABLED_INPUT_METHODS_TAG) {
if (currentIme[DEFAULT_IME] && currentIme[DEFAULT_IME] != currentIme[SECURITY_IME]
&& value.find(currentIme[DEFAULT_IME]->mImeId) == std::string::npos) {
if (currentClient != nullptr && GetImeIndex(currentClient) == DEFAULT_IME) {
if (currentClient && GetImeIndex(currentClient) == DEFAULT_IME) {
needReshowClient = currentClient;
HideKeyboard(currentClient);
}
@ -768,8 +768,8 @@ namespace MiscServices {
}
}
KeyboardType *type = GetKeyboardType(index, currentKbdIndex[index]);
if (type != nullptr) {
if (currentClient != nullptr) {
if (type) {
if (currentClient) {
int ret = imsCore[index]->setKeyboardType(*type);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("setKeyboardType return : %{public}s [%{public}d]\n", ErrorCode::ToString(ret), userId_);
@ -821,11 +821,11 @@ namespace MiscServices {
}
int num = currentKbdIndex[index]+1;
if (size != 0) {
if (size) {
num %= size;
}
KeyboardType *type = GetKeyboardType(index, num);
if (type == nullptr) {
if (!type) {
IMSA_HILOGW("No next keyboard is available. [%{public}d]\n", userId_);
return;
}
@ -844,13 +844,13 @@ namespace MiscServices {
/*! Set display mode
\param mode the display mode of soft keyboard UI.
\n 0 - part sceen mode, 1 - full sceen mode
\n 0 - part screen mode, 1 - full screen mode
*/
void PerUserSession::OnSetDisplayMode(int mode)
{
currentDisplayMode = mode;
ClientInfo *clientInfo = GetClientInfo(currentClient);
if (clientInfo == nullptr) {
if (!clientInfo) {
IMSA_HILOGE("%{public}s [%{public}d]\n", ErrorCode::ToString(ErrorCode::ERROR_CLIENT_NOT_FOUND), userId_);
return;
}
@ -893,7 +893,7 @@ namespace MiscServices {
}
userState = UserState::USER_STATE_STARTED;
// hide current keyboard
if (currentClient != nullptr) {
if (currentClient) {
HideKeyboard(currentClient);
}
for (int i = 0; i < MIN_IME; i++) {
@ -906,7 +906,7 @@ namespace MiscServices {
sptr<IRemoteObject> b = it->first;
b->RemoveDeathRecipient(clientDeathRecipient);
ClientInfo *clientInfo = it->second;
if (clientInfo != nullptr) {
if (clientInfo) {
int ret = clientInfo->client->onInputReleased(0);
if (ret != ErrorCode::NO_ERROR) {
IMSA_HILOGE("2-onInputReleased return : %{public}s", ErrorCode::ToString(ret));
@ -1033,7 +1033,7 @@ namespace MiscServices {
currentKbdIndex[1 - imeIndex] = currentKbdIndex[imeIndex];
}
}
if (type != nullptr) {
if (type) {
InputMethodSetting tmpSetting;
if (imsCore[imeIndex] == imsCore[1 - imeIndex]) {
inputMethodSetting->SetCurrentKeyboardType(type->getHashCode());
@ -1060,13 +1060,13 @@ namespace MiscServices {
*/
int PerUserSession::GetImeIndex(const sptr<IInputClient>& inputClient)
{
if (inputClient == nullptr) {
if (!inputClient) {
IMSA_HILOGW("PerUserSession::GetImeIndex inputClient is nullptr");
return -1;
}
ClientInfo *clientInfo = GetClientInfo(inputClient);
if (clientInfo == nullptr) {
if (!clientInfo) {
IMSA_HILOGW("PerUserSession::GetImeIndex clientInfo is nullptr");
return -1;
}
@ -1112,7 +1112,7 @@ namespace MiscServices {
*/
ClientInfo *PerUserSession::GetClientInfo(const sptr<IInputClient>& inputClient)
{
if (inputClient == nullptr) {
if (!inputClient) {
IMSA_HILOGE("PerUserSession::GetClientInfo inputClient is nullptr");
return nullptr;
}
@ -1129,14 +1129,14 @@ namespace MiscServices {
{
IMSA_HILOGE("PerUserSession::StartInputService");
sptr<AAFwk::IAbilityManager> ams = GetAbilityManagerService();
if (ams == nullptr) {
if (!ams) {
return false;
}
AAFwk::Want want;
want.SetAction("action.system.inputmethod");
want.SetElementName("com.example.kikakeyboard", "com.example.kikakeyboard.ServiceExtAbility");
int32_t result = ams->StartAbility(want);
if (result != 0) {
if (result) {
IMSA_HILOGE("PerUserSession::StartInputService fail. result = %{public}d", result);
return false;
}
@ -1148,7 +1148,7 @@ namespace MiscServices {
IMSA_HILOGE("GetAbilityManagerService start");
sptr<IRemoteObject> abilityMsObj =
OHOS::DelayedSingleton<AAFwk::SaMgrClient>::GetInstance()->GetSystemAbility(ABILITY_MGR_SERVICE_ID);
if (abilityMsObj == nullptr) {
if (!abilityMsObj) {
IMSA_HILOGE("failed to get ability manager service");
return nullptr;
}
@ -1169,18 +1169,19 @@ namespace MiscServices {
int displayId = data->ReadInt32();
sptr<IRemoteObject> clientObject = data->ReadRemoteObject();
if (clientObject == nullptr) {
if (!clientObject) {
IMSA_HILOGI("PerUserSession::OnPrepareInput clientObject is null");
return;
}
sptr<InputClientProxy> client = new InputClientProxy(clientObject);
sptr<IRemoteObject> channelObject = data->ReadRemoteObject();
if (channelObject == nullptr) {
if (!channelObject) {
IMSA_HILOGI("PerUserSession::OnPrepareInput channelObject is null");
return;
}
sptr<InputDataChannelProxy> channel = new InputDataChannelProxy(channelObject);
InputAttribute *attribute = data->ReadParcelable<InputAttribute>();
if (attribute == nullptr) {
if (!attribute) {
IMSA_HILOGI("PerUserSession::OnPrepareInput attribute is nullptr");
return;
}
@ -1197,12 +1198,12 @@ namespace MiscServices {
void PerUserSession::SendAgentToSingleClient(const sptr<IInputClient>& inputClient)
{
IMSA_HILOGI("PerUserSession::SendAgentToSingleClient");
if (imsAgent == nullptr) {
if (!imsAgent) {
IMSA_HILOGI("PerUserSession::SendAgentToSingleClient imsAgent is nullptr");
return;
}
ClientInfo *clientInfo = GetClientInfo(inputClient);
if (clientInfo == nullptr) {
if (!clientInfo) {
IMSA_HILOGE("PerUserSession::SendAgentToSingleClient clientInfo is nullptr");
return;
}
@ -1223,7 +1224,7 @@ namespace MiscServices {
sptr<InputClientProxy> client = new InputClientProxy(clientObject);
sptr<IInputClient> interface = client;
int remainClientNum = 0;
if (imsCore[0] != nullptr) {
if (imsCore[0]) {
imsCore[0]->SetClientState(false);
}
HideKeyboard(client);
@ -1245,7 +1246,7 @@ namespace MiscServices {
MessageParcel *data = msg->msgContent_;
sptr<IRemoteObject> clientObject = data->ReadRemoteObject();
sptr<InputClientProxy> client = new InputClientProxy(clientObject);
if (imsCore[0] != nullptr) {
if (imsCore[0]) {
imsCore[0]->SetClientState(true);
}
ShowKeyboard(client);
@ -1258,7 +1259,7 @@ namespace MiscServices {
sptr<IRemoteObject> coreObject = data->ReadRemoteObject();
sptr<InputMethodCoreProxy> core = new InputMethodCoreProxy(coreObject);
if (imsCore[0] != nullptr) {
if (imsCore[0]) {
IMSA_HILOGI("PerUserSession::SetCoreAndAgent Input Method Service has already been started ! ");
}
imsCore[0] = core;
@ -1275,7 +1276,7 @@ namespace MiscServices {
void PerUserSession::SendAgentToAllClients()
{
IMSA_HILOGI("PerUserSession::SendAgentToAllClients");
if (imsAgent == nullptr) {
if (!imsAgent) {
IMSA_HILOGI("PerUserSession::SendAgentToAllClients imsAgent is nullptr");
return;
}
@ -1283,7 +1284,7 @@ namespace MiscServices {
for (std::map<sptr<IRemoteObject>, ClientInfo*>::iterator it = mapClients.begin();
it != mapClients.end(); ++it) {
ClientInfo *clientInfo = (ClientInfo*) it->second;
if (clientInfo != nullptr) {
if (clientInfo) {
clientInfo->client->onInputReady(imsAgent);
}
}
@ -1317,7 +1318,7 @@ namespace MiscServices {
void PerUserSession::StopInputService(std::string imeId)
{
IMSA_HILOGI("PerUserSession::StopInputService");
if (imsCore[0] != nullptr) {
if (imsCore[0]) {
imsCore[0]->StopInputService(imeId);
}
}

View File

@ -53,7 +53,7 @@ namespace MiscServices {
IMSA_HILOGE("Failed to listInputMethod [%d]\n", userId_);
}
int size = inputMethodProperties.size();
if (size == 0) {
if (!size) {
currentImeId = Utils::to_utf16("");
}
@ -82,7 +82,7 @@ namespace MiscServices {
isSecurityIme = false;
}
std::u16string imeId = GetImeId(packageName);
if (imeId.size() != 0) {
if (imeId.size()) {
IMSA_HILOGI("%s [%d]\n", ErrorCode::ToString(ErrorCode::ERROR_IME_PACKAGE_DUPLICATED), userId_);
return ErrorCode::ERROR_IME_PACKAGE_DUPLICATED;
}
@ -132,7 +132,7 @@ namespace MiscServices {
isSecurityIme = false;
}
std::u16string imeId = GetImeId(packageName);
if (imeId.size() == 0) {
if (!imeId.size()) {
IMSA_HILOGI("%s [%d]\n", ErrorCode::ToString(ErrorCode::ERROR_NOT_IME_PACKAGE), userId_);
return ErrorCode::ERROR_NOT_IME_PACKAGE;
}
@ -193,7 +193,7 @@ namespace MiscServices {
currentImeId = inputMethodSetting.GetCurrentInputMethod();
} else if (key == InputMethodSetting::ENABLED_INPUT_METHODS_TAG) {
if ((currentImeId.size() > 0 && value.find(currentImeId) == std::string::npos) ||
currentImeId.size() == 0) {
!currentImeId.size()) {
ResetCurrentInputMethod();
InputMethodSetting tmpSetting;
tmpSetting.ClearData();
@ -222,18 +222,18 @@ namespace MiscServices {
if (flag) {
nextImeId = imeId;
break;
} else if (firstEnabledProperty == nullptr) {
} else if (!firstEnabledProperty) {
firstEnabledProperty = inputMethodProperties[i];
}
}
}
if (nextImeId.size() == 0 && firstEnabledProperty) {
if (!nextImeId.size() && firstEnabledProperty) {
nextImeId = firstEnabledProperty->mImeId;
}
// next enabled ime is not available.
if (nextImeId.size() == 0) {
if (!nextImeId.size()) {
IMSA_HILOGW("No next IME is available. [%d]\n", userId_);
return;
}
@ -261,7 +261,7 @@ namespace MiscServices {
std::vector<InputMethodProperty*>::iterator it;
for (it = inputMethodProperties.begin(); it < inputMethodProperties.end();) {
InputMethodProperty *node = (InputMethodProperty*)*it;
if (node != nullptr) {
if (node) {
it = inputMethodProperties.erase(it);
delete node;
node = nullptr;
@ -342,10 +342,10 @@ namespace MiscServices {
continue;
}
// if systemLocales is not setting, return the first security ime
if (systemLocales.size() == 0) {
if (!systemLocales.size()) {
return imp;
}
if (ime == nullptr) {
if (!ime) {
ime = imp;
}
for (int j = 0; j < (int)inputMethodProperties[i]->mTypes.size(); j++) {
@ -377,7 +377,7 @@ namespace MiscServices {
} else if (enabledInputMethods.find(imeId) != std::string::npos) {
if (flag) {
return inputMethodProperties[i];
} else if (firstEnabledProperty == nullptr) {
} else if (!firstEnabledProperty) {
firstEnabledProperty = inputMethodProperties[i];
}
}
@ -523,7 +523,7 @@ namespace MiscServices {
if (enabledInputMethods.find(imeId) == std::string::npos) {
continue;
}
if (firstEnabledIme == nullptr) {
if (!firstEnabledIme) {
firstEnabledIme = inputMethodProperties[i];
}

View File

@ -43,7 +43,7 @@ namespace MiscServices {
Platform *Platform::Instance()
{
static Platform *platform = nullptr;
if (platform == nullptr) {
if (!platform) {
platform = new Platform();
}
return platform;
@ -58,7 +58,7 @@ namespace MiscServices {
sptr<IInputMethodCore> Platform::BindInputMethodService(int userId, const std::u16string& packageName,
const std::u16string& intention)
{
if (platformApi == nullptr) {
if (!platformApi) {
return nullptr;
}
return platformApi->bindInputMethodService(packageName, intention, userId);
@ -71,7 +71,7 @@ namespace MiscServices {
*/
int Platform::UnbindInputMethodService(int userId, const std::u16string& packageName)
{
if (platformApi == nullptr) {
if (!platformApi) {
return ErrorCode::ERROR_NULL_POINTER;
}
return platformApi->unbindInputMethodService(userId, packageName);
@ -85,7 +85,7 @@ namespace MiscServices {
*/
sptr < IRemoteObject > Platform::CreateWindowToken(int userId, int displayId, const std::u16string& packageName)
{
if (platformApi == nullptr) {
if (!platformApi) {
return nullptr;
}
return platformApi->createWindowToken(userId, displayId, packageName);
@ -98,7 +98,7 @@ namespace MiscServices {
*/
int Platform::DestroyWindowToken(int userId, const std::u16string& packageName)
{
if (platformApi == nullptr) {
if (!platformApi) {
return ErrorCode::ERROR_NULL_POINTER;
}
return platformApi->destroyWindowToken(userId, packageName);
@ -123,7 +123,7 @@ namespace MiscServices {
int Platform::GetInputMethodProperty(int userId, const std::u16string& packageName,
InputMethodProperty *inputMethodProperty)
{
if (platformApi == nullptr) {
if (!platformApi) {
return ErrorCode::ERROR_NULL_POINTER;
}
return platformApi->getInputMethodProperty(userId, packageName, inputMethodProperty);
@ -147,7 +147,7 @@ namespace MiscServices {
*/
int Platform::SetInputMethodSetting(int userId, const InputMethodSetting& inputMethodSetting)
{
if (platformApi == nullptr) {
if (!platformApi) {
return ErrorCode::ERROR_NULL_POINTER;
}
return platformApi->setInputMethodSetting(userId, inputMethodSetting);