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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21910522

Change-Id: I10bc5683fd5aa59425ab0e22f5e0ae4b7b675b0a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Adrian Roos
2023-03-09 11:42:14 +00:00
committed by Automerger Merge Worker
2 changed files with 18 additions and 0 deletions

View File

@@ -21,6 +21,8 @@ import static android.provider.InputMethodManagerDeviceConfig.KEY_HIDE_IME_WHEN_
import android.app.ActivityThread;
import android.provider.DeviceConfig;
import com.android.internal.annotations.VisibleForTesting;
/**
* Class for the device-level configuration related to the input method manager
* platform features in {@link DeviceConfig}.
@@ -56,4 +58,9 @@ final class InputMethodDeviceConfigs {
public boolean shouldHideImeWhenNoEditorFocus() {
return mHideImeWhenNoEditorFocus;
}
@VisibleForTesting
void destroy() {
DeviceConfig.removeOnPropertiesChangedListener(mDeviceConfigChangedListener);
}
}

View File

@@ -65,6 +65,7 @@ import com.android.server.wm.WindowManagerInternal;
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
import org.mockito.Mock;
import org.mockito.MockitoSession;
import org.mockito.quality.Strictness;
@@ -121,6 +122,14 @@ public class InputMethodManagerServiceTestBase {
protected InputMethodManagerService mInputMethodManagerService;
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
public void setUp() throws RemoteException {
mMockingSession =
@@ -231,6 +240,8 @@ public class InputMethodManagerServiceTestBase {
@After
public void tearDown() {
mInputMethodManagerService.mInputMethodDeviceConfigs.destroy();
if (mServiceThread != null) {
mServiceThread.quitSafely();
}