Refactor locking in input method framework

This CL introduces a static global lock ImfLock.class to be used
instead of the mMethodMap. This allows to avoid erroneous warnings
from the errorprone checker.

Also, this CL fixes some cases, in which locked resources were
accessed without holding the appropriate lock.

Bug: 205676419
Test: atest CtsInputMethodTestCases
Test: RUN_ERROR_PRONE=true m services  -j | grep -e InputMethod | grep GuardedBy
Change-Id: If50984d23410b11eb5f8ae731e1c0c5ca92447c6
5 files changed