mirror of
https://github.com/openharmony/miscservices_inputmethod.git
synced 2026-07-18 17:24:37 -04:00
@@ -47,8 +47,8 @@ namespace MiscServices {
|
||||
class InputMethodController : public RefBase {
|
||||
public:
|
||||
static sptr<InputMethodController> GetInstance();
|
||||
void Attach();
|
||||
void ShowTextInput(sptr<OnTextChangedListener> &listener);
|
||||
void Attach(sptr<OnTextChangedListener> &listener);
|
||||
void ShowTextInput();
|
||||
void HideTextInput();
|
||||
void Close();
|
||||
void OnRemoteSaDied(const wptr<IRemoteObject> &object);
|
||||
|
||||
@@ -156,15 +156,15 @@ using namespace MessageID;
|
||||
}
|
||||
}
|
||||
|
||||
void InputMethodController::Attach()
|
||||
void InputMethodController::Attach(sptr<OnTextChangedListener> &listener)
|
||||
{
|
||||
PrepareInput(0, mClient, mInputDataChannel, mAttribute);
|
||||
textListener=listener;
|
||||
}
|
||||
|
||||
void InputMethodController::ShowTextInput(sptr<OnTextChangedListener> &listener)
|
||||
void InputMethodController::ShowTextInput()
|
||||
{
|
||||
IMSA_HILOGI("InputMethodController::ShowTextInput");
|
||||
textListener = listener;
|
||||
StartInput(mClient);
|
||||
}
|
||||
|
||||
|
||||
@@ -124,6 +124,7 @@ namespace MiscServices {
|
||||
int MIN_IME = 2;
|
||||
int IME_ERROR_CODE = 3;
|
||||
int COMMON_COUNT_THREE_HUNDRED = 300;
|
||||
int SLEEP_TIME = 300000;
|
||||
|
||||
InputMethodProperty *currentIme[MAX_IME]; // 0 - the default ime. 1 - security ime
|
||||
|
||||
|
||||
@@ -1305,6 +1305,15 @@ namespace MiscServices {
|
||||
} else {
|
||||
IMSA_HILOGI("PerUserSession::onSetInputMethodCore End...[%{public}d]\n", userId_);
|
||||
}
|
||||
if (currentClient != nullptr) {
|
||||
usleep(SLEEP_TIME);
|
||||
ret = ShowKeyboard(currentClient);
|
||||
if (ret != ErrorCode::NO_ERROR) {
|
||||
IMSA_HILOGE("PerUserSession::OnStartInput Aborted! %{public}s", ErrorCode::ToString(ret));
|
||||
} else {
|
||||
IMSA_HILOGI("PerUserSession::OnStartInput End...[%{public}d]\n", userId_);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*! Stop input. Called by an input client.
|
||||
|
||||
@@ -198,12 +198,12 @@ namespace MiscServices {
|
||||
sptr<OnTextChangedListener> textListener = new TextListener();
|
||||
|
||||
IMSA_HILOGI("IMC Attach START");
|
||||
imc->Attach();
|
||||
imc->Attach(textListener);
|
||||
int waitForStatusOk = 2;
|
||||
sleep(waitForStatusOk);
|
||||
|
||||
IMSA_HILOGI("IMC ShowTextInput START");
|
||||
imc->ShowTextInput(textListener);
|
||||
imc->ShowTextInput();
|
||||
sleep(10);
|
||||
|
||||
IMSA_HILOGI("IMC HideTextInput START");
|
||||
|
||||
Reference in New Issue
Block a user