summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Grover <joeygrover@gmail.com>2023-02-14 13:41:29 -0500
committerGitHub <noreply@github.com>2023-02-14 13:41:29 -0500
commita9241279e9b977b5344b746c159a3b74188a28ce (patch)
tree92361903c7b9901c6f453ae27bfc361c143850b3
parentc5b805411cc285c0ade2933a22c4134c922a1b13 (diff)
parentd424ab265bd23d21386323f84e20299c64561af4 (diff)
downloadsdl_android-master.tar.gz
Merge pull request #1840 from smartdevicelink/hotfix/issue_1839HEAD5.6.1masterdevelop
Hot Fix for #1839. Adding fallback logic for starting router service
-rw-r--r--.github/workflows/android.yml5
-rw-r--r--CHANGELOG.md32
-rw-r--r--VERSION2
-rw-r--r--android/sdl_android/build.gradle2
-rw-r--r--android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java55
-rw-r--r--javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java2
6 files changed, 57 insertions, 41 deletions
diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml
index 0aa33c484..d8d652c77 100644
--- a/.github/workflows/android.yml
+++ b/.github/workflows/android.yml
@@ -36,11 +36,6 @@ jobs:
- name: Sdl JavaEE Tests
run: ./javaEE/gradlew -p ./javaEE/javaEE test
- - name: RPC Generator Tests
- run: |
- python3 -m pip install -r ./generator/requirements.txt
- python3 ./generator/test/runner.py
-
- name: Codecov
uses: codecov/codecov-action@v1.0.13
with:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f5b1a9cb0..2bcecba4e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,29 +1,13 @@
-# 5.6.0 Release Notes
+# 5.6.1 Release Notes
## Summary:
-||Version|
-|--|--|
-| **Protocol** | 5.4.1
-| **RPC** | 8.0.0
-| **Tested Targeting** | Android 33
-## Bug Fixes:
+|| Version|
+|---|---|
+| **Protocol** | 5.4.1 |
+| **RPC** | 8.0.0 |
+| **Tested Targeting** | Android 33 |
-- [Images not displaying correctly on Alerts sent via AlertManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1835)
-
-- [TemplateConfiguration not set in currentScreenData in TextAndGraphicManager on RPC >= 6 ](https://github.com/smartdevicelink/sdl_java_suite/issues/1833)
-
-- [Setting bad data in one T&G field then good data quickly in another can lead to the good data failing.](https://github.com/smartdevicelink/sdl_java_suite/issues/1828)
-
-- [ForegroundServiceStartNotAllowedException in SdlRouterStatusProvider](https://github.com/smartdevicelink/sdl_java_suite/issues/1829)
-
-- [`DisplayCapabilities` `ScreenParams` null in SystemCapabilityManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1824)
-
-- [Media app does not disappear from Sync after bluetooth connection is turned off when USB is plugged in if the app RequiresAudioSupport flag is set to true](https://github.com/smartdevicelink/sdl_java_suite/issues/1802)
-
-- [Android 13 issues](https://github.com/smartdevicelink/sdl_java_suite/issues/1812)
-
-- [ForegroundServiceStartNotAllowedException in SdlRouterService ](https://github.com/smartdevicelink/sdl_java_suite/issues/1815)
-
-- [SdlArtwork clone issue](https://github.com/smartdevicelink/sdl_java_suite/issues/1818)
+## Bug Fix / Enhancements:
+- [Nearby Devices permission on Android 12 and Above #1839](https://github.com/smartdevicelink/sdl_java_suite/issues/1839) \ No newline at end of file
diff --git a/VERSION b/VERSION
index 1bc788d3b..b7c75422b 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.6.0
+5.6.1
diff --git a/android/sdl_android/build.gradle b/android/sdl_android/build.gradle
index c7cce6954..8bf0122f3 100644
--- a/android/sdl_android/build.gradle
+++ b/android/sdl_android/build.gradle
@@ -5,7 +5,7 @@ android {
defaultConfig {
minSdkVersion 16
targetSdkVersion 33
- versionCode 24
+ versionCode 25
versionName new File(projectDir.path, ('/../../VERSION')).text.trim()
buildConfigField "String", "VERSION_NAME", '\"' + versionName + '\"'
resValue "string", "SDL_LIB_VERSION", '\"' + versionName + '\"'
diff --git a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
index 936989f5c..2bfe13ef1 100644
--- a/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
+++ b/android/sdl_android/src/main/java/com/smartdevicelink/transport/SdlBroadcastReceiver.java
@@ -303,25 +303,33 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver {
final boolean sdlDeviceListenerEnabled = SdlDeviceListener.isFeatureSupported(sdlAppInfoList);
if (sdlDeviceListenerEnabled) {
String myPackage = context.getPackageName();
- String routerServicePackage = null;
+ ComponentName routerService = null;
+ boolean isPreAndroid12RSOnDevice = false;
if (sdlAppInfoList != null && !sdlAppInfoList.isEmpty() && sdlAppInfoList.get(0).getRouterServiceComponentName() != null) {
- routerServicePackage = sdlAppInfoList.get(0).getRouterServiceComponentName().getPackageName();
+ routerService = sdlAppInfoList.get(0).getRouterServiceComponentName();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
+ isPreAndroid12RSOnDevice = isPreAndroid12RSOnDevice(sdlAppInfoList, context);
// If all apps have a RS newer than the Android 12 update, chosen app does not have BT Connect permissions, and more than 1 sdl app is installed
- if (!isPreAndroid12RSOnDevice(sdlAppInfoList) && !AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, routerServicePackage) && sdlAppInfoList.size() > 1) {
+ if (!isPreAndroid12RSOnDevice
+ && !AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, routerService.getPackageName())
+ && sdlAppInfoList.size() > 1) {
for (SdlAppInfo appInfo : sdlAppInfoList) {
if (AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, appInfo.getRouterServiceComponentName().getPackageName())) {
//If this app in the list has BT Connect permissions, we want to use that apps RS
- routerServicePackage = appInfo.getRouterServiceComponentName().getPackageName();
+ routerService = appInfo.getRouterServiceComponentName();
break;
}
}
}
}
}
+ if (routerService == null) {
+ DebugTool.logError(TAG, "Router service was null, aborting.");
+ return;
+ }
DebugTool.logInfo(TAG, ": This app's package: " + myPackage);
- DebugTool.logInfo(TAG, ": Router service app's package: " + routerServicePackage);
- if (myPackage != null && myPackage.equalsIgnoreCase(routerServicePackage)) {
+ DebugTool.logInfo(TAG, ": Router service app's package: " + routerService.getPackageName());
+ if (myPackage != null && myPackage.equalsIgnoreCase(routerService.getPackageName())) {
//If the device is not null the listener should start as well as the
//case where this app was installed after BT connected and is the
//only SDL app installed on the device. (Rare corner case)
@@ -333,6 +341,16 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver {
} else {
DebugTool.logInfo(TAG, "Not starting device listener, bluetooth device is null and other SDL apps installed.");
}
+ } else if (isPreAndroid12RSOnDevice) {
+ //If the RS app has the BLUETOOTH_CONNECT permission that means it
+ //will use its proper flow. If it doesn't, it's router service
+ //must be started to kick off the chain of staring a valid RS.
+ if (!AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, routerService.getPackageName())) {
+ DebugTool.logInfo(TAG, "Starting newest RS because of older version of the library on device.");
+ startRouterService(context, routerService, false, device, false, vehicleType);
+ } else {
+ DebugTool.logInfo(TAG, "Newest RS app should be starting sequence correctly.");
+ }
} else {
DebugTool.logInfo(TAG, ": Not the app to start the router service nor device listener");
}
@@ -644,7 +662,9 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver {
ComponentName routerService = sdlAppInfoList.get(0).getRouterServiceComponentName();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// If all apps have a RS newer than the Android 12 update, chosen app does not have BT Connect permissions, and more than 1 sdl app is installed
- if (!isPreAndroid12RSOnDevice(sdlAppInfoList) && !AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, routerService.getPackageName()) && sdlAppInfoList.size() > 1) {
+ if (!isPreAndroid12RSOnDevice(sdlAppInfoList, context)
+ && !AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, routerService.getPackageName())
+ && sdlAppInfoList.size() > 1) {
for (SdlAppInfo appInfo : sdlAppInfoList) {
if (AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, appInfo.getRouterServiceComponentName().getPackageName())) {
routerService = appInfo.getRouterServiceComponentName();
@@ -690,10 +710,27 @@ public abstract class SdlBroadcastReceiver extends BroadcastReceiver {
}
}
- private static boolean isPreAndroid12RSOnDevice(List<SdlAppInfo> sdlAppInfoList) {
+ /**
+ * This method will check for older versions of the SDL library on the device. Due to older
+ * libraries not checking for BLUETOOTH_CONNECT before beginning the process of starting the
+ * router service, they just start the newest router service. This flow is legacy and must be
+ * respected, however, if those apps do not have the BLUETOOTH_CONNECT permission themselves,
+ * those apps will never receive the intent that BT has connected and therefore the logic will
+ * never be used and we can continue to use the new process of start a router service.
+ *
+ * @param sdlAppInfoList list of SDL enabled apps on the device
+ * @param context an instance of a context to use to check permissions on the SDL apps
+ * @return if a pre v5.4 SDL enabled app is installed on the device and has the BLUETOOTH_CONNECT
+ * permission.
+ */
+ private static boolean isPreAndroid12RSOnDevice(List<SdlAppInfo> sdlAppInfoList, Context context) {
for (SdlAppInfo appInfo : sdlAppInfoList) {
//If an installed app RS version is older than Android 12 update version (16)
- if (appInfo.getRouterServiceVersion() < ANDROID_12_ROUTER_SERVICE_VERSION) {
+ //However, the app must have BLUETOOTH_CONNECT (Nearby Device) permissions,
+ //otherwise it doesn't matter
+ if (appInfo.getRouterServiceVersion() < ANDROID_12_ROUTER_SERVICE_VERSION
+ && AndroidTools.isPermissionGranted(BLUETOOTH_CONNECT, context, appInfo.getRouterServiceComponentName().getPackageName())) {
+ DebugTool.logInfo(TAG, "Found pre-Android 12 RS on device.");
return true;
}
}
diff --git a/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java b/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
index 7a2a6067e..6d0f67a71 100644
--- a/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
+++ b/javaSE/javaSE/src/main/java/com/smartdevicelink/BuildConfig.java
@@ -32,5 +32,5 @@ package com.smartdevicelink;
// THIS FILE IS AUTO GENERATED, DO NOT MODIFY!!
public final class BuildConfig {
- public static final String VERSION_NAME = "5.6.0";
+ public static final String VERSION_NAME = "5.6.1";
} \ No newline at end of file