From 1c51927b6f6bcee0eea8ee01a955fc7ced0d730d Mon Sep 17 00:00:00 2001 From: Chun-Ku Lin Date: Mon, 27 Mar 2023 23:46:54 +0000 Subject: Allow Accessibility CTS to hover on the button within the touch delegate's bound, hover outside of the button on low pixel density devices. **Root cause** The cts is simulating hover on the views in the described sequence on the same y axis: the view with touch delegate (A - hoverLeft) > parent view (B - hoverMiddle) > sibling view (C - hoverRight) > parent view (B - hoverMiddle) > the view with touch delegate (A - hoverLeft). It has an assumption that the hoverMiddle will be on the parent view. However, if the calculation of the position for hoverLeft, hoverMiddle, hoverRight is different depending on the device's screen density, it's easy to break the test assumption. Changing the test position calculation to be screen density agnostic would make the test's assumption hold regardless of the device's screen density. Bug: 275003512 Test: atest AccessibilityEndToEndTest Change-Id: I7f9f55350a7c70ea482ff386d1eb93f66ed2c895 --- tests/accessibilityservice/res/values/dimens.xml | 21 +++++++++++++++++++++ .../cts/AccessibilityEndToEndTest.java | 6 ++++-- .../activities/AccessibilityEndToEndActivity.java | 3 ++- 3 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 tests/accessibilityservice/res/values/dimens.xml diff --git a/tests/accessibilityservice/res/values/dimens.xml b/tests/accessibilityservice/res/values/dimens.xml new file mode 100644 index 00000000000..a50549c55ed --- /dev/null +++ b/tests/accessibilityservice/res/values/dimens.xml @@ -0,0 +1,21 @@ + + + + + + 48dp + \ No newline at end of file diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java index 416621310d5..00034c159e5 100644 --- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java +++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEndToEndTest.java @@ -865,7 +865,8 @@ public class AccessibilityEndToEndTest { final Button buttonWithTooltip = mActivity.findViewById(R.id.buttonWithTooltip); final int[] buttonWithTooltipLocation = new int[2]; buttonWithTooltip.getLocationOnScreen(buttonWithTooltipLocation); - final int touchableSize = 48; + final int touchableSize = resources.getDimensionPixelSize( + R.dimen.button_touchable_width_increment_amount); final int hoverRight = buttonWithTooltipLocation[0] + touchableSize / 2; final int hoverLeft = buttonLocation[0] + button.getWidth() + touchableSize / 2; final int hoverMiddle = (hoverLeft + hoverRight) / 2; @@ -920,8 +921,9 @@ public class AccessibilityEndToEndTest { throws Throwable { mActivity.waitForEnterAnimationComplete(); - final int touchableSize = 48; final Resources resources = sInstrumentation.getTargetContext().getResources(); + final int touchableSize = resources.getDimensionPixelSize( + R.dimen.button_touchable_width_increment_amount); final String targetResourceName = resources.getResourceName(R.id.buttonDelegated); final View textView = mActivity.findViewById(R.id.delegateText); final Button target = mActivity.findViewById(R.id.buttonDelegated); diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java index 0e16b790e8c..7f2b95d48d3 100644 --- a/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java +++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityEndToEndActivity.java @@ -74,7 +74,8 @@ public class AccessibilityEndToEndActivity extends AccessibilityTestActivity { ListView listView = (ListView) findViewById(R.id.listview); listView.setAdapter(listAdapter); - final int touchableSize = 48; + final int touchableSize = getResources().getDimensionPixelSize( + R.dimen.button_touchable_width_increment_amount); Button button = findViewById(R.id.button); Function withTouchableAtRight = (v) -> new Rect( v.getLeft(), 0, v.getRight() + touchableSize, v.getHeight()); -- cgit v1.2.3 From 82f135a8e099a323a49c1a1a24c09081d8714c21 Mon Sep 17 00:00:00 2001 From: Eino-Ville Talvala Date: Thu, 30 Mar 2023 17:21:00 -0700 Subject: Camera CTS: Restore known failure for SurfaceViewPreviewTest#testPreparePerformance It appears that a merge accidentally removed known failure entries for SurfaceViewPreviewTest#testPreparePerformance from Android 12 CTS. Restore the status quo Test: Run atest to ensure XML is valid Bug: 266058777 Change-Id: I1aa3081bb5c5d226e069c9764a4de837d90c1ac9 --- tools/cts-tradefed/res/config/cts-known-failures.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml index 057692d9368..83db5b608a6 100644 --- a/tools/cts-tradefed/res/config/cts-known-failures.xml +++ b/tools/cts-tradefed/res/config/cts-known-failures.xml @@ -23,6 +23,10 @@