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

Commit 915ca4df authored by Antonio Kantek's avatar Antonio Kantek Committed by Android (Google) Code Review
Browse files

Merge "Synchronize IMMS constructor to avoid lock contention issues" into main

parents c666c156 bce89b57
Loading
Loading
Loading
Loading
+68 −67
Original line number Diff line number Diff line
@@ -1336,9 +1336,11 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
            Context context,
            @Nullable ServiceThread serviceThreadForTesting,
            @Nullable InputMethodBindingController bindingControllerForTesting) {
        synchronized (ImfLock.class) {
            mContext = context;
            mRes = context.getResources();
            SecureSettingsWrapper.onStart(mContext);

            // TODO(b/196206770): Disallow I/O on this thread. Currently it's needed for loading
            // additional subtypes in switchUserOnHandlerLocked().
            final ServiceThread thread =
@@ -1391,10 +1393,8 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
            mVisibilityApplier = new DefaultImeVisibilityApplier(this);

            mClientController = new ClientController(mPackageManagerInternal);
        synchronized (ImfLock.class) {
            mClientController.addClientControllerCallback(c -> onClientRemoved(c));
            mImeBindingState = ImeBindingState.newEmptyState();
        }

            mPreventImeStartupUnlessTextEditor = mRes.getBoolean(
                    com.android.internal.R.bool.config_preventImeStartupUnlessTextEditor);
@@ -1408,6 +1408,7 @@ public final class InputMethodManagerService extends IInputMethodManager.Stub
                    new InkWindowInitializer(), toolTypeConsumer, discardDelegationTextRunnable);
            registerDeviceListenerAndCheckStylusSupport();
        }
    }

    @GuardedBy("ImfLock.class")
    @UserIdInt