Prevent this test from running on mumd devices
Will make this test run on all devices once UI Automator's UiDevice#isScreenOn starts supporting multi-user / multi-display.
This CL also sets this test to run on regular JUnit runner since AndroidJUnitRunner is not really needed.
Bug: 282069758
Test: atest CtsCarTestCases:android.car.cts.CarInputManagerSystemTest
Change-Id: I6bbf9cbde50fea5c8b27d854592a1ae1c5263112
diff --git a/tests/tests/car/src/android/car/cts/CarInputManagerSystemTest.java b/tests/tests/car/src/android/car/cts/CarInputManagerSystemTest.java
index f7e20a6..915b444 100644
--- a/tests/tests/car/src/android/car/cts/CarInputManagerSystemTest.java
+++ b/tests/tests/car/src/android/car/cts/CarInputManagerSystemTest.java
@@ -22,6 +22,7 @@
import static com.google.common.truth.Truth.assertThat;
+import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;
import android.app.Instrumentation;
@@ -31,21 +32,19 @@
import android.content.Context;
import android.os.Build;
import android.os.SystemClock;
+import android.os.UserManager;
import android.support.test.uiautomator.UiDevice;
import android.view.KeyEvent;
import androidx.test.InstrumentationRegistry;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.compatibility.common.util.ApiLevelUtil;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import org.junit.runner.RunWith;
-@RunWith(AndroidJUnit4.class)
-public class CarInputManagerSystemTest {
+public final class CarInputManagerSystemTest {
private static final long MAX_WAIT_TIMEOUT_MS = 5_000;
@@ -54,11 +53,13 @@
private UiAutomation mUiAutomation;
private UiDevice mDevice;
private CarInputManager mCarInputManager;
+ private UserManager mUserManager;
@Before
public void setUp() {
mInstrumentation = InstrumentationRegistry.getInstrumentation();
mContext = mInstrumentation.getContext();
+ mUserManager = mContext.getSystemService(UserManager.class);
mDevice = UiDevice.getInstance(mInstrumentation);
mUiAutomation = mInstrumentation.getUiAutomation();
@@ -81,6 +82,10 @@
ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S));
assumeTrue("This test expects the device to be awake", mDevice.isScreenOn());
+ // TODO(b/284220186): Remove this assumption check on this bug is fixed.
+ assumeFalse("This test is disabled on multi-user/multi-display devices",
+ mUserManager.isVisibleBackgroundUsersSupported());
+
injectKey(KeyEvent.KEYCODE_SLEEP);
waitUntilScreenOnIs(false);