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

Commit 1688a416 authored by Adrian Roos's avatar Adrian Roos Committed by Automerger Merge Worker
Browse files

Merge "IMMS tests: fix broken tests" into udc-dev am: c840f6b9

parents c0eda0d2 c840f6b9
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -21,6 +21,8 @@ import static android.provider.InputMethodManagerDeviceConfig.KEY_HIDE_IME_WHEN_
import android.app.ActivityThread;
import android.app.ActivityThread;
import android.provider.DeviceConfig;
import android.provider.DeviceConfig;


import com.android.internal.annotations.VisibleForTesting;

/**
/**
 * Class for the device-level configuration related to the input method manager
 * Class for the device-level configuration related to the input method manager
 * platform features in {@link DeviceConfig}.
 * platform features in {@link DeviceConfig}.
@@ -56,4 +58,9 @@ final class InputMethodDeviceConfigs {
    public boolean shouldHideImeWhenNoEditorFocus() {
    public boolean shouldHideImeWhenNoEditorFocus() {
        return mHideImeWhenNoEditorFocus;
        return mHideImeWhenNoEditorFocus;
    }
    }

    @VisibleForTesting
    void destroy() {
        DeviceConfig.removeOnPropertiesChangedListener(mDeviceConfigChangedListener);
    }
}
}
+11 −0
Original line number Original line Diff line number Diff line
@@ -65,6 +65,7 @@ import com.android.server.wm.WindowManagerInternal;


import org.junit.After;
import org.junit.After;
import org.junit.Before;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockito.Mock;
import org.mockito.Mock;
import org.mockito.MockitoSession;
import org.mockito.MockitoSession;
import org.mockito.quality.Strictness;
import org.mockito.quality.Strictness;
@@ -121,6 +122,14 @@ public class InputMethodManagerServiceTestBase {
    protected InputMethodManagerService mInputMethodManagerService;
    protected InputMethodManagerService mInputMethodManagerService;
    protected ServiceThread mServiceThread;
    protected ServiceThread mServiceThread;


    @BeforeClass
    public static void setupClass() {
        // Make sure DeviceConfig's lazy-initialized ContentProvider gets
        // a real instance before we stub out all system services below.
        // TODO(b/272229177): remove dependency on real ContentProvider
        new InputMethodDeviceConfigs().destroy();
    }

    @Before
    @Before
    public void setUp() throws RemoteException {
    public void setUp() throws RemoteException {
        mMockingSession =
        mMockingSession =
@@ -231,6 +240,8 @@ public class InputMethodManagerServiceTestBase {


    @After
    @After
    public void tearDown() {
    public void tearDown() {
        mInputMethodManagerService.mInputMethodDeviceConfigs.destroy();

        if (mServiceThread != null) {
        if (mServiceThread != null) {
            mServiceThread.quitSafely();
            mServiceThread.quitSafely();
        }
        }