Fix IME crash on SoftInputWindow.show by TOKEN_PENDING
Originated from CL[1] to fix a crash edge case that happened when calling InputMethodPrivilegedOperationsRegistry#put that assumes there is only one pair of window token and IInputMethodPrivilegedOperations in the container. However, InputMethodPrivilegedOperationsRegistry is a process-level singleton instances that may run into a timing when there are 2 InputMethodService (IMS) instances, one is just created and the other is in the way of destorying. Before the destorying one calls InputMethodPrivilegedOperationsRegistry#remove, IMS#initializeInternal invoked for the new one with the same window token, that makes system ignored the initialization process because CL[1] introduced InputMethodPrivilegedOperationsRegistry#isRegistered(token) and system thoughts the token has been registered before, but actually this method is problemetic to aware this token registraction is for previous IMS. As the result, IME will crash when SoftInputWindow.show because the windowState is still under TOKEN_PENDING and lose the token attachment. To fix this crash timing issue, making InputMethodPrivilegedOperationsRegistry be able to maintain more than one pairs of IME token and IInputMethodPrivilegedOperations makes more sense and we can remove the ignore logic in initializeInternal to fix the token attachment issue. [1]: Ie6bfbae735724fe744590e715124d2737d2b665d Fix: 202081442 Test: atest CtsInputMethodTestCases Test: atest MultiDisplaySystemDecorationTests Change-Id: I21cec3f228520ed703cd8ad68ea0ef59c966ed9d
Loading
Please register or sign in to comment