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

Commit d1f53e5e authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Fix the missing lock in onPackageDataCleared()

As a preparation for supporting concurrent multi-user with
MyPackageMonitor, with this CL fixes a missing lock in

  MyPackageMonitor#onPackageDataCleared,

which was introduced recently [1].

As fields like

  InputMethodManager#mSettings
  InputMethodManager#mAdditionalSubtypeMap

need to be touched only within ImfLock, we still need an explicit lock
there.

 [1]: I159d9b7a2d1dcc8df478bb45d0be706d615724a2
      18a26c88

Bug: 267124364
Bug: 309837937
Bug: 322062773
Test: manually tested the case.
Change-Id: Ida9e9143324ccf0e5bcff224fbb0e4e6650996b0
parent 8e3ca63b
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -1331,6 +1331,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub

        @Override
        public void onPackageDataCleared(String packageName, int uid) {
            synchronized (ImfLock.class) {
                boolean changed = false;
                for (InputMethodInfo imi : mSettings.getMethodList()) {
                    if (imi.getPackageName().equals(packageName)) {
@@ -1344,6 +1345,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    mChangedPackages.add(packageName);
                }
            }
        }

        @Override
        public void onFinishPackageChanges() {