API level 27 (Android 8.1/Oreo) doesn't report a frame metric called
"deadline missed", but the JankTest library expects to be able to find
data for that metric. If it is not found, an assertion is reported and
the run fails.
Given Android Oreo is reasonably old at this point, set the minimum SDK
version to 28 so we can gather all the metrics we need.
Also bump the targetSdkVersion to make it clear what version was used
for putting this code together.
I noticed we were sometimes getting stale object exceptions. To help prevent
that situation from happening, pass around resource id's for the objects and
only fetch an instance of the objects whenever we need to click/scroll.
This means the time between fetching the object and using it is short, and
hopefully the object won't go stale or get recycled in that brief moment,
preventing the stale exceptions.
On tablets we have a landscape view by default, so we need to account for that
in our tests. On smaller phones, the landscape mode doesn't show the article
preview.
On both tablets and small screen phones, we need to be mindful of scrolling
too fast and missing an element we're looking for, either because a bigger
screen means we scroll faster or because a smaller screen means only a few
items are shown at one time.
Modify the JetNews workload to use the new jank testing classes. This allows
simplification of the code and also makes it more straightforward to implement
new workloads that also need to gather frame metrics.
This patch adds the JetNews jank-testing workload. This is accomplished
through the uiauto helper library and the jank test classes.
This workload requires a JetNews app APK to be available. We plan to
make it available through the workload-automation-assets repo.
At the end of the run, users should end up with a json file containing all
the frame/jank metrics.
There are 3 parameters for this workload:
- tests: Specifies which of the 3 available tests to run (default is to run
all of them)
- flingspeed: The speed of the fling interactions.
- repeat: How many times each of the selected tests is to be executed in a
single measuring session.