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

Commit eeafd735 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I63b1ee6b,I8de3afa2

* changes:
  Refactor locks in radio client for HIDL HAL
  Refactor locks in radio client for AIDL HAL
parents 70c810f1 6402193c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -210,9 +210,9 @@ public final class BroadcastRadioServiceImplTest extends ExtendedRadioMockitoTes
                any(IServiceCallback.class)));

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

        when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock);
        when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock);
+1 −2
Original line number Diff line number Diff line
@@ -58,14 +58,13 @@ public final class RadioModuleTest {
    @Mock
    private android.hardware.broadcastradio.ICloseHandle mHalCloseHandleMock;

    private final Object mLock = new Object();
    // RadioModule under test
    private RadioModule mRadioModule;
    private android.hardware.broadcastradio.IAnnouncementListener mHalListener;

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

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

    private final Object mLock = new Object();
    // RadioModule under test
    private RadioModule mRadioModule;

@@ -104,7 +103,7 @@ public final class TunerSessionTest extends ExtendedRadioMockitoTestCase {
        doReturn(true).when(() -> RadioServiceUserController.isCurrentOrSystemUser());

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

        doAnswer(invocation -> {
            mHalTunerCallback = (ITunerCallback) invocation.getArguments()[0];
+3 −5
Original line number Diff line number Diff line
@@ -59,8 +59,6 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes
            new ArrayList<>(Arrays.asList("FmService", "DabService"));
    private static final int[] TEST_ENABLED_TYPES = new int[]{Announcement.TYPE_TRAFFIC};

    private final Object mLock = new Object();

    private BroadcastRadioService mBroadcastRadioService;
    private DeathRecipient mFmDeathRecipient;

@@ -200,7 +198,7 @@ public final class BroadcastRadioServiceHidlTest extends ExtendedRadioMockitoTes

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

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

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

        when(mFmRadioModuleMock.getProperties()).thenReturn(mFmModuleMock);
        when(mDabRadioModuleMock.getProperties()).thenReturn(mDabModuleMock);
+1 −2
Original line number Diff line number Diff line
@@ -62,13 +62,12 @@ public final class RadioModuleHidlTest {
    @Mock
    private android.hardware.broadcastradio.V2_0.ICloseHandle mHalCloseHandleMock;

    private final Object mLock = new Object();
    private RadioModule mRadioModule;
    private android.hardware.broadcastradio.V2_0.IAnnouncementListener mHalListener;

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

        when(mBroadcastRadioMock.getImage(anyInt())).thenReturn(new ArrayList<Byte>(0));

Loading