Minor Telephony Unit test cleanup fixes

- Simplify Looper initialization code
- Don't catch and re-throw exceptions in
  testWithTelephonyFeatureAndCompatChanges (hiding call stack)
- Use @Mock annotation instead of manual assignment

Bug: 365800992
Test: com.android.phone.PhoneInterfaceManagerTest
Flag: TEST_ONLY
Change-Id: I248cc4267ca543899bbe5f8473481c646130008a
diff --git a/tests/src/com/android/TelephonyTestBase.java b/tests/src/com/android/TelephonyTestBase.java
index d72d85e..2bc7bb9 100644
--- a/tests/src/com/android/TelephonyTestBase.java
+++ b/tests/src/com/android/TelephonyTestBase.java
@@ -51,19 +51,11 @@
 
     @Before
     public void setUp() throws Exception {
-        mContext = spy(new TestContext());
-        // Set up the looper if it does not exist on the test thread.
         if (Looper.myLooper() == null) {
             Looper.prepare();
-            // Wait until the looper is not null anymore
-            for(int i = 0; i < 5; i++) {
-                if (Looper.myLooper() != null) {
-                    break;
-                }
-                Looper.prepare();
-                Thread.sleep(100);
-            }
         }
+
+        mContext = spy(new TestContext());
     }
 
     @After
diff --git a/tests/src/com/android/phone/PhoneInterfaceManagerTest.java b/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
index 7464ba2..138be13 100644
--- a/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
+++ b/tests/src/com/android/phone/PhoneInterfaceManagerTest.java
@@ -20,7 +20,6 @@
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.ArgumentMatchers.anyString;
@@ -82,7 +81,7 @@
 
     private PhoneInterfaceManager mPhoneInterfaceManager;
     private SharedPreferences mSharedPreferences;
-    private IIntegerConsumer mIIntegerConsumer;
+    @Mock private IIntegerConsumer mIIntegerConsumer;
     private static final String sDebugPackageName =
             PhoneInterfaceManagerTest.class.getPackageName();
 
@@ -122,7 +121,6 @@
         mSharedPreferences = mPhoneInterfaceManager.getSharedPreferences();
         mSharedPreferences.edit().remove(Phone.PREF_NULL_CIPHER_AND_INTEGRITY_ENABLED).commit();
         mSharedPreferences.edit().remove(Phone.PREF_NULL_CIPHER_NOTIFICATIONS_ENABLED).commit();
-        mIIntegerConsumer = mock(IIntegerConsumer.class);
 
         // In order not to affect the existing implementation, define a telephony features
         // and disabled enforce_telephony_feature_mapping_for_public_apis feature flag
@@ -491,15 +489,11 @@
         mPhoneInterfaceManager.setFeatureFlags(mFeatureFlags);
         doNothing().when(mPhoneInterfaceManager).enforceModifyPermission();
 
-        try {
-            // FEATURE_TELEPHONY_CALLING
-            mPhoneInterfaceManager.handlePinMmiForSubscriber(1, "123456789");
+        // FEATURE_TELEPHONY_CALLING
+        mPhoneInterfaceManager.handlePinMmiForSubscriber(1, "123456789");
 
-            // FEATURE_TELEPHONY_RADIO_ACCESS
-            mPhoneInterfaceManager.toggleRadioOnOffForSubscriber(1);
-        } catch (Exception e) {
-            fail("Not expect exception " + e.getMessage());
-        }
+        // FEATURE_TELEPHONY_RADIO_ACCESS
+        mPhoneInterfaceManager.toggleRadioOnOffForSubscriber(1);
     }
 
     @Test