From 919f2929df84cd8bbcd4f7f0b097a353da1beed0 Mon Sep 17 00:00:00 2001 From: Hiroki Sato Date: Fri, 19 May 2023 10:58:35 +0900 Subject: [PATCH] Don't enable a11y during ViewShowHidePerfTest Previous change Ieb506ca2ee8aee7a529183507e04382d167304b3 made this test regressed, but unless the test is verifying the behavior of accessibiltiy framework, accessibility can be disabled. Bug: 282011153 Test: ViewShowHidePerfTest Change-Id: I5ee374617fa4e3507037ae723b2b8102c09ac212 --- .../core/src/android/view/ViewShowHidePerfTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apct-tests/perftests/core/src/android/view/ViewShowHidePerfTest.java b/apct-tests/perftests/core/src/android/view/ViewShowHidePerfTest.java index a69d3ffa46fa3..818e11b407d59 100644 --- a/apct-tests/perftests/core/src/android/view/ViewShowHidePerfTest.java +++ b/apct-tests/perftests/core/src/android/view/ViewShowHidePerfTest.java @@ -18,6 +18,7 @@ package android.view; import static org.junit.Assert.assertTrue; +import android.app.UiAutomation; import android.content.Context; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; @@ -29,8 +30,8 @@ import android.widget.LinearLayout; import androidx.benchmark.BenchmarkState; import androidx.benchmark.junit4.BenchmarkRule; -import androidx.test.InstrumentationRegistry; import androidx.test.filters.LargeTest; +import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.rule.ActivityTestRule; import org.junit.Rule; @@ -142,6 +143,10 @@ public class ViewShowHidePerfTest { } private void testParentWithChild(TestCallback callback) throws Throwable { + // Make sure that a11y is disabled to prevent the test affected by accessibility events. + InstrumentationRegistry.getInstrumentation() + .getUiAutomation(UiAutomation.FLAG_DONT_USE_ACCESSIBILITY); + mActivityRule.runOnUiThread(() -> { final BenchmarkState state = mBenchmarkRule.getState();