Better support for empty traces/states
At the moment many methods in flicker assume the trace (or state) will never be empty and invoke "first()" or "last()" without checks. This may result in hard to decipher error messages that don't point correctly to the issue.
Moreover, some of these calls occur on the "toString()" subject methods, causing debugging issues.
Instead use "firstOrNull()" and "lastOrNull()" to provide proper error messages for cases when traces or states are empty
Bug: 210465715
Test: atest FlickerLibTest
Change-Id: I0b24601a5626d86d7654a3b2c27a66048c8b6757
9 files changed