Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0bf8a50 authored by Ugo Yu's avatar Ugo Yu
Browse files

Make sure the test looper is prepared in HeadsetPhoneStateTest

Bug: 152824317
Test: atest HeadsetPhoneStateTest
Change-Id: I9bcc78b155aba70c94c7f3e4866e4a5b343ff7b6
parent 356f8433
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.HandlerThread;
import android.os.IBinder;
import android.os.Looper;
import android.os.ServiceManager;
import android.telephony.PhoneStateListener;
import android.telephony.SubscriptionManager;
@@ -62,6 +63,9 @@ public class HeadsetPhoneStateTest {

    @Before
    public void setUp() throws Exception {
        if (Looper.myLooper() == null) {
            Looper.prepare();
        }
        MockitoAnnotations.initMocks(this);
        // Mock SubscriptionManager.getDefaultSubscriptionId() to return a valid value
        when(mISub.getDefaultSubId()).thenReturn(SubscriptionManager.DEFAULT_SUBSCRIPTION_ID);