Ensure PhoneConfigurationManager registrants are cleared after testing

PhoneConfigurationManager registrants are static, which can cause a
memoy leak between tests, ensure they are cleared after use.

Bug: 155320231
Test: atest TeleServiceTests
Change-Id: Iac5f377768080a221e2003f654035517479758d5
Merged-In: Iac5f377768080a221e2003f654035517479758d5
diff --git a/tests/src/com/android/TelephonyTestBase.java b/tests/src/com/android/TelephonyTestBase.java
index 86c5402..132d893 100644
--- a/tests/src/com/android/TelephonyTestBase.java
+++ b/tests/src/com/android/TelephonyTestBase.java
@@ -22,6 +22,8 @@
 import android.os.Looper;
 import android.util.Log;
 
+import com.android.internal.telephony.PhoneConfigurationManager;
+
 import org.mockito.MockitoAnnotations;
 
 import java.util.concurrent.CountDownLatch;
@@ -52,6 +54,8 @@
     }
 
     public void tearDown() throws Exception {
+        // Ensure there are no static references to handlers after test completes.
+        PhoneConfigurationManager.unregisterAllMultiSimConfigChangeRegistrants();
     }
 
     protected final void waitForHandlerAction(Handler h, long timeoutMillis) {