Merge pull request #5953 from robolectric/piper_334247873

Un-deprecates the ShadowDisplay.
diff --git a/annotations/src/main/java/org/robolectric/annotation/AccessibilityChecks.java b/annotations/src/main/java/org/robolectric/annotation/AccessibilityChecks.java
deleted file mode 100644
index 41d845c..0000000
--- a/annotations/src/main/java/org/robolectric/annotation/AccessibilityChecks.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.robolectric.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Robolectric can check for certain kinds of accessibility bugs while running your tests. These are
- * bugs that interfere with services that allow users with disabilities to access your UI. When
- * these checks are enabled, calling {@code Robolectric.onClick()} will run a series of checks on
- * your UI and throw exceptions if errors are present.
- *
- * <p>Requires {@code org.robolectric:plugin-accessibility-deprecated}.
- *
- * @deprecated Use Espresso instead. Will be removed after Robolectric 4.4.
- */
-@Documented
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.TYPE, ElementType.METHOD})
-@Deprecated
-public @interface AccessibilityChecks {
-  enum ForRobolectricVersion { VERSION_3_0, VERSION_3_1, LATEST }
-
-  /**
-   * Enable or disable accessibility checking.
-   *
-   * @return  True if accessibility checking is enabled.
-   */
-  boolean enabled() default true;
-
-  /**
-   * Accessibility checking can be a moving target. As new checks are added to
-   * Robolectric, these checks may reveal issues with a UI that previously
-   * passed all checks (but were probably affecting users all along). This
-   * option forces Robolectric to run only those checks that were present in a
-   * specified version of Robolectric, which reduces the opportunity for a
-   * new bug to be discovered in an old test. Note that this option does not
-   * guarantee that the behavior of individual checks won't change as bugs are
-   * fixed and/or features added to checks that existed in the specified
-   * version.
-   *
-   * @return  Run all checks corresponding to this version of Robolectric.
-   */
-  ForRobolectricVersion forRobolectricVersion() default ForRobolectricVersion.LATEST;
-}
\ No newline at end of file
diff --git a/plugins/accessibility-deprecated/build.gradle b/plugins/accessibility-deprecated/build.gradle
deleted file mode 100644
index d9b018e..0000000
--- a/plugins/accessibility-deprecated/build.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-apply plugin: org.robolectric.gradle.RoboJavaModulePlugin
-apply plugin: org.robolectric.gradle.DeployedRoboJavaModulePlugin
-
-dependencies {
-    api project(":pluginapi")
-    api project(":utils")
-    api project(":shadows:framework")
-
-    compileOnly(AndroidSdk.MAX_SDK.coordinates) { force = true }
-    api "com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.1"
-    compileOnly "com.google.auto.service:auto-service-annotations:1.0-rc6"
-    annotationProcessor "com.google.auto.service:auto-service:1.0-rc6"
-
-    testImplementation project(":robolectric")
-    testImplementation "junit:junit:4.12"
-    testImplementation "org.mockito:mockito-core:2.5.4"
-    testImplementation("androidx.test:core:1.3.0-rc03")
-    testImplementation("androidx.test:runner:1.3.0-rc03")
-    testImplementation("androidx.test.ext:junit:1.1.2-rc03")
-
-    testCompileOnly AndroidSdk.MAX_SDK.coordinates // compile against latest Android SDK
-    testRuntime AndroidSdk.MAX_SDK.coordinates
-    testRuntime project(":shadows:supportv4")
-    testRuntime "com.android.support:support-v4:26.0.1"
-}
diff --git a/plugins/accessibility-deprecated/src/main/java/org/robolectric/android/AccessibilityUtil.java b/plugins/accessibility-deprecated/src/main/java/org/robolectric/android/AccessibilityUtil.java
deleted file mode 100644
index 5afc35f..0000000
--- a/plugins/accessibility-deprecated/src/main/java/org/robolectric/android/AccessibilityUtil.java
+++ /dev/null
@@ -1,291 +0,0 @@
-package org.robolectric.android;
-
-import android.view.View;
-import com.google.android.apps.common.testing.accessibility.framework.AccessibilityCheckPreset;
-import com.google.android.apps.common.testing.accessibility.framework.AccessibilityCheckResult;
-import com.google.android.apps.common.testing.accessibility.framework.AccessibilityCheckResult.AccessibilityCheckResultType;
-import com.google.android.apps.common.testing.accessibility.framework.AccessibilityCheckResultUtils;
-import com.google.android.apps.common.testing.accessibility.framework.AccessibilityViewCheckResult;
-import com.google.android.apps.common.testing.accessibility.framework.DuplicateClickableBoundsViewCheck;
-import com.google.android.apps.common.testing.accessibility.framework.TouchTargetSizeViewCheck;
-import com.google.android.apps.common.testing.accessibility.framework.integrations.espresso.AccessibilityValidator;
-import com.google.auto.service.AutoService;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.util.Collections;
-import java.util.List;
-import org.hamcrest.Matcher;
-import org.hamcrest.Matchers;
-import org.robolectric.annotation.AccessibilityChecks;
-import org.robolectric.annotation.AccessibilityChecks.ForRobolectricVersion;
-import org.robolectric.pluginapi.AccessibilityChecker;
-
-/**
- * Utility class for checking Views for accessibility.
- *
- * This class is used by {@code ShadowView.checkedPerformClick} to check for accessibility problems.
- * There is some subtlety to checking a UI for accessibility when it hasn't been rendered. The
- * better initialized the View, the more accurate the checking will be. At a minimum, the view
- * should be attached to a proper view hierarchy similar to what's checked for in:q
- * {@code ShadowView.checkedPerformClick}.
- *
- * Will be removed after Robolectric 4.4.
- *
- * @deprecated Use Espresso for view interactions.
- */
-@Deprecated
-@AutoService(AccessibilityChecker.class)
-public class AccessibilityUtil implements AccessibilityChecker {
-  private static final String COMPAT_V4_CLASS_NAME = "android.support.v4.view.ViewCompat";
-  /* The validator that this class configures and uses to run the checks */
-  private static AccessibilityValidator validator;
-  
-  /* 
-   * Slightly hacky way to deal with the legacy of allowing the annotation to configure the 
-   * subset of checks to run from the annotation. {@code true} when a version set is
-   * specified by setRunChecksForRobolectricVersion.
-   */
-  private static boolean forVersionSet = false;
-
-  /* Flag indicating if the support library's presence has been verified */
-  private static boolean v4SupportPresenceVerified = false;
-
-  /**
-   * Check a hierarchy of {@code View}s for accessibility. Only performs checks if (in decreasing
-   * priority order) accessibility checking is enabled using an {@link AccessibilityChecks}
-   * annotation, if the system property {@code robolectric.accessibility.enablechecks} is set to
-   * {@code true}, or if the environment variable {@code robolectric.accessibility.enablechecks}
-   * is set to {@code true}.
-   *
-   * @param view The {@code View} to examine
-   *
-   * @return A list of results from the check. If there are no results or checking is disabled, 
-   * the list is empty.
-   */
-  public static List<AccessibilityViewCheckResult> checkViewIfCheckingEnabled(View view) {
-    AccessibilityChecks classChecksAnnotation = getAnnotation();
-    if (!isAccessibilityCheckingEnabled(classChecksAnnotation)) {
-      return Collections.emptyList();
-    }
-
-    return checkView(view);
-  }
-
-  /**
-   * Check a hierarchy of {@code View}s for accessibility, based on currently set options.
-   *
-   * @param view The {@code View} to examine
-   *
-   * @return A list of results from the check. If there are no results, the list is empty.
-   */
-  public static List<AccessibilityViewCheckResult> checkView(View view) {
-    return checkView(view, getAnnotation());
-  }
-
-  /**
-   * Check a hierarchy of {@code View}s for accessibility. Only performs checks if (in decreasing
-   * priority order) accessibility checking is enabled using an {@link AccessibilityChecks}
-   * annotation, if the system property {@code robolectric.accessibility.enablechecks} is set to
-   * {@code true}, or if the environment variable {@code robolectric.accessibility.enablechecks}
-   * is set to {@code true}.
-   *
-   * Implicitly calls {code setThrowExceptionForErrors(false)} to disable exception throwing. This
-   * method is deprecated, both because of this side effect and because the other methods offer
-   * more control over execution.
-   *
-   * @param view The {@code View} to examine
-   *
-   * @return A list of results from the check. If there are no results or checking is disabled,
-   * the list is empty.
-   */
-  @Deprecated
-  public static boolean passesAccessibilityChecksIfEnabled(View view) {
-    setThrowExceptionForErrors(false);
-    List<AccessibilityViewCheckResult> results = checkViewIfCheckingEnabled(view);
-    List<AccessibilityViewCheckResult> errors = AccessibilityCheckResultUtils.getResultsForType(
-        results, AccessibilityCheckResultType.ERROR);
-    return (errors.size() == 0);
-  }
-
-  /**
-   * Specify that a specific subset of accessibility checks be run. The subsets are specified based
-   * on which Robolectric version particular checks were released with. By default, all checks are
-   * run {@link ForRobolectricVersion}.
-   *
-   * If you call this method, the value you pass will take precedence over any value in any 
-   * annotations. 
-   * 
-   * @param forVersion The version of checks to run for. If {@code null}, throws away the current
-   * value and falls back on the annotation or default.
-   */
-  public static void setRunChecksForRobolectricVersion(ForRobolectricVersion forVersion) {
-    initializeValidator();
-    if (forVersion != null) {
-      validator.setCheckPreset(convertRoboVersionToA11yTestVersion(forVersion));
-      forVersionSet = true;
-    } else {
-      forVersionSet = false;
-    }
-  }
-  
-  /**
-   * Specify that accessibility checks should be run for all views in the hierarchy whenever a
-   * single view's accessibility is asserted.
-   * 
-   * @param runChecksFromRootView {@code true} if all views in the hierarchy should be checked.
-   */
-  public static void setRunChecksFromRootView(boolean runChecksFromRootView) {
-    initializeValidator();
-    validator.setRunChecksFromRootView(runChecksFromRootView);
-  }
-  
-  /**
-   * Suppress all results that match the given matcher. Suppressed results will not be included
-   * in any logs or cause any {@code Exception} to be thrown. This capability is useful if there
-   * are known issues, but checks should still look for regressions.
-   * 
-   * @param matcher A matcher to match a {@link AccessibilityViewCheckResult}. {@code null}
-   * disables suppression and is the default.
-   */
-  @SuppressWarnings("unchecked") // The generic passed to anyOf
-  public static void setSuppressingResultMatcher(
-      final Matcher<? super AccessibilityViewCheckResult> matcher) {
-    initializeValidator();
-    /* Suppress all touch target results, since views all report size as 0x0 */
-    Matcher<AccessibilityCheckResult> touchTargetResultMatcher = 
-        AccessibilityCheckResultUtils.matchesChecks(
-            Matchers.equalTo(TouchTargetSizeViewCheck.class));
-    Matcher<AccessibilityCheckResult> duplicateBoundsResultMatcher = 
-        AccessibilityCheckResultUtils.matchesChecks(
-            Matchers.equalTo(DuplicateClickableBoundsViewCheck.class));
-    if (matcher == null) {
-      validator.setSuppressingResultMatcher(
-          Matchers.anyOf(touchTargetResultMatcher, duplicateBoundsResultMatcher));
-    } else {
-      validator.setSuppressingResultMatcher(
-          Matchers.anyOf(matcher, touchTargetResultMatcher, duplicateBoundsResultMatcher));
-    }
-  }
-  
-  /**
-   * Control whether or not to throw exceptions when accessibility errors are found.
-   *
-   * @param throwExceptionForErrors {@code true} to throw an {@code AccessibilityViewCheckException}
-   * when there is at least one error result. Default: {@code true}.
-   */
-  public static void setThrowExceptionForErrors(boolean throwExceptionForErrors) {
-    initializeValidator();
-    validator.setThrowExceptionForErrors(throwExceptionForErrors);
-  }
-
-  private static List<AccessibilityViewCheckResult> checkView(View view,
-      AccessibilityChecks classChecksAnnotation) {
-    /*
-     * Accessibility Checking requires the v4 support library. If the support library isn't present,
-     * throw a descriptive exception now.
-     */
-    if (!v4SupportPresenceVerified) {
-      try {
-        View.class.getClassLoader().loadClass(COMPAT_V4_CLASS_NAME);
-      } catch (ClassNotFoundException e) {
-        throw new RuntimeException(
-            "Accessibility Checking requires the Android support library (v4).\n"
-            + "Either include it in the project or disable accessibility checking.");
-      }
-      v4SupportPresenceVerified = true;
-    }
-
-    initializeValidator();
-    if (!forVersionSet) {
-      if (classChecksAnnotation != null) {
-        validator.setCheckPreset(
-            convertRoboVersionToA11yTestVersion(classChecksAnnotation.forRobolectricVersion()));
-      } else {
-        validator.setCheckPreset(AccessibilityCheckPreset.LATEST);
-      }
-    }
-    return validator.checkAndReturnResults(view);
-  }
-
-  private static boolean isAccessibilityCheckingEnabled(AccessibilityChecks classChecksAnnotation) {
-    boolean checksEnabled = false;
-
-    String checksEnabledString = System.getenv("robolectric.accessibility.enablechecks");
-    if (checksEnabledString != null) {
-      checksEnabled = checksEnabledString.equals("true");
-    }
-
-    /* Allow test arg to enable checking (and override environment variables) */
-    checksEnabledString = System.getProperty("robolectric.accessibility.enablechecks");
-    if (checksEnabledString != null) {
-      checksEnabled = checksEnabledString.equals("true");
-    }
-
-    if (classChecksAnnotation != null) {
-      checksEnabled = classChecksAnnotation.enabled();
-    }
-
-    return checksEnabled;
-  }
-
-  private static AccessibilityChecks getAnnotation() {
-    AccessibilityChecks classChecksAnnotation = null;
-    StackTraceElement[] stack = new Throwable().fillInStackTrace().getStackTrace();
-    for (StackTraceElement element : stack) {
-      /* Look for annotations on the method or the class */
-      Class<?> clazz;
-      try {
-        clazz = Class.forName(element.getClassName());
-        Method method;
-        method = clazz.getMethod(element.getMethodName());
-        /* Assume the method is void, as that is the case for tests */
-        classChecksAnnotation = method.getAnnotation(AccessibilityChecks.class);
-        if (classChecksAnnotation == null) {
-          classChecksAnnotation = clazz.getAnnotation(AccessibilityChecks.class);
-        }
-        /* Stop looking when we find an annotation */
-        if (classChecksAnnotation != null) {
-          break;
-        }
-
-        /* If we've crawled up the stack far enough to find the test, stop looking */
-        for (Annotation annotation : clazz.getAnnotations()) {
-          if (annotation.annotationType().getName().equals("org.junit.Test")) {
-            break;
-          }
-        }
-      }
-      /* 
-       * The reflective calls may throw exceptions if the stack trace elements
-       * don't look like junit test methods. In that case we simply go on
-       * to the next element
-       */
-      catch (ClassNotFoundException | SecurityException | NoSuchMethodException e) {}
-    }
-    return classChecksAnnotation;
-  }
-
-  private static void initializeValidator() {
-    if (validator == null) {
-      validator = new AccessibilityValidator();
-      setSuppressingResultMatcher(null);
-    }
-  }
-
-  private static AccessibilityCheckPreset convertRoboVersionToA11yTestVersion(
-      ForRobolectricVersion robolectricVersion) {
-    if (robolectricVersion == ForRobolectricVersion.LATEST) {
-      return AccessibilityCheckPreset.LATEST;
-    }
-    AccessibilityCheckPreset preset = AccessibilityCheckPreset.VERSION_1_0_CHECKS;
-    if (robolectricVersion.ordinal() >= ForRobolectricVersion.VERSION_3_1.ordinal()) {
-      preset = AccessibilityCheckPreset.VERSION_2_0_CHECKS;
-    }
-    return preset;
-  }
-
-  @Override
-  public void checkViewAccessibility(Object realView) {
-    checkViewIfCheckingEnabled((View) realView);
-  }
-}
diff --git a/plugins/accessibility-deprecated/src/test/java/org/robolectric/android/AccessibilityShadowViewTest.java b/plugins/accessibility-deprecated/src/test/java/org/robolectric/android/AccessibilityShadowViewTest.java
deleted file mode 100644
index 51752f8..0000000
--- a/plugins/accessibility-deprecated/src/test/java/org/robolectric/android/AccessibilityShadowViewTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.robolectric.android;
-
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.robolectric.Shadows.shadowOf;
-
-import android.graphics.Rect;
-import android.view.View;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.AccessibilityChecks;
-
-@RunWith(AndroidJUnit4.class)
-public class AccessibilityShadowViewTest {
-
-  @Test
-  @AccessibilityChecks
-  public void checkedClick_withA11yChecksAnnotation_shouldThrow() throws Exception {
-    AccessibilityUtil.setThrowExceptionForErrors(true);
-
-    View unlabeledView = new View(RuntimeEnvironment.application);
-    unlabeledView.setContentDescription(null);
-    unlabeledView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
-    unlabeledView.setClickable(true);
-    Rect validViewBounds = new Rect(100, 100, 200, 200);
-    shadowOf(unlabeledView).setGlobalVisibleRect(validViewBounds);
-
-    try {
-      shadowOf(unlabeledView).checkedPerformClick();
-      fail("RuntimeException not thrown");
-    } catch (RuntimeException e) {
-      // expected
-      assertContains("View is not visible and cannot be clicked", e.getMessage());
-    }
-  }
-
-  private void assertContains(String expectedText, String actualText) {
-    assertTrue("Expected <" + actualText + "> to contain <"
-        + expectedText + ">", actualText.contains(expectedText));
-  }
-}
diff --git a/plugins/accessibility-deprecated/src/test/java/org/robolectric/android/AccessibilityUtilTest.java b/plugins/accessibility-deprecated/src/test/java/org/robolectric/android/AccessibilityUtilTest.java
deleted file mode 100644
index 044a4d9..0000000
--- a/plugins/accessibility-deprecated/src/test/java/org/robolectric/android/AccessibilityUtilTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.robolectric.android;
-
-import static org.mockito.Mockito.mock;
-import static org.robolectric.Shadows.shadowOf;
-
-import android.graphics.Rect;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.style.ClickableSpan;
-import android.view.View;
-import android.widget.LinearLayout;
-import android.widget.TextView;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import com.google.android.apps.common.testing.accessibility.framework.integrations.AccessibilityViewCheckException;
-import org.hamcrest.Matchers;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.robolectric.RuntimeEnvironment;
-import org.robolectric.annotation.AccessibilityChecks;
-import org.robolectric.annotation.AccessibilityChecks.ForRobolectricVersion;
-
-/**
- * Tests for accessibility checking. The checking relies on the Accessibility Test Framework for
- * Android, which has support-v4 as a dependency, so these tests are included where the presence of
- * that library is guaranteed.
- */
-@RunWith(AndroidJUnit4.class)
-public class AccessibilityUtilTest {
-  private static final String DUPLICATE_STRING = "Duplicate";
-  private TextView textViewWithClickableSpan;
-  private LinearLayout parentLayout;
-  private View labeledView;
-  private View unlabeledView;
-  
-  @Before
-  public void setUp() throws Exception {
-    Rect validViewBounds = new Rect(100, 100, 200, 200);
-    
-    // Set the statics back to their default values
-    AccessibilityUtil.setRunChecksForRobolectricVersion(null);
-    AccessibilityUtil.setSuppressingResultMatcher(null);
-    AccessibilityUtil.setRunChecksFromRootView(false);
-    AccessibilityUtil.setThrowExceptionForErrors(true);
-
-    labeledView = new View(RuntimeEnvironment.application);
-    labeledView.setContentDescription("Something");
-    labeledView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
-    labeledView.setClickable(true);
-    // Force the views on the screen so they'll be seen as visible even though they aren't
-    // part of a valid view hierarchy
-    shadowOf(labeledView).setGlobalVisibleRect(validViewBounds);
-
-    unlabeledView = new View(RuntimeEnvironment.application);
-    unlabeledView.setContentDescription(null);
-    unlabeledView.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
-    unlabeledView.setClickable(true);
-    shadowOf(unlabeledView).setGlobalVisibleRect(validViewBounds);
-
-    parentLayout = new LinearLayout(RuntimeEnvironment.application);
-    parentLayout.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_YES);
-    parentLayout.addView(labeledView);
-    shadowOf(parentLayout).setGlobalVisibleRect(validViewBounds);
-    
-    textViewWithClickableSpan = new TextView(RuntimeEnvironment.application);
-    SpannableString spannableString = new SpannableString("Some text");
-    ClickableSpan mockClickableSpan = mock(ClickableSpan.class);
-    spannableString.setSpan(mockClickableSpan, 0, 1, Spanned.SPAN_COMPOSING);
-    textViewWithClickableSpan.setText(spannableString);
-    shadowOf(textViewWithClickableSpan).setGlobalVisibleRect(validViewBounds);
-  }
-
-  @Test(expected = AccessibilityViewCheckException.class)
-  public void checkUnlabeledView_shouldThrow() throws Exception {
-    AccessibilityUtil.checkView(unlabeledView);
-  }
-
-  @Test
-  public void checkOKView_shouldNotThrow() throws Exception {
-    AccessibilityUtil.checkView(labeledView);
-  }
-
-  @Test
-  public void default_viewWithSiblingIssue_shouldNotThrow() throws Exception {
-    parentLayout.addView(unlabeledView);
-    AccessibilityUtil.checkView(labeledView);
-  }
-
-  @Test(expected = AccessibilityViewCheckException.class)
-  public void whenCheckingFromRoot_viewWithSiblingIssue_shouldThrow() throws Exception {
-    parentLayout.addView(unlabeledView);
-    AccessibilityUtil.setRunChecksFromRootView(true);
-    AccessibilityUtil.checkView(labeledView);
-  }
-  
-  @Test(expected = AccessibilityViewCheckException.class)
-  @AccessibilityChecks
-  public void whenAnnotationPresent_conditionalCheckRun() {
-    AccessibilityUtil.checkViewIfCheckingEnabled(unlabeledView);
-  }
-
-  @Test
-  public void whenAnnotationNotPresent_conditionalCheckNotRun() {
-    AccessibilityUtil.checkViewIfCheckingEnabled(unlabeledView);
-  }
-
-  @Test(expected = AccessibilityViewCheckException.class)
-  public void framework2pt0Error_byDefault_shouldThrow() throws Exception {
-    AccessibilityUtil.checkView(textViewWithClickableSpan);
-  }
-
-  @Test
-  public void framework2pt0Error_whenCheckingForRL3pt0_shouldNotThrow() throws Exception {
-    AccessibilityUtil.setRunChecksForRobolectricVersion(ForRobolectricVersion.VERSION_3_0);
-    AccessibilityUtil.checkView(textViewWithClickableSpan);
-  }
-
-  @Test
-  @AccessibilityChecks(forRobolectricVersion = ForRobolectricVersion.VERSION_3_0)
-  public void framework2pt0Error_annotationForRL3pt0_shouldNotThrow() throws Exception {
-    AccessibilityUtil.checkView(textViewWithClickableSpan);
-  }
-
-  @Test(expected = AccessibilityViewCheckException.class)
-  @AccessibilityChecks(forRobolectricVersion = ForRobolectricVersion.VERSION_3_0)
-  public void framework2pt0Error_codeForcesRL3pt1_shouldThrow() throws Exception {
-    AccessibilityUtil.setRunChecksForRobolectricVersion(ForRobolectricVersion.VERSION_3_1);
-    AccessibilityUtil.checkView(textViewWithClickableSpan);
-  }
-
-  @Test
-  public void whenSuppressingResults_shouldNotThrow() throws Exception {
-    AccessibilityUtil.setSuppressingResultMatcher(Matchers.anything());
-    AccessibilityUtil.checkView(unlabeledView);
-  }
-
-  @Test
-  public void whenOnlyPrintingResults_shouldNotThrow() throws Exception {
-    AccessibilityUtil.setThrowExceptionForErrors(false);
-    AccessibilityUtil.checkView(unlabeledView);
-  }
-
-  @Test
-  public void warningIssue_shouldNotThrow() throws Exception {
-    labeledView.setContentDescription(DUPLICATE_STRING);
-    parentLayout.setContentDescription(DUPLICATE_STRING);
-    parentLayout.setClickable(true);
-    AccessibilityUtil.checkView(parentLayout);
-  }
-
-}
-
diff --git a/robolectric/src/main/java/org/robolectric/plugins/NoOpAccessibilityChecker.java b/robolectric/src/main/java/org/robolectric/plugins/NoOpAccessibilityChecker.java
deleted file mode 100644
index 783bbf2..0000000
--- a/robolectric/src/main/java/org/robolectric/plugins/NoOpAccessibilityChecker.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.robolectric.plugins;
-
-import com.google.auto.service.AutoService;
-import javax.annotation.Priority;
-import org.robolectric.pluginapi.AccessibilityChecker;
-
-/**
- * No-op implementation of AccessibilityChecker.
- *
- * Will be removed after Robolectric 4.4.
- *
- * @deprecated Use Espresso for view interactions.
- */
-@Deprecated
-@AutoService(AccessibilityChecker.class)
-@Priority(Integer.MIN_VALUE)
-public class NoOpAccessibilityChecker implements AccessibilityChecker {
-  public NoOpAccessibilityChecker() {
-  }
-
-  @Override
-  public void checkViewAccessibility(Object realView) {
-    // No-op.
-  }
-}
diff --git a/robolectric/src/test/java/org/robolectric/shadows/ShadowBluetoothAdapterTest.java b/robolectric/src/test/java/org/robolectric/shadows/ShadowBluetoothAdapterTest.java
index 9663545..032a8ec 100644
--- a/robolectric/src/test/java/org/robolectric/shadows/ShadowBluetoothAdapterTest.java
+++ b/robolectric/src/test/java/org/robolectric/shadows/ShadowBluetoothAdapterTest.java
@@ -14,6 +14,7 @@
 import android.bluetooth.BluetoothAdapter;
 import android.bluetooth.BluetoothDevice;
 import android.bluetooth.BluetoothProfile;
