Defer complex object creation until used by tests.
As part of supporting SysUI multivalentTests under the new Ravenwood testing environment, tests need to be more careful about only creating and interacting with "complex" objects when they're actually needed by a test. Attempting interactions during <init> or <clinit> of the overall test class fails on Ravenwood when these complex objects aren't yet supported, and they throw an exception. The smoothest path towards mitigating this is by leveraging the `by lazy` feature of Kotlin, where we only create and interact with a complex object when actually requested by test method code. This strategy gives Ravenwood enough room to successfully instantiate test classes to decide if it should be executed or ignored via future annotations. This change is a purely mechanical adding of `by lazy` in all relevant locations, as uncovered via local investigation. Bug: 319647875 Test: atest SystemUiRoboTests Change-Id: I16b62d790511a9b9f37491f2e0d0f4719783d2ac
Loading
Please register or sign in to comment