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

Commit 734ea56a authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove a redundant queryInputMethodServicesInternal" into main

parents 1b7e8ad2 b5af7c98
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -1406,16 +1406,13 @@ public final class InputMethodManagerService implements IInputMethodManagerImpl.
                final String defaultImiId = SecureSettingsWrapper.getString(
                        Settings.Secure.DEFAULT_INPUT_METHOD, null, currentUserId);
                final boolean imeSelectedOnBoot = !TextUtils.isEmpty(defaultImiId);
                final InputMethodSettings newSettings = queryInputMethodServicesInternal(mContext,
                        currentUserId, AdditionalSubtypeMapRepository.get(currentUserId),
                        DirectBootAwareness.AUTO);
                InputMethodSettingsRepository.put(currentUserId, newSettings);
                final var settings = InputMethodSettingsRepository.get(currentUserId);
                postInputMethodSettingUpdatedLocked(
                        !imeSelectedOnBoot /* resetDefaultEnabledIme */, currentUserId);
                updateFromSettingsLocked(true, currentUserId);
                InputMethodUtils.setNonSelectedSystemImesDisabledUntilUsed(
                        getPackageManagerForUser(mContext, currentUserId),
                        newSettings.getEnabledInputMethodList());
                        settings.getEnabledInputMethodList());

                AdditionalSubtypeMapRepository.startWriterThread();

+11 −1
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ import android.window.ImeOnBackInvokedDispatcher;
import androidx.test.platform.app.InstrumentationRegistry;

import com.android.internal.compat.IPlatformCompat;
import com.android.internal.inputmethod.DirectBootAwareness;
import com.android.internal.inputmethod.IInputMethod;
import com.android.internal.inputmethod.IInputMethodClient;
import com.android.internal.inputmethod.IInputMethodSession;
@@ -269,8 +270,15 @@ public class InputMethodManagerServiceTestBase {
        LocalServices.removeServiceForTest(InputMethodManagerInternal.class);
        lifecycle.onStart();

        // Emulate that the user initialization is done.
        // Certain tests rely on TEST_IME_ID that is installed with AndroidTest.xml.
        // TODO(b/352615651): Consider just synthesizing test InputMethodInfo then injecting it.
        AdditionalSubtypeMapRepository.ensureInitializedAndGet(mCallingUserId);
        final var settings = InputMethodManagerService.queryInputMethodServicesInternal(mContext,
                mCallingUserId, AdditionalSubtypeMapRepository.get(mCallingUserId),
                DirectBootAwareness.AUTO);
        InputMethodSettingsRepository.put(mCallingUserId, settings);

        // Emulate that the user initialization is done.
        mInputMethodManagerService.getUserData(mCallingUserId).mBackgroundLoadLatch.countDown();

        // After this boot phase, services can broadcast Intents.
@@ -283,6 +291,8 @@ public class InputMethodManagerServiceTestBase {

    @After
    public void tearDown() {
        InputMethodSettingsRepository.remove(mCallingUserId);

        if (mInputMethodManagerService != null) {
            mInputMethodManagerService.mInputMethodDeviceConfigs.destroy();
        }