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

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/20946639

Change-Id: Idbf0634d489404fc363aa592d803b1f28665d928
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Jeff Chen
2023-01-18 01:51:57 +00:00
committed by Automerger Merge Worker

View File

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