Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 278f2ab1 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Access IMMS#mSettings only inside the lock

This is a preparation CL before addresssing Bug 35361128.

IMMS.MyPackageMonitor#isChangingPackagesOfCurrentUser() needs to be
called after taking a lock for IMMS#mMethodMap because it internally
relies on InputMethodManagerService#mSettings.

Test: Made sure that the device can boot and the IME is available.
Bug: 35361128
Change-Id: I66752a275f20f6ba33bc211ffb8d6fd269250c0d
parent 27b35add
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -727,7 +727,8 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
            mPackagesToMonitorComponentChange.add(packageName);
        }

        private boolean isChangingPackagesOfCurrentUser() {
        @GuardedBy("mMethodMap")
        private boolean isChangingPackagesOfCurrentUserLocked() {
            final int userId = getChangingUserId();
            final boolean retval = userId == mSettings.getCurrentUserId();
            if (DEBUG) {
@@ -740,10 +741,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub

        @Override
        public boolean onHandleForceStop(Intent intent, String[] packages, int uid, boolean doit) {
            if (!isChangingPackagesOfCurrentUser()) {
            synchronized (mMethodMap) {
                if (!isChangingPackagesOfCurrentUserLocked()) {
                    return false;
                }
            synchronized (mMethodMap) {
                String curInputMethodId = mSettings.getSelectedInputMethod();
                final int N = mMethodList.size();
                if (curInputMethodId != null) {
@@ -777,10 +778,10 @@ public class InputMethodManagerService extends IInputMethodManager.Stub

        @Override
        public void onSomePackagesChanged() {
            if (!isChangingPackagesOfCurrentUser()) {
            synchronized (mMethodMap) {
                if (!isChangingPackagesOfCurrentUserLocked()) {
                    return;
                }
            synchronized (mMethodMap) {
                InputMethodInfo curIm = null;
                String curInputMethodId = mSettings.getSelectedInputMethod();
                final int N = mMethodList.size();