+import android.bluetooth.le.BluetoothLeAdvertiser;
 import android.bluetooth.le.BluetoothLeScanner;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 import java.util.UUID;
@@ -92,6 +93,22 @@
   }
 
   @Test
+  @Config(minSdk = LOLLIPOP)
+  public void canGetBluetoothLeAdvertiser() throws Exception {
+    BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
+    Class<?> iBluetoothManagerClass =
+        Shadow.class.getClassLoader().loadClass("android.bluetooth.IBluetoothManager");
+    shadowOf(adapter)
+        .setBluetoothLeAdvertiser(
+            Shadow.newInstance(
+                BluetoothLeAdvertiser.class,
+                new Class<?>[] {iBluetoothManagerClass},
+                new Object[] {null}));
+    BluetoothLeAdvertiser bluetoothLeAdvertiser = bluetoothAdapter.getBluetoothLeAdvertiser();
+    assertThat(bluetoothLeAdvertiser).isNotNull();
+  }
+
+  @Test
   @Config(minSdk = M)
   public void canGetAndSetBleScanAlwaysAvailable() throws Exception {
     BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
diff --git a/robolectric/src/test/java/org/robolectric/shadows/ShadowDisplayTest.java b/robolectric/src/test/java/org/robolectric/shadows/ShadowDisplayTest.java
index a4be75c..aa34390 100644
--- a/robolectric/src/test/java/org/robolectric/shadows/ShadowDisplayTest.java
+++ b/robolectric/src/test/java/org/robolectric/shadows/ShadowDisplayTest.java
@@ -2,6 +2,9 @@
 
 import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1;
 import static android.os.Build.VERSION_CODES.LOLLIPOP;
+import static android.os.Build.VERSION_CODES.M;
+import static android.os.Build.VERSION_CODES.N;
+import static com.google.common.truth.Truth.assertThat;
 import static org.junit.Assert.assertEquals;
 
 import android.graphics.Point;
@@ -9,6 +12,7 @@
 import android.hardware.display.DisplayManagerGlobal;
 import android.util.DisplayMetrics;
 import android.view.Display;
+import android.view.Display.HdrCapabilities;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 import org.junit.Before;
 import org.junit.Test;
@@ -142,4 +146,44 @@
     shadow.setRotation(testValue);
     assertEquals(testValue, display.getOrientation());
   }
+
+  @Test
+  @Config(minSdk = N)
+  public void setDisplayHdrCapabilities_shouldReturnHdrCapabilities() {
+    Display display = ShadowDisplay.getDefaultDisplay();
+    int[] hdrCapabilities =
+        new int[] {HdrCapabilities.HDR_TYPE_HDR10, HdrCapabilities.HDR_TYPE_DOLBY_VISION};
+    shadow.setDisplayHdrCapabilities(
+        display.getDisplayId(),
+        /* maxLuminance= */ 100f,
+        /* maxAverageLuminance= */ 100f,
+        /* minLuminance= */ 100f,
+        hdrCapabilities);
+
+    HdrCapabilities capabilities = display.getHdrCapabilities();
+
+    assertThat(capabilities).isNotNull();
+    assertThat(capabilities.getSupportedHdrTypes()).isEqualTo(hdrCapabilities);
+    assertThat(capabilities.getDesiredMaxAverageLuminance()).isEqualTo(100f);
+    assertThat(capabilities.getDesiredMaxLuminance()).isEqualTo(100f);
+    assertThat(capabilities.getDesiredMinLuminance()).isEqualTo(100f);
+  }
+
+  @Test
+  @Config(minSdk = M)
+  public void setDisplayHdrCapabilities_shouldThrowUnSupportedOperationException() {
+    Display display = ShadowDisplay.getDefaultDisplay();
+    int[] hdrCapabilities =
+        new int[] {HdrCapabilities.HDR_TYPE_HDR10, HdrCapabilities.HDR_TYPE_DOLBY_VISION};
+    try {
+      shadow.setDisplayHdrCapabilities(
+          display.getDisplayId(),
+          /* maxLuminance= */ 100f,
+          /* maxAverageLuminance= */ 100f,
+          /* minLuminance= */ 100f,
+          hdrCapabilities);
+    } catch (UnsupportedOperationException e) {
+      assertThat(e).hasMessageThat().contains("HDR capabilities are not supported below Android N");
+    }
+  }
 }
diff --git a/shadows/framework/src/main/java/org/robolectric/pluginapi/AccessibilityChecker.java b/shadows/framework/src/main/java/org/robolectric/pluginapi/AccessibilityChecker.java
deleted file mode 100644
index 4b6b642..0000000
--- a/shadows/framework/src/main/java/org/robolectric/pluginapi/AccessibilityChecker.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.robolectric.pluginapi;
-
-/**
- * Extension point for providing access to the old Accessibility Test Framework.
- *
- * Will be removed after Robolectric 4.4.
- *
- * @deprecated Use Espresso for view interactions.
- */
-@Deprecated
-@ExtensionPoint
-public interface AccessibilityChecker {
-  /** @deprecated Use Espresso for view interactions. */
-  @Deprecated
-  void checkViewAccessibility(Object realView);
-}
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBluetoothAdapter.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBluetoothAdapter.java
index 732fa10..29a25ca 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBluetoothAdapter.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowBluetoothAdapter.java
@@ -13,6 +13,7 @@
 import android.bluetooth.BluetoothProfile;
 import android.bluetooth.BluetoothServerSocket;
 import android.bluetooth.BluetoothSocket;
+import android.bluetooth.le.BluetoothLeAdvertiser;
 import android.bluetooth.le.BluetoothLeScanner;
 import android.content.Context;
 import android.os.Build;
@@ -41,6 +42,7 @@
 
   private static boolean isBluetoothSupported = true;
   private static BluetoothLeScanner bluetoothLeScanner = null;
+  private static BluetoothLeAdvertiser bluetoothLeAdvertiser = null;
 
   private Set<BluetoothDevice> bondedDevices = new HashSet<BluetoothDevice>();
   private Set<LeScanCallback> leScanCallbacks = new HashSet<LeScanCallback>();
@@ -62,6 +64,7 @@
   public static void reset() {
     setIsBluetoothSupported(true);
     bluetoothLeScanner = null;
+    bluetoothLeAdvertiser = null;
   }
 
   @Implementation
@@ -91,6 +94,15 @@
     return bluetoothLeScanner;
   }
 
+  @Implementation(minSdk = LOLLIPOP)
+  protected BluetoothLeAdvertiser getBluetoothLeAdvertiser() {
+    return bluetoothLeAdvertiser;
+  }
+
+  public void setBluetoothLeAdvertiser(BluetoothLeAdvertiser advertiser) {
+    bluetoothLeAdvertiser = advertiser;
+  }
+
   @Implementation
   protected Set<BluetoothDevice> getBondedDevices() {
     return Collections.unmodifiableSet(bondedDevices);
diff --git a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowView.java b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowView.java
index 9502d99..55d8cda 100644
--- a/shadows/framework/src/main/java/org/robolectric/shadows/ShadowView.java
+++ b/shadows/framework/src/main/java/org/robolectric/shadows/ShadowView.java
@@ -38,12 +38,10 @@
 import org.robolectric.annotation.Implements;
 import org.robolectric.annotation.LooperMode;
 import org.robolectric.annotation.RealObject;
-import org.robolectric.pluginapi.AccessibilityChecker;
 import org.robolectric.shadow.api.Shadow;
 import org.robolectric.util.ReflectionHelpers;
 import org.robolectric.util.ReflectionHelpers.ClassParameter;
 import org.robolectric.util.TimeUtils;
-import org.robolectric.util.inject.Injector;
 import org.robolectric.util.reflector.Accessor;
 import org.robolectric.util.reflector.ForType;
 
@@ -353,8 +351,6 @@
     if (!realView.isEnabled()) {
       throw new RuntimeException("View is not enabled and cannot be clicked");
     }
-
-    getAccessibilityChecker().checkViewAccessibility(realView);
     boolean res = realView.performClick();
     shadowMainLooper().idleIfPaused();
     return res;
@@ -693,25 +689,4 @@
     @Accessor("mWindowId")
     void setWindowId(WindowId windowId);
   }
-
-  /**
-   * Remove after 4.4.
-   * @deprecated Transitional use only.
-   */
-  @Deprecated
-  private static AccessibilityChecker accessibilityChecker;
-
-  /**
-   * Remove after 4.4.
-   * @deprecated Transitional use only.
-   */
-  @Deprecated
-  private static synchronized AccessibilityChecker getAccessibilityChecker() {
-    if (accessibilityChecker == null) {
-      // This isn't how Injector is intended to be used, but this will disappear soon.
-      // Please don't cargo-cult.
-      accessibilityChecker = new Injector().getInstance(AccessibilityChecker.class);
-    }
-    return accessibilityChecker;
-  }
 }