More robust display ID mismatch detection in IMM
This is another follow up CL to my previous CL [1] that enabled per-display InputMethodManager (IMM) instance (Bug 115893206). What we learned in Bug 118341760 is that for some apps view.getContext() may return a ContextWrapper subclass whose Context.getDisplayId() and Context.getSystemService() are not consistent with each other. Although this is considered to be a bug of such a ContextWrapper subclass, application developers may not be aware of the issue when such a problematic ContextWrapper came from libraries that app developers happened to, or had to, depend on. The key idea of this CL is that view.getViewRootImpl().getDisplayId() would be a more robust source of display ID than view.getContext().getDisplayId() for most of cases, because to which ViewRootImpl a given View belongs is already a strong signal about to which display the View belongs. As far as I've tested locally, this approach seems to be more promising and is expected to give us better app compatibility in multi-display scenarios. [1]: I78ad7cccb9586474c83f7e2f90c0bcabb221c47b 4052a10f Bug: 118252837 Fix: 118341760 Test: atest ActivityManagerMultiDisplayTests Test: atest CtsInputMethodTestCases CtsInputMethodServiceHostTestCases Test: atest FrameworksCoreTests:android.view.inputmethod.InputMethodManagerTest Change-Id: If47e48bc8176657bf4bb882146d2affdfe457c90
Loading
Please register or sign in to comment