Merge "Avoid un-registration when mRealInstrumentation is null." into tm-qpr-dev

This commit is contained in:
Jeff Chen
2023-01-18 01:34:41 +00:00
committed by Android (Google) Code Review

View File

@@ -132,8 +132,10 @@ public abstract class SysuiTestCase {
@After
public void SysuiTeardown() {
InstrumentationRegistry.registerInstance(mRealInstrumentation,
InstrumentationRegistry.getArguments());
if (mRealInstrumentation != null) {
InstrumentationRegistry.registerInstance(mRealInstrumentation,
InstrumentationRegistry.getArguments());
}
if (TestableLooper.get(this) != null) {
TestableLooper.get(this).processAllMessages();
// Must remove static reference to this test object to prevent leak (b/261039202)