From 8bd458b51817aa4cbe9ad8a7078cdeb2c7590e51 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 12 Jul 2022 05:08:21 +0000 Subject: [PATCH] Extend accessibility timeout indefinitely before overview screenshot Test: atest TaplTestsQuickstep#testOverviewActions Bug: 236730000 Change-Id: I4db9fc01aaa048cead47e14c34df609bb43f3906 --- .../launcher3/tapl/LauncherInstrumentation.java | 11 +++++++++++ .../com/android/launcher3/tapl/OverviewActions.java | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java index a5f8cf23aa..fa6141ad23 100644 --- a/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java +++ b/tests/tapl/com/android/launcher3/tapl/LauncherInstrumentation.java @@ -373,6 +373,17 @@ public final class LauncherInstrumentation { sActiveContainer = new WeakReference<>(container); } + /** + * Sets the accesibility interactive timeout to be effectively indefinite (UI using this + * accesibility timeout will not automatically dismiss if true). + */ + void setIndefiniteAccessibilityInteractiveUiTimeout(boolean indefiniteTimeout) { + final String cmd = indefiniteTimeout + ? "settings put secure accessibility_interactive_ui_timeout_ms 10000" + : "settings delete secure accessibility_interactive_ui_timeout_ms"; + logShellCommand(cmd); + } + public NavigationModel getNavigationModel() { final Context baseContext = mInstrumentation.getTargetContext(); try { diff --git a/tests/tapl/com/android/launcher3/tapl/OverviewActions.java b/tests/tapl/com/android/launcher3/tapl/OverviewActions.java index 2f44bb6aa4..d1b1a846fe 100644 --- a/tests/tapl/com/android/launcher3/tapl/OverviewActions.java +++ b/tests/tapl/com/android/launcher3/tapl/OverviewActions.java @@ -41,6 +41,8 @@ public class OverviewActions { try (LauncherInstrumentation.Closable e = mLauncher.eventsCheck(); LauncherInstrumentation.Closable c = mLauncher.addContextLayer( "want to click screenshot button and exit screenshot ui")) { + mLauncher.setIndefiniteAccessibilityInteractiveUiTimeout(true); + UiObject2 screenshot = mLauncher.waitForObjectInContainer(mOverviewActions, "action_screenshot"); @@ -62,6 +64,8 @@ public class OverviewActions { return new Overview(mLauncher); } } + } finally { + mLauncher.setIndefiniteAccessibilityInteractiveUiTimeout(false); } }