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

Commit 6876f8f4 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Remove the dependency on SystemServerInitThreadPool from IMMS

With this CL we start calling

  AdditionalSubtypeMapRepository.startWriterThread()

without SystemServerInitThreadPool, as it is supposed to be fast and
simple enough. It is the last dependency on SystemServerInitThreadPool
in the InputMethodManagerService.

This is a minor cleanup on how the background writer thread is
initialized. All the observable semantics should remain unchanged.

Bug: 343601565
Bug: 350790602
Test: presubmit
Test: atest FrameworksInputMethodSystemServerTests
Flag: EXEMPT refactor
Change-Id: I16e29c1d008850bd1ea20fb1e36fb483b0ca38fe
parent 2bebdf21
Loading
Loading
Loading
Loading
+1 −4
Original line number Diff line number Diff line
@@ -176,7 +176,6 @@ import com.android.server.AccessibilityManagerInternal;
import com.android.server.EventLogTags;
import com.android.server.LocalServices;
import com.android.server.ServiceThread;
import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemService;
import com.android.server.companion.virtual.VirtualDeviceManagerInternal;
import com.android.server.input.InputManagerInternal;
@@ -1390,9 +1389,7 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                        getPackageManagerForUser(mContext, currentUserId),
                        newSettings.getEnabledInputMethodList());

                final var unused = SystemServerInitThreadPool.submit(
                        AdditionalSubtypeMapRepository::startWriterThread,
                        "Start AdditionalSubtypeMapRepository's writer thread");
                AdditionalSubtypeMapRepository.startWriterThread();

                if (mConcurrentMultiUserModeEnabled) {
                    for (int userId : mUserManagerInternal.getUserIds()) {
+3 −5
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ import com.android.internal.inputmethod.InputBindResult;
import com.android.internal.view.IInputMethodManager;
import com.android.server.LocalServices;
import com.android.server.ServiceThread;
import com.android.server.SystemServerInitThreadPool;
import com.android.server.SystemService;
import com.android.server.input.InputManagerInternal;
import com.android.server.pm.UserManagerInternal;
@@ -161,7 +160,7 @@ public class InputMethodManagerServiceTestBase {
                        .strictness(Strictness.LENIENT)
                        .spyStatic(InputMethodUtils.class)
                        .mockStatic(ServiceManager.class)
                        .mockStatic(SystemServerInitThreadPool.class)
                        .spyStatic(AdditionalSubtypeMapRepository.class)
                        .startMocking();

        mContext = spy(InstrumentationRegistry.getInstrumentation().getContext());
@@ -234,9 +233,8 @@ public class InputMethodManagerServiceTestBase {
        doNothing().when(() -> InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed(
                        any(PackageManager.class), anyList()));

        // Used by lazy initializing draw IMS nav bar at InputMethodManagerService#systemRunning(),
        // which is ok to be mocked out for now.
        doReturn(null).when(() -> SystemServerInitThreadPool.submit(any(), anyString()));
        // The background writer thread in AdditionalSubtypeMapRepository should be stubbed out.
        doNothing().when(AdditionalSubtypeMapRepository::startWriterThread);

        mServiceThread =
                new ServiceThread(