Conversation
…/sdl_java_suite into feature/android_12_fixes
Codecov Report
@@ Coverage Diff @@
## develop #1771 +/- ##
=============================================
- Coverage 54.39% 53.72% -0.67%
- Complexity 5516 5537 +21
=============================================
Files 562 562
Lines 25543 26070 +527
Branches 3328 3481 +153
=============================================
+ Hits 13893 14006 +113
- Misses 10391 10796 +405
- Partials 1259 1268 +9
|
joeygrover
left a comment
There was a problem hiding this comment.
With the addition of in line comments, you also need to update the bluetoothAvailable() method in SdlRouterService to check for bluetooth permissions. Currently the RS will check for BT availability when deciding if it should stay open and if the RS doesn't have BT permissions then it shouldn't.
android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java
Outdated
Show resolved
Hide resolved
android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java
Show resolved
Hide resolved
android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/MainActivity.java
Outdated
Show resolved
Hide resolved
android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
Outdated
Show resolved
Hide resolved
android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java
Outdated
Show resolved
Hide resolved
android/sdl_android/src/main/java/com/smartdevicelink/util/AndroidTools.java
Outdated
Show resolved
Hide resolved
android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
Show resolved
Hide resolved
android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
Show resolved
Hide resolved
android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlRouterService.java
Outdated
Show resolved
Hide resolved
| <string name="lockscreen_device_image_description">Device Icon</string> | ||
| <string name="default_lockscreen_warning_message">Swipe down to dismiss, acknowledging that you are not the driver.</string> | ||
| <string name="spp_out_of_resource">Too many apps are using Bluetooth</string> | ||
| <string name="allow_bluetooth_permissions">Please grant this app bluetooth permissions</string> |
There was a problem hiding this comment.
| <string name="allow_bluetooth_permissions">Please grant this app bluetooth permissions</string> | |
| <string name="allow_bluetooth_permissions">Please grant this app the Nearby Devices Permission to use bluetooth</string> |
There was a problem hiding this comment.
The permission name from Android isn't specific to bluetooth so we should make sure to match what it is.
| } else { | ||
| waitingForBTRuntimePermissions = false; | ||
| initBluetoothSerialService(); | ||
| } |
There was a problem hiding this comment.
| } else { | |
| waitingForBTRuntimePermissions = false; | |
| initBluetoothSerialService(); | |
| } | |
| } else { | |
| waitingForBTRuntimePermissions = false; | |
| initBluetoothSerialService(); | |
| final NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); | |
| if(notificationManager != null) { | |
| notificationManager.cancel("SDL", TransportConstants.SDL_ERROR_NOTIFICATION_CHANNEL_ID_INT); | |
| } | |
| } |
There was a problem hiding this comment.
We want to cancel the notification if the permission has been granted
| if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | ||
| if (!checkPermission()) { | ||
| requestPermission(); | ||
| } | ||
| } else if (BuildConfig.TRANSPORT.equals("TCP")){ | ||
| //If we are connected to a module we want to start our SdlService | ||
| SdlReceiver.queryForConnectedService(this); | ||
| } | ||
| } else { |
There was a problem hiding this comment.
| if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { | |
| if (!checkPermission()) { | |
| requestPermission(); | |
| } | |
| } else if (BuildConfig.TRANSPORT.equals("TCP")){ | |
| //If we are connected to a module we want to start our SdlService | |
| SdlReceiver.queryForConnectedService(this); | |
| } | |
| } else { | |
| if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S | |
| && !checkPermission()) { | |
| requestPermission(); | |
| return; | |
| } | |
| //If we are connected to a module we want to start our SdlService | |
| SdlReceiver.queryForConnectedService(this); | |
| } else if (BuildConfig.TRANSPORT.equals("TCP")) { |
There was a problem hiding this comment.
This logic needed to be cleaned up. Basically check for OS version and if permission is granted, if not request them. If OS is less than 12 or permissions are granted, query for the RS. The previous else if was in the wrong position for TCP.
| return; | ||
| } | ||
| serviceIntent.setAction(TransportConstants.BIND_REQUEST_TYPE_ALT_TRANSPORT); | ||
| serviceIntent.putExtra(TransportConstants.CONNECTION_TYPE_EXTRA, TransportConstants.ACTION_USB_ACCESSORY_ATTACHED); |
There was a problem hiding this comment.
| serviceIntent.putExtra(TransportConstants.CONNECTION_TYPE_EXTRA, TransportConstants.ACTION_USB_ACCESSORY_ATTACHED); | |
| serviceIntent.putExtra(TransportConstants.CONNECTION_TYPE_EXTRA, TransportConstants.AOA_USB); | |
There was a problem hiding this comment.
Should avoid using an action string for an extra in an intent.
| } | ||
| boolean isConnectedOverUSB = false; | ||
| if (intent != null && intent.hasExtra(TransportConstants.CONNECTION_TYPE_EXTRA)) { | ||
| isConnectedOverUSB = TransportConstants.ACTION_USB_ACCESSORY_ATTACHED.equalsIgnoreCase(intent.getStringExtra(TransportConstants.CONNECTION_TYPE_EXTRA)); |
There was a problem hiding this comment.
| isConnectedOverUSB = TransportConstants.ACTION_USB_ACCESSORY_ATTACHED.equalsIgnoreCase(intent.getStringExtra(TransportConstants.CONNECTION_TYPE_EXTRA)); | |
| isConnectedOverUSB = TransportConstants.AOA_USB.equalsIgnoreCase(intent.getStringExtra(TransportConstants.CONNECTION_TYPE_EXTRA)); |
Fixes #1732, #1751 and #1794
This PR is ready for review.
Risk
This PR makes major API changes.
Testing Plan
Unit Tests
N/A
Core Tests
Extensive smoke testing was done that is reflected in the Release Testing Template.
Targeting Android 11 should result in the same behavior as before
Target Android 12 tests include:
Connecting to SYNC over USB with BT permissions denied
Connecting to SYNC over BT with BT permissions denied
Connecting to SYNC over USB with BT permissions granted
Connecting to SYNC over BT with BT permissions granted
Connecting to SYNC over USB with BT permissions denied, granting permissions once connected, then connecting BT.
Connecting to SYNC with multiple apps targeting android 12 (one app with BT permissions granted, one with BT permissions denied).
Core version / branch / commit hash / module tested against: SYNC3
HMI name / version / branch / commit hash / module tested against: SYNC3
Summary
This PR addresses the issues that have been introduced by targeting Android 12 as outlined in this proposal (0345).
This includes:
CLA