From 1e2d624576aa34c6c47704fd50046394d28d80d1 Mon Sep 17 00:00:00 2001 From: Jeff Chen Date: Wed, 11 Jan 2023 23:39:02 +0000 Subject: [PATCH] Avoid un-registration when mRealInstrumentation is null. bug: 259957834 Test: http://ab/I62800010122127541 Change-Id: Ibf43986b2aba6542c20551e9414f1471ec81215a --- .../tests/utils/src/com/android/systemui/SysuiTestCase.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java b/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java index bf2235aa98a9b..1bab99787de49 100644 --- a/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java +++ b/packages/SystemUI/tests/utils/src/com/android/systemui/SysuiTestCase.java @@ -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)