Loading core/java/android/hardware/radio/IRadioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ interface IRadioService { List<RadioManager.ModuleProperties> listModules(); ITuner openTuner(int moduleId, in RadioManager.BandConfig bandConfig, boolean withAudio, in ITunerCallback callback, int targetSdkVersion); in ITunerCallback callback); ICloseHandle addAnnouncementListener(in int[] enabledTypes, in IAnnouncementListener listener); Loading core/java/android/hardware/radio/RadioManager.java +1 −3 Original line number Diff line number Diff line Loading @@ -1796,7 +1796,7 @@ public class RadioManager { ITuner tuner; TunerCallbackAdapter halCallback = new TunerCallbackAdapter(callback, handler); try { tuner = mService.openTuner(moduleId, config, withAudio, halCallback, mTargetSdkVersion); tuner = mService.openTuner(moduleId, config, withAudio, halCallback); } catch (RemoteException | IllegalArgumentException | IllegalStateException ex) { Log.e(TAG, "Failed to open tuner", ex); return null; Loading Loading @@ -1873,7 +1873,6 @@ public class RadioManager { @NonNull private final Context mContext; @NonNull private final IRadioService mService; private final int mTargetSdkVersion; /** * @hide Loading @@ -1890,6 +1889,5 @@ public class RadioManager { public RadioManager(Context context, IRadioService service) { mContext = context; mService = service; mTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; } } core/tests/BroadcastRadioTests/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package="com.android.frameworks.broadcastradiotests"> <uses-permission android:name="android.permission.ACCESS_BROADCAST_RADIO" /> <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE" /> <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" /> <application android:debuggable="true"> <uses-library android:name="android.test.runner" /> Loading core/tests/BroadcastRadioTests/src/android/hardware/radio/ProgramListTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -580,7 +580,7 @@ public final class ProgramListTest { doAnswer(invocation -> { mTunerCallback = (ITunerCallback) invocation.getArguments()[3]; return mTunerMock; }).when(mRadioServiceMock).openTuner(anyInt(), any(), anyBoolean(), any(), anyInt()); }).when(mRadioServiceMock).openTuner(anyInt(), any(), anyBoolean(), any()); mRadioTuner = radioManager.openTuner(/* moduleId= */ 0, band, /* withAudio= */ true, mTunerCallbackMock, /* handler= */ null); Loading core/tests/BroadcastRadioTests/src/android/hardware/radio/RadioManagerTest.java +2 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static org.mockito.Mockito.when; import android.annotation.Nullable; import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Build; import android.os.Parcel; import android.os.RemoteException; import android.util.ArrayMap; Loading @@ -50,8 +49,6 @@ import java.util.Set; @RunWith(MockitoJUnitRunner.class) public final class RadioManagerTest { private static final int TEST_TARGET_SDK_VERSION = Build.VERSION_CODES.CUR_DEVELOPMENT; private static final int REGION = RadioManager.REGION_ITU_2; private static final int FM_LOWER_LIMIT = 87500; private static final int FM_UPPER_LIMIT = 108000; Loading Loading @@ -1043,14 +1040,13 @@ public final class RadioManagerTest { mRadioManager.openTuner(moduleId, FM_BAND_CONFIG, withAudio, mCallbackMock, /* handler= */ null); verify(mRadioServiceMock).openTuner(eq(moduleId), eq(FM_BAND_CONFIG), eq(withAudio), any(), anyInt()); verify(mRadioServiceMock).openTuner(eq(moduleId), eq(FM_BAND_CONFIG), eq(withAudio), any()); } @Test public void openTuner_whenServiceDied_returnsNull() throws Exception { createRadioManager(); when(mRadioServiceMock.openTuner(anyInt(), any(), anyBoolean(), any(), anyInt())) when(mRadioServiceMock.openTuner(anyInt(), any(), anyBoolean(), any())) .thenThrow(new RemoteException()); RadioTuner nullTuner = mRadioManager.openTuner(/* moduleId= */ 0, FM_BAND_CONFIG, Loading Loading @@ -1166,7 +1162,6 @@ public final class RadioManagerTest { } private void createRadioManager() throws RemoteException { mApplicationInfo.targetSdkVersion = TEST_TARGET_SDK_VERSION; when(mContextMock.getApplicationInfo()).thenReturn(mApplicationInfo); when(mRadioServiceMock.listModules()).thenReturn(Arrays.asList(AMFM_PROPERTIES)); when(mRadioServiceMock.addAnnouncementListener(any(), any())).thenReturn(mCloseHandleMock); Loading Loading
core/java/android/hardware/radio/IRadioService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -31,7 +31,7 @@ interface IRadioService { List<RadioManager.ModuleProperties> listModules(); ITuner openTuner(int moduleId, in RadioManager.BandConfig bandConfig, boolean withAudio, in ITunerCallback callback, int targetSdkVersion); in ITunerCallback callback); ICloseHandle addAnnouncementListener(in int[] enabledTypes, in IAnnouncementListener listener); Loading
core/java/android/hardware/radio/RadioManager.java +1 −3 Original line number Diff line number Diff line Loading @@ -1796,7 +1796,7 @@ public class RadioManager { ITuner tuner; TunerCallbackAdapter halCallback = new TunerCallbackAdapter(callback, handler); try { tuner = mService.openTuner(moduleId, config, withAudio, halCallback, mTargetSdkVersion); tuner = mService.openTuner(moduleId, config, withAudio, halCallback); } catch (RemoteException | IllegalArgumentException | IllegalStateException ex) { Log.e(TAG, "Failed to open tuner", ex); return null; Loading Loading @@ -1873,7 +1873,6 @@ public class RadioManager { @NonNull private final Context mContext; @NonNull private final IRadioService mService; private final int mTargetSdkVersion; /** * @hide Loading @@ -1890,6 +1889,5 @@ public class RadioManager { public RadioManager(Context context, IRadioService service) { mContext = context; mService = service; mTargetSdkVersion = mContext.getApplicationInfo().targetSdkVersion; } }
core/tests/BroadcastRadioTests/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -18,6 +18,8 @@ package="com.android.frameworks.broadcastradiotests"> <uses-permission android:name="android.permission.ACCESS_BROADCAST_RADIO" /> <uses-permission android:name="android.permission.LOG_COMPAT_CHANGE" /> <uses-permission android:name="android.permission.READ_COMPAT_CHANGE_CONFIG" /> <application android:debuggable="true"> <uses-library android:name="android.test.runner" /> Loading
core/tests/BroadcastRadioTests/src/android/hardware/radio/ProgramListTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -580,7 +580,7 @@ public final class ProgramListTest { doAnswer(invocation -> { mTunerCallback = (ITunerCallback) invocation.getArguments()[3]; return mTunerMock; }).when(mRadioServiceMock).openTuner(anyInt(), any(), anyBoolean(), any(), anyInt()); }).when(mRadioServiceMock).openTuner(anyInt(), any(), anyBoolean(), any()); mRadioTuner = radioManager.openTuner(/* moduleId= */ 0, band, /* withAudio= */ true, mTunerCallbackMock, /* handler= */ null); Loading
core/tests/BroadcastRadioTests/src/android/hardware/radio/RadioManagerTest.java +2 −7 Original line number Diff line number Diff line Loading @@ -30,7 +30,6 @@ import static org.mockito.Mockito.when; import android.annotation.Nullable; import android.content.Context; import android.content.pm.ApplicationInfo; import android.os.Build; import android.os.Parcel; import android.os.RemoteException; import android.util.ArrayMap; Loading @@ -50,8 +49,6 @@ import java.util.Set; @RunWith(MockitoJUnitRunner.class) public final class RadioManagerTest { private static final int TEST_TARGET_SDK_VERSION = Build.VERSION_CODES.CUR_DEVELOPMENT; private static final int REGION = RadioManager.REGION_ITU_2; private static final int FM_LOWER_LIMIT = 87500; private static final int FM_UPPER_LIMIT = 108000; Loading Loading @@ -1043,14 +1040,13 @@ public final class RadioManagerTest { mRadioManager.openTuner(moduleId, FM_BAND_CONFIG, withAudio, mCallbackMock, /* handler= */ null); verify(mRadioServiceMock).openTuner(eq(moduleId), eq(FM_BAND_CONFIG), eq(withAudio), any(), anyInt()); verify(mRadioServiceMock).openTuner(eq(moduleId), eq(FM_BAND_CONFIG), eq(withAudio), any()); } @Test public void openTuner_whenServiceDied_returnsNull() throws Exception { createRadioManager(); when(mRadioServiceMock.openTuner(anyInt(), any(), anyBoolean(), any(), anyInt())) when(mRadioServiceMock.openTuner(anyInt(), any(), anyBoolean(), any())) .thenThrow(new RemoteException()); RadioTuner nullTuner = mRadioManager.openTuner(/* moduleId= */ 0, FM_BAND_CONFIG, Loading Loading @@ -1166,7 +1162,6 @@ public final class RadioManagerTest { } private void createRadioManager() throws RemoteException { mApplicationInfo.targetSdkVersion = TEST_TARGET_SDK_VERSION; when(mContextMock.getApplicationInfo()).thenReturn(mApplicationInfo); when(mRadioServiceMock.listModules()).thenReturn(Arrays.asList(AMFM_PROPERTIES)); when(mRadioServiceMock.addAnnouncementListener(any(), any())).thenReturn(mCloseHandleMock); Loading