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

Commit f4b27d13 authored by Weilin Xu's avatar Weilin Xu Committed by Gerrit Code Review
Browse files

Merge "Add interface for radio service user controller" into main

parents 98248bd3 d2de243d
Loading
Loading
Loading
Loading
+8 −6
Original line number Original line Diff line number Diff line
@@ -41,6 +41,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe


    private static final int USER_ID_1 = 11;
    private static final int USER_ID_1 = 11;
    private static final int USER_ID_2 = 12;
    private static final int USER_ID_2 = 12;
    private RadioServiceUserController mUserController;


    @Mock
    @Mock
    private UserHandle mUserHandleMock;
    private UserHandle mUserHandleMock;
@@ -55,6 +56,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe
    public void setUp() {
    public void setUp() {
        doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle());
        doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle());
        doReturn(USER_ID_1).when(() -> ActivityManager.getCurrentUser());
        doReturn(USER_ID_1).when(() -> ActivityManager.getCurrentUser());
        mUserController = new RadioServiceUserControllerImpl();
    }
    }


    @Test
    @Test
@@ -62,7 +64,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe
        when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1);
        when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_1);


        assertWithMessage("Current user")
        assertWithMessage("Current user")
                .that(RadioServiceUserController.isCurrentOrSystemUser()).isTrue();
                .that(mUserController.isCurrentOrSystemUser()).isTrue();
    }
    }


    @Test
    @Test
@@ -70,7 +72,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe
        when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_2);
        when(mUserHandleMock.getIdentifier()).thenReturn(USER_ID_2);


        assertWithMessage("Non-current user")
        assertWithMessage("Non-current user")
                .that(RadioServiceUserController.isCurrentOrSystemUser()).isFalse();
                .that(mUserController.isCurrentOrSystemUser()).isFalse();
    }
    }


    @Test
    @Test
@@ -79,7 +81,7 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe
        when(mUserHandleMock.getIdentifier()).thenReturn(UserHandle.USER_SYSTEM);
        when(mUserHandleMock.getIdentifier()).thenReturn(UserHandle.USER_SYSTEM);


        assertWithMessage("System user")
        assertWithMessage("System user")
                .that(RadioServiceUserController.isCurrentOrSystemUser()).isTrue();
                .that(mUserController.isCurrentOrSystemUser()).isTrue();
    }
    }


    @Test
    @Test
@@ -88,13 +90,13 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe
        doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser);
        doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser);


        assertWithMessage("User when activity manager fails")
        assertWithMessage("User when activity manager fails")
                .that(RadioServiceUserController.isCurrentOrSystemUser()).isFalse();
                .that(mUserController.isCurrentOrSystemUser()).isFalse();
    }
    }


    @Test
    @Test
    public void getCurrentUser() {
    public void getCurrentUser() {
        assertWithMessage("Current user")
        assertWithMessage("Current user")
                .that(RadioServiceUserController.getCurrentUser()).isEqualTo(USER_ID_1);
                .that(mUserController.getCurrentUser()).isEqualTo(USER_ID_1);
    }
    }


    @Test
    @Test
@@ -103,6 +105,6 @@ public final class RadioServiceUserControllerTest extends ExtendedRadioMockitoTe
        doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser);
        doThrow(new RuntimeException()).when(ActivityManager::getCurrentUser);


        assertWithMessage("Current user when activity manager fails")
        assertWithMessage("Current user when activity manager fails")
                .that(RadioServiceUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL);
                .that(mUserController.getCurrentUser()).isEqualTo(UserHandle.USER_NULL);
    }
    }
}
}
+8 −7
Original line number Original line Diff line number Diff line
@@ -91,12 +91,13 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes
    private IAnnouncementListener mAnnouncementListenerMock;
    private IAnnouncementListener mAnnouncementListenerMock;
    @Mock
    @Mock
    private IBinder mListenerBinderMock;
    private IBinder mListenerBinderMock;
    @Mock
    private RadioServiceUserController mUserControllerMock;


    @Override
    @Override
    protected void initializeSession(StaticMockitoSessionBuilder builder) {
    protected void initializeSession(StaticMockitoSessionBuilder builder) {
        builder.spyStatic(ServiceManager.class)
        builder.spyStatic(ServiceManager.class)
                .spyStatic(RadioModule.class)
                .spyStatic(RadioModule.class);
                .spyStatic(RadioServiceUserController.class);
    }
    }


    @Test
    @Test
@@ -156,7 +157,7 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes
    @Test
    @Test
    public void openSession_forNonCurrentUser_throwsException() throws Exception {
    public void openSession_forNonCurrentUser_throwsException() throws Exception {
        createBroadcastRadioService();
        createBroadcastRadioService();
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        IllegalStateException thrown = assertThrows(IllegalStateException.class,
        IllegalStateException thrown = assertThrows(IllegalStateException.class,
                () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID,
                () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID,
@@ -206,9 +207,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes
    }
    }


    private void createBroadcastRadioService() throws RemoteException {
    private void createBroadcastRadioService() throws RemoteException {
        doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser();
        mockServiceManager();
        mockServiceManager();
        mBroadcastRadioService = new BroadcastRadioServiceImpl(SERVICE_LIST);
        mBroadcastRadioService = new BroadcastRadioServiceImpl(SERVICE_LIST, mUserControllerMock);
    }
    }


    private void mockServiceManager() throws RemoteException {
    private void mockServiceManager() throws RemoteException {
@@ -222,9 +223,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes
                any(IServiceCallback.class)));
                any(IServiceCallback.class)));


        doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
        doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
                eq(FM_RADIO_MODULE_ID), anyString(), any(IBinder.class)));
                eq(FM_RADIO_MODULE_ID), anyString(), any(IBinder.class), any()));
        doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
        doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
                eq(DAB_RADIO_MODULE_ID), anyString(), any(IBinder.class)));
                eq(DAB_RADIO_MODULE_ID), anyString(), any(IBinder.class), any()));


        when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock);
        when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock);
        when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock);
        when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock);
+6 −1
Original line number Original line Diff line number Diff line
@@ -34,6 +34,8 @@ import android.hardware.radio.RadioManager;
import android.os.ParcelableException;
import android.os.ParcelableException;
import android.os.RemoteException;
import android.os.RemoteException;


import com.android.server.broadcastradio.RadioServiceUserController;

import com.google.common.truth.Expect;
import com.google.common.truth.Expect;


import org.junit.Before;
import org.junit.Before;
@@ -63,6 +65,8 @@ public final class RadioModuleTest {
    private IAnnouncementListener mListenerMock;
    private IAnnouncementListener mListenerMock;
    @Mock
    @Mock
    private android.hardware.broadcastradio.ICloseHandle mHalCloseHandleMock;
    private android.hardware.broadcastradio.ICloseHandle mHalCloseHandleMock;
    @Mock
    private RadioServiceUserController mUserControllerMock;


    // RadioModule under test
    // RadioModule under test
    private RadioModule mRadioModule;
    private RadioModule mRadioModule;
@@ -70,7 +74,8 @@ public final class RadioModuleTest {


    @Before
    @Before
    public void setup() throws RemoteException {
    public void setup() throws RemoteException {
        mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES);
        mRadioModule = new RadioModule(mBroadcastRadioMock, TEST_MODULE_PROPERTIES,
                mUserControllerMock);


        // TODO(b/241118988): test non-null image for getImage method
        // TODO(b/241118988): test non-null image for getImage method
        when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(null);
        when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(null);
+17 −16
Original line number Original line Diff line number Diff line
@@ -151,6 +151,8 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    @Mock
    @Mock
    private IBroadcastRadio mBroadcastRadioMock;
    private IBroadcastRadio mBroadcastRadioMock;
    private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks;
    private android.hardware.radio.ITunerCallback[] mAidlTunerCallbackMocks;
    @Mock
    private RadioServiceUserController mUserControllerMock;


    // RadioModule under test
    // RadioModule under test
    private RadioModule mRadioModule;
    private RadioModule mRadioModule;
@@ -169,8 +171,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {


    @Override
    @Override
    protected void initializeSession(StaticMockitoSessionBuilder builder) {
    protected void initializeSession(StaticMockitoSessionBuilder builder) {
        builder.spyStatic(RadioServiceUserController.class).spyStatic(CompatChanges.class)
        builder.spyStatic(CompatChanges.class).spyStatic(Binder.class);
                .spyStatic(Binder.class);
    }
    }


    @Before
    @Before
@@ -183,11 +184,11 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
                eq(ConversionUtils.RADIO_U_VERSION_REQUIRED), anyInt()));
                eq(ConversionUtils.RADIO_U_VERSION_REQUIRED), anyInt()));
        doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier();
        doReturn(USER_ID_1).when(mUserHandleMock).getIdentifier();
        doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle());
        doReturn(mUserHandleMock).when(() -> Binder.getCallingUserHandle());
        doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(true).when(mUserControllerMock).isCurrentOrSystemUser();
        doReturn(USER_ID_1).when(() -> RadioServiceUserController.getCurrentUser());
        doReturn(USER_ID_1).when(mUserControllerMock).getCurrentUser();


        mRadioModule = new RadioModule(mBroadcastRadioMock,
        mRadioModule = new RadioModule(mBroadcastRadioMock,
                AidlTestUtils.makeDefaultModuleProperties());
                AidlTestUtils.makeDefaultModuleProperties(), mUserControllerMock);


        doAnswer(invocation -> {
        doAnswer(invocation -> {
            mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0];
            mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0];
@@ -224,7 +225,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    @Test
    @Test
    public void setConfiguration_forNonCurrentUser_doesNotInvokesCallback() throws Exception {
    public void setConfiguration_forNonCurrentUser_doesNotInvokesCallback() throws Exception {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].setConfiguration(FM_BAND_CONFIG);
        mTunerSessions[0].setConfiguration(FM_BAND_CONFIG);


@@ -421,7 +422,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    @Test
    @Test
    public void tune_forNonCurrentUser_doesNotTune() throws Exception {
    public void tune_forNonCurrentUser_doesNotTune() throws Exception {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();
        ProgramSelector initialSel = AidlTestUtils.makeFmSelector(AM_FM_FREQUENCY_LIST[1]);
        ProgramSelector initialSel = AidlTestUtils.makeFmSelector(AM_FM_FREQUENCY_LIST[1]);
        RadioManager.ProgramInfo tuneInfo =
        RadioManager.ProgramInfo tuneInfo =
                AidlTestUtils.makeProgramInfo(initialSel, SIGNAL_QUALITY);
                AidlTestUtils.makeProgramInfo(initialSel, SIGNAL_QUALITY);
@@ -501,7 +502,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo(
        mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo(
                ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY);
                ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].step(/* directionDown= */ true, /* skipSubChannel= */ false);
        mTunerSessions[0].step(/* directionDown= */ true, /* skipSubChannel= */ false);


@@ -580,7 +581,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo(
        mHalCurrentInfo = AidlTestUtils.makeHalProgramInfo(
                ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY);
                ConversionUtils.programSelectorToHalProgramSelector(initialSel), SIGNAL_QUALITY);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].seek(/* directionDown= */ true, /* skipSubChannel= */ false);
        mTunerSessions[0].seek(/* directionDown= */ true, /* skipSubChannel= */ false);


@@ -614,7 +615,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    @Test
    @Test
    public void cancel_forNonCurrentUser_doesNotCancel() throws Exception {
    public void cancel_forNonCurrentUser_doesNotCancel() throws Exception {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].cancel();
        mTunerSessions[0].cancel();


@@ -685,7 +686,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    @Test
    @Test
    public void startBackgroundScan_forNonCurrentUser_doesNotInvokesCallback() throws Exception {
    public void startBackgroundScan_forNonCurrentUser_doesNotInvokesCallback() throws Exception {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].startBackgroundScan();
        mTunerSessions[0].startBackgroundScan();


@@ -955,7 +956,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(),
        ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(),
                /* includeCategories= */ true, /* excludeModifications= */ false);
                /* includeCategories= */ true, /* excludeModifications= */ false);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].startProgramListUpdates(filter);
        mTunerSessions[0].startProgramListUpdates(filter);


@@ -994,7 +995,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
        ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(),
        ProgramList.Filter filter = new ProgramList.Filter(new ArraySet<>(), new ArraySet<>(),
                /* includeCategories= */ true, /* excludeModifications= */ false);
                /* includeCategories= */ true, /* excludeModifications= */ false);
        mTunerSessions[0].startProgramListUpdates(filter);
        mTunerSessions[0].startProgramListUpdates(filter);
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].stopProgramListUpdates();
        mTunerSessions[0].stopProgramListUpdates();


@@ -1060,7 +1061,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    public void setConfigFlag_forNonCurrentUser_doesNotSetConfigFlag() throws Exception {
    public void setConfigFlag_forNonCurrentUser_doesNotSetConfigFlag() throws Exception {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        int flag = UNSUPPORTED_CONFIG_FLAG + 1;
        int flag = UNSUPPORTED_CONFIG_FLAG + 1;
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].setConfigFlag(flag, /* value= */ true);
        mTunerSessions[0].setConfigFlag(flag, /* value= */ true);


@@ -1125,7 +1126,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
        openAidlClients(/* numClients= */ 1);
        openAidlClients(/* numClients= */ 1);
        Map<String, String> parametersSet = Map.of("mockParam1", "mockValue1",
        Map<String, String> parametersSet = Map.of("mockParam1", "mockValue1",
                "mockParam2", "mockValue2");
                "mockParam2", "mockValue2");
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        doReturn(false).when(mUserControllerMock).isCurrentOrSystemUser();


        mTunerSessions[0].setParameters(parametersSet);
        mTunerSessions[0].setParameters(parametersSet);


@@ -1179,7 +1180,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
    public void onCurrentProgramInfoChanged_withNonCurrentUser_doesNotInvokeCallback()
    public void onCurrentProgramInfoChanged_withNonCurrentUser_doesNotInvokeCallback()
            throws Exception {
            throws Exception {
        openAidlClients(1);
        openAidlClients(1);
        doReturn(USER_ID_2).when(() -> RadioServiceUserController.getCurrentUser());
        doReturn(USER_ID_2).when(mUserControllerMock).getCurrentUser();


        mHalTunerCallback.onCurrentProgramInfoChanged(AidlTestUtils.makeHalProgramInfo(
        mHalTunerCallback.onCurrentProgramInfoChanged(AidlTestUtils.makeHalProgramInfo(
                AidlTestUtils.makeHalFmSelector(AM_FM_FREQUENCY_LIST[1]), SIGNAL_QUALITY));
                AidlTestUtils.makeHalFmSelector(AM_FM_FREQUENCY_LIST[1]), SIGNAL_QUALITY));
+8 −7
Original line number Original line Diff line number Diff line
@@ -88,11 +88,12 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes
    private IAnnouncementListener mAnnouncementListenerMock;
    private IAnnouncementListener mAnnouncementListenerMock;
    @Mock
    @Mock
    private IBinder mBinderMock;
    private IBinder mBinderMock;
    @Mock
    private RadioServiceUserController mUserControllerMock;


    @Override
    @Override
    protected void initializeSession(StaticMockitoSessionBuilder builder) {
    protected void initializeSession(StaticMockitoSessionBuilder builder) {
        builder.spyStatic(RadioModule.class)
        builder.spyStatic(RadioModule.class);
                .spyStatic(RadioServiceUserController.class);
    }
    }


    @Test
    @Test
@@ -156,7 +157,7 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes
    @Test
    @Test
    public void openSession_forNonCurrentUser_throwsException() throws Exception {
    public void openSession_forNonCurrentUser_throwsException() throws Exception {
        createBroadcastRadioService();
        createBroadcastRadioService();
        doReturn(false).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        when(mUserControllerMock.isCurrentOrSystemUser()).thenReturn(false);


        IllegalStateException thrown = assertThrows(IllegalStateException.class,
        IllegalStateException thrown = assertThrows(IllegalStateException.class,
                () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID,
                () -> mBroadcastRadioService.openSession(FM_RADIO_MODULE_ID,
@@ -206,11 +207,11 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes
    }
    }


    private void createBroadcastRadioService() throws RemoteException {
    private void createBroadcastRadioService() throws RemoteException {
        doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser());
        when(mUserControllerMock.isCurrentOrSystemUser()).thenReturn(true);


        mockServiceManager();
        mockServiceManager();
        mBroadcastRadioService = new BroadcastRadioService(/* nextModuleId= */ FM_RADIO_MODULE_ID,
        mBroadcastRadioService = new BroadcastRadioService(/* nextModuleId= */ FM_RADIO_MODULE_ID,
                mServiceManagerMock);
                mServiceManagerMock, mUserControllerMock);
    }
    }


    private void mockServiceManager() throws RemoteException {
    private void mockServiceManager() throws RemoteException {
@@ -231,9 +232,9 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes
                }).thenReturn(true);
                }).thenReturn(true);


        doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
        doReturn(mFmRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
                eq(FM_RADIO_MODULE_ID), anyString()));
                eq(FM_RADIO_MODULE_ID), anyString(), any()));
        doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
        doReturn(mDabRadioModuleMock).when(() -> RadioModule.tryLoadingModule(
                eq(DAB_RADIO_MODULE_ID), anyString()));
                eq(DAB_RADIO_MODULE_ID), anyString(), any()));


        when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock);
        when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock);
        when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock);
        when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock);
Loading