androidandroid-input-method

The sample of Android's MultiClientInputMethod cannot properly work


I follow Google's official instructions to use the example of MultiClientInputMethodManagerService(https://android.googlesource.com/platform/frameworks/base/+/master/services/core/java/com/android/server/inputmethod/multi-client-ime.md)

The AOSP11 emulator with perDisplayFocus has been built, the screenshot you can see that enter image description here

But the ime's window only shows on main display, and can only input on the main displayenter image description here

I have added some log to see the multi input window , it seems like has shown

@Override
public void onShowSoftInput(int flags, ResultReceiver resultReceiver) {
    if (DEBUG) {
        Log.v(TAG, "onShowSoftInput clientId=" + mClientId + " flags=" + flags);
    }
    final SoftInputWindow window =
            mSoftInputWindowManager.getSoftInputWindow(mSelfReportedDisplayId);
    if (window == null) {
        return;
    }
    if (mClientId != window.getClientId()) {
        Log.w(TAG, "onShowSoftInput() from a background client is ignored."
                + " windowClientId=" + window.getClientId()
                + " clientId=" + mClientId);
        return;
    }

    window.show();
    Log.v(TAG, "is showing"+window.isShowing());
}

The logcat of AndroidStudio enter image description here I search on Google and has not found relevant questions for a long time.Has anyone used this ,thank you very much for the experienced answerers


Solution

  • i had solved it , anyone who sees this problem can refer to my solution https://github.com/Superpengun/MultiDisplayInput

    The jar used in the project is extracted from the aosp12 compiled classed.jar ,the keyboardview is a dialog,maybe there is a difference of dialog's Multi-screen display. In the github's project i rebuild the jar for hidden api of AOSP12 and verfied it