CtsLeanbackJank: fix focus and pre-scroll delay.
The targetSdk of the app is set to 23 and the view is not marked as
focusable. It needs to explicitly add focusable="true" and
focusableInTouchMode="true" or the header will not be focused when
targetSdk is less than 26.
A pre-scroll delay is added because previously the test was scrolling
before the cards had been rendered and then they would not be rendered
during the test. To test the GPU workload that we want to test, we need
to ensure the cards are shown while scrolling so we wait a bit for them
to load before scrolling.
Test: cts-tradefed run cts -m CtsLeanbackJankTestCases
Bug: 118448019
Bug: 118439201
Change-Id: I5da89c8eb1780615d9906e0a7bf291e196be74d2
diff --git a/tests/leanbackjank/app/res/layout/icon_header_item.xml b/tests/leanbackjank/app/res/layout/icon_header_item.xml
index 56c8488..ce4942d 100644
--- a/tests/leanbackjank/app/res/layout/icon_header_item.xml
+++ b/tests/leanbackjank/app/res/layout/icon_header_item.xml
@@ -17,6 +17,8 @@
<androidx.leanback.widget.NonOverlappingLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="horizontal"
+ android:focusable="true"
+ android:focusableInTouchMode="true"
android:layout_width="match_parent"
android:layout_height="match_parent">
diff --git a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
index ded9ea1..0c19395 100644
--- a/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
+++ b/tests/leanbackjank/src/android/leanbackjank/cts/CtsDeviceLeanback.java
@@ -32,7 +32,7 @@
private static final long WAIT_TIMEOUT = 5 * MILLIS_PER_SECOND;
private static final int SCROLL_COUNT = 100;
private static final int SCROLL_INTERVAL_MILLIS = 200;
- private static final int PRE_SCROLL_DELAY_MILLIS = 0;
+ private static final int PRE_SCROLL_DELAY_MILLIS = 500;
private static final int PRE_SCROLL_IDLE_TIME = 2 * MILLIS_PER_SECOND;
private static final int SAMPLING_DURATION_SECONDS = 2;
private static final int SAMPLING_DURATION_MILLIS =