File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
android/sdl_android/src/androidTest/java/com/smartdevicelink Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
import android .Manifest ;
4
4
import android .content .ComponentName ;
5
+ import android .os .Build ;
5
6
import android .os .Looper ;
6
7
7
8
import androidx .test .ext .junit .runners .AndroidJUnit4 ;
33
34
public class TransportManagerTests {
34
35
35
36
@ Rule
36
- public GrantPermissionRule btRuntimePermissionRule = GrantPermissionRule . grant ( Manifest . permission . BLUETOOTH_CONNECT ) ;
37
+ public GrantPermissionRule btRuntimePermissionRule ;
37
38
MultiplexTransportConfig config ;
38
39
final TransportRecord defaultBtRecord = new TransportRecord (TransportType .BLUETOOTH , "12:34:56:78:90" );
39
40
final ComponentName routerServiceComponentName = new ComponentName ("com.smartdevicelink.test" , "com.smartdevicelink.test.SdlRouterService" );
@@ -67,6 +68,10 @@ public boolean onLegacyModeEnabled(String info) {
67
68
68
69
@ Before
69
70
public void setUp () throws Exception {
71
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .S ) {
72
+ btRuntimePermissionRule =
73
+ GrantPermissionRule .grant (Manifest .permission .BLUETOOTH_CONNECT );
74
+ }
70
75
config = new MultiplexTransportConfig (getInstrumentation ().getContext (), SdlUnitTestContants .TEST_APP_ID );
71
76
config .setService (routerServiceComponentName );
72
77
if (Looper .myLooper () == null ) {
Original file line number Diff line number Diff line change 37
37
@ RunWith (AndroidJUnit4 .class )
38
38
public class MediaStreamingStatusTests {
39
39
@ Rule
40
- public GrantPermissionRule btRuntimePermissionRule = GrantPermissionRule . grant ( Manifest . permission . BLUETOOTH_CONNECT ) ;
40
+ public GrantPermissionRule btRuntimePermissionRule ;
41
41
42
42
@ Mock
43
43
private AudioManager audioManager = mock (AudioManager .class );
@@ -63,6 +63,9 @@ public Object answer(InvocationOnMock invocation) {
63
63
64
64
@ Before
65
65
public void setUp () throws Exception {
66
+ if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .S ) {
67
+ btRuntimePermissionRule = GrantPermissionRule .grant (Manifest .permission .BLUETOOTH_CONNECT );
68
+ }
66
69
mockedContext = mock (Context .class );
67
70
doAnswer (onGetSystemService ).when (mockedContext ).getSystemService (Context .AUDIO_SERVICE );
68
71
defaultMediaStreamingStatus = new MediaStreamingStatus (mockedContext , mock (MediaStreamingStatus .Callback .class ));
You can’t perform that action at this time.
0 commit comments