Skip to content

Commit cc45527

Browse files
authored
Merge pull request #1880 from smartdevicelink/release/5.7.0_RC
Release 5.7.0
2 parents a924127 + 01604dc commit cc45527

38 files changed

+778
-127
lines changed

.github/workflows/android.yml

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: GitHub CI
33
on: [push, pull_request, workflow_dispatch]
44

55
jobs:
6-
test:
6+
test_Android:
77
runs-on: macOS-latest
88
steps:
99

@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup JDK
1616
uses: actions/setup-java@v1
1717
with:
18-
java-version: 1.8
18+
java-version: 11
1919

2020
- name: Sdl Android Tests
2121
# For more info, please check out: https://github.com/marketplace/actions/android-emulator-runner
@@ -26,6 +26,25 @@ jobs:
2626

2727
- name: Hello Sdl Android Tests
2828
run: ./android/gradlew -p ./android/hello_sdl_android test
29+
30+
- name: Codecov
31+
uses: codecov/codecov-action@v1.0.13
32+
with:
33+
yml: ./codecov.yml
34+
35+
test_Java:
36+
runs-on: macOS-latest
37+
steps:
38+
39+
- name: Checkout
40+
uses: actions/checkout@v2
41+
with:
42+
submodules: true
43+
44+
- name: Setup JDK
45+
uses: actions/setup-java@v1
46+
with:
47+
java-version: 1.8
2948

3049
- name: Sdl JavaSE Tests
3150
run: ./javaSE/gradlew -p ./javaSE/javaSE test
@@ -36,7 +55,3 @@ jobs:
3655
- name: Sdl JavaEE Tests
3756
run: ./javaEE/gradlew -p ./javaEE/javaEE test
3857

39-
- name: Codecov
40-
uses: codecov/codecov-action@v1.0.13
41-
with:
42-
yml: ./codecov.yml

CHANGELOG.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,49 @@
1-
# 5.6.1 Release Notes
1+
# 5.7.0 Release Notes
22

33
## Summary:
44

55
|| Version|
66
|---|---|
77
| **Protocol** | 5.4.1 |
88
| **RPC** | 8.0.0 |
9-
| **Tested Targeting** | Android 33 |
9+
| **Tested Targeting** | Android 34 |
1010

1111
## Bug Fix / Enhancements:
1212

13-
- [Nearby Devices permission on Android 12 and Above #1839](https://github.com/smartdevicelink/sdl_java_suite/issues/1839)
13+
- [Add pending intent to ping intents] (https://github.com/smartdevicelink/sdl_java_suite/pull/1844
14+
15+
- [Fixes #1845 typo in SdlBroadcastReceiver for uncaughtException handler](https://github.com/smartdevicelink/sdl_java_suite/pull/1846
16+
17+
- [Bugfix/issue #1842 - NPE in BaseTextAndGraphicsManager](https://github.com/smartdevicelink/sdl_java_suite/pull/1847
18+
19+
- [Fix case for UncaughtExceptionHandler in SdlBroadcastReceiver for RemoteServiceException](https://github.com/smartdevicelink/sdl_java_suite/pull/1849
20+
21+
- [Update gradle to 7.4.2](https://github.com/smartdevicelink/sdl_java_suite/pull/1853
22+
23+
- [Fix NPE in SdlRouterService](https://github.com/smartdevicelink/sdl_java_suite/pull/1870
24+
25+
- [Bugfix/issue 1867 Bluetooth notification error fix](https://github.com/smartdevicelink/sdl_java_suite/pull/1868
26+
27+
- [Clean LifecycleManager before closing](https://github.com/smartdevicelink/sdl_java_suite/pull/1866
28+
29+
- [Move router service message sending to its own thread](https://github.com/smartdevicelink/sdl_java_suite/pull/1871
30+
31+
- [Bugfix/issue 1863 update gradle build variants for hello_sdl](https://github.com/smartdevicelink/sdl_java_suite/pull/1864
32+
33+
- [Android 14 add package to PendingIntents in RouterService](https://github.com/smartdevicelink/sdl_java_suite/pull/1862
34+
35+
- [Android 14 Runtime registered broadcast receivers export behavior](https://github.com/smartdevicelink/sdl_java_suite/pull/1858
36+
37+
- [Add logic to handle RAI response failure](https://github.com/smartdevicelink/sdl_java_suite/pull/1873
38+
39+
- [Android 14 foreground service type required](https://github.com/smartdevicelink/sdl_java_suite/pull/1860
40+
41+
- [Update integration validator with latest permissions and checks for exported](https://github.com/smartdevicelink/sdl_java_suite/pull/1875
42+
43+
- [Fix SDLLockScreenActivityEspressoTest for newer devices](https://github.com/smartdevicelink/sdl_java_suite/pull/1877
44+
45+
- [Remove only app logic for device listener start](https://github.com/smartdevicelink/sdl_java_suite/pull/1879)
46+
47+
- [Fix NPE in TransportBroker](https://github.com/smartdevicelink/sdl_java_suite/pull/1882)
48+
49+
**Full Changelog**: https://github.com/smartdevicelink/sdl_java_suite/compare/5.6.1...RC_5.7.0

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.6.1
1+
5.7.0

android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ buildscript {
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:4.1.1'
10+
classpath 'com.android.tools.build:gradle:7.4.2'
1111

1212

1313
// NOTE: Do not place your application dependencies here; they belong

android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip

android/hello_sdl_android/build.gradle

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
apply plugin: 'com.android.application'
22

33
android {
4-
compileSdkVersion 33
4+
compileSdkVersion 34
55
defaultConfig {
66
applicationId "com.sdl.hellosdlandroid"
77
minSdkVersion 16
8-
targetSdkVersion 33
8+
targetSdkVersion 34
99
versionCode 1
1010
versionName "1.0"
11+
resValue "string", "app_name", "Hello Sdl Android"
1112
buildConfigField 'String', 'APP_TYPE', '"DEFAULT"'
1213
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"FALSE"'
14+
buildConfigField 'String', 'SDL_APP_NAME', '"Hello Sdl"'
15+
buildConfigField 'String', 'SDL_APP_ID', '"8678309"'
16+
manifestPlaceholders = [
17+
appIcon: "@mipmap/ic_launcher"
18+
]
1319
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1420
}
1521
buildTypes {

android/hello_sdl_android/src/main/AndroidManifest.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
tools:targetApi="31"/>
99
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"
1010
tools:targetApi="33"/>
11+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"
12+
tools:targetApi="34"/>
1113
<uses-permission android:name="android.permission.INTERNET" />
1214
<!-- Required to check if WiFi is enabled -->
1315
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -28,7 +30,7 @@
2830

2931
<application
3032
android:allowBackup="false"
31-
android:icon="@mipmap/ic_launcher"
33+
android:icon="${appIcon}"
3234
android:label="@string/app_name"
3335
android:theme="@style/AppTheme"
3436
tools:ignore="DeepLinks">

android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlReceiver.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
package com.sdl.hellosdlandroid;
22

33
import android.app.PendingIntent;
4+
import android.content.BroadcastReceiver;
45
import android.content.Context;
56
import android.content.Intent;
7+
import android.content.IntentFilter;
8+
import android.hardware.usb.UsbAccessory;
9+
import android.hardware.usb.UsbManager;
610
import android.os.Build;
711

812
import com.smartdevicelink.transport.SdlBroadcastReceiver;
913
import com.smartdevicelink.transport.SdlRouterService;
1014
import com.smartdevicelink.transport.TransportConstants;
15+
import com.smartdevicelink.util.AndroidTools;
1116
import com.smartdevicelink.util.DebugTool;
1217

1318
public class SdlReceiver extends SdlBroadcastReceiver {
1419
private static final String TAG = "SdlBroadcastReceiver";
1520

21+
private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
22+
private PendingIntent pendingIntentToStartService;
23+
private Intent startSdlServiceIntent;
24+
1625
@Override
1726
public void onSdlEnabled(Context context, Intent intent) {
1827
DebugTool.logInfo(TAG, "SDL Enabled");
@@ -24,6 +33,15 @@ public void onSdlEnabled(Context context, Intent intent) {
2433
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
2534
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra(TransportConstants.PENDING_INTENT_EXTRA);
2635
if (pendingIntent != null) {
36+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
37+
if (!AndroidTools.hasForegroundServiceTypePermission(context)) {
38+
requestUsbAccessory(context);
39+
startSdlServiceIntent = intent;
40+
this.pendingIntentToStartService = pendingIntent;
41+
DebugTool.logInfo(TAG, "Permission missing for ForegroundServiceType connected device." + context);
42+
return;
43+
}
44+
}
2745
try {
2846
pendingIntent.send(context, 0, intent);
2947
} catch (PendingIntent.CanceledException e) {
@@ -56,4 +74,47 @@ public void onReceive(Context context, Intent intent) {
5674
public String getSdlServiceName() {
5775
return SdlService.class.getSimpleName();
5876
}
77+
78+
private final BroadcastReceiver usbPermissionReceiver = new BroadcastReceiver() {
79+
public void onReceive(Context context, Intent intent) {
80+
String action = intent.getAction();
81+
if (ACTION_USB_PERMISSION.equals(action) && context != null && startSdlServiceIntent != null && pendingIntentToStartService != null) {
82+
if (AndroidTools.hasForegroundServiceTypePermission(context)) {
83+
try {
84+
pendingIntentToStartService.send(context, 0, startSdlServiceIntent);
85+
context.unregisterReceiver(this);
86+
} catch (Exception e) {
87+
e.printStackTrace();
88+
}
89+
}
90+
}
91+
}
92+
};
93+
94+
/**
95+
* Request permission from USB Accessory if USB accessory is not null.
96+
* If the user has not granted the BLUETOOTH_CONNECT permission,
97+
* we can request the USB Accessory permission to satisfy the requirements for
98+
* FOREGROUND_SERVICE_CONNECTED_DEVICE and can start our service and allow
99+
* it to enter the foreground. FOREGROUND_SERVICE_CONNECTED_DEVICE is a requirement
100+
* in Android 14
101+
*/
102+
private void requestUsbAccessory(Context context) {
103+
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
104+
UsbAccessory[] accessoryList = manager.getAccessoryList();
105+
if (accessoryList == null || accessoryList.length == 0) {
106+
startSdlServiceIntent = null;
107+
pendingIntentToStartService = null;
108+
return;
109+
}
110+
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
111+
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
112+
113+
AndroidTools.registerReceiver(context, usbPermissionReceiver, filter,
114+
Context.RECEIVER_EXPORTED);
115+
116+
for (final UsbAccessory usbAccessory : accessoryList) {
117+
manager.requestPermission(usbAccessory, mPermissionIntent);
118+
}
119+
}
59120
}

android/hello_sdl_android/src/main/java/com/sdl/hellosdlandroid/SdlService.java

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ public class SdlService extends Service {
6060

6161
private static final String TAG = "SDL Service";
6262

63-
private static final String APP_NAME = "Hello Sdl";
6463
private static final String APP_NAME_ES = "Hola Sdl";
6564
private static final String APP_NAME_FR = "Bonjour Sdl";
66-
private static final String APP_ID = "8678309";
6765

6866
private static final String ICON_FILENAME = "hello_sdl_icon.png";
6967
private static final String SDL_IMAGE_FILENAME = "sdl_full_image.png";
@@ -104,18 +102,25 @@ public void onCreate() {
104102
@SuppressLint("NewApi")
105103
public void enterForeground() {
106104
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
107-
NotificationChannel channel = new NotificationChannel(APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
108-
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
109-
if (notificationManager != null) {
110-
notificationManager.createNotificationChannel(channel);
111-
Notification.Builder builder = new Notification.Builder(this, channel.getId())
112-
.setContentTitle("Connected through SDL")
113-
.setSmallIcon(R.drawable.ic_sdl);
114-
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
115-
builder.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE);
105+
try {
106+
NotificationChannel channel = new NotificationChannel(BuildConfig.SDL_APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
107+
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
108+
if (notificationManager != null) {
109+
notificationManager.createNotificationChannel(channel);
110+
Notification.Builder builder = new Notification.Builder(this, channel.getId())
111+
.setContentTitle("Connected through SDL")
112+
.setSmallIcon(R.drawable.ic_sdl);
113+
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
114+
builder.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE);
115+
}
116+
Notification serviceNotification = builder.build();
117+
startForeground(FOREGROUND_SERVICE_ID, serviceNotification);
116118
}
117-
Notification serviceNotification = builder.build();
118-
startForeground(FOREGROUND_SERVICE_ID, serviceNotification);
119+
} catch (Exception e) {
120+
// This should only catch for TCP connections on Android 14+ due to needing
121+
// permissions for ForegroundServiceType ConnectedDevice that don't make sense for
122+
// a TCP connection
123+
DebugTool.logError(TAG, "Unable to start service in foreground", e);
119124
}
120125
}
121126
}
@@ -161,14 +166,14 @@ private void startProxy() {
161166
} else {
162167
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
163168
}
164-
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
169+
transport = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, securityLevel);
165170
if (BuildConfig.REQUIRE_AUDIO_OUTPUT.equals("TRUE") ) {
166171
((MultiplexTransportConfig)transport).setRequiresAudioSupport(true);
167172
}
168173
} else if (BuildConfig.TRANSPORT.equals("TCP")) {
169174
transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
170175
} else if (BuildConfig.TRANSPORT.equals("MULTI_HB")) {
171-
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
176+
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
172177
mtc.setRequiresHighBandwidth(true);
173178
transport = mtc;
174179
}
@@ -215,8 +220,8 @@ public void onError(String info, Exception e) {
215220
@Override
216221
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
217222
boolean isNeedUpdate = false;
218-
String appName = APP_NAME;
219-
String ttsName = APP_NAME;
223+
String appName = BuildConfig.SDL_APP_NAME;
224+
String ttsName = BuildConfig.SDL_APP_NAME;
220225
switch (language) {
221226
case ES_MX:
222227
isNeedUpdate = true;
@@ -260,7 +265,7 @@ public boolean onSystemInfoReceived(SystemInfo systemInfo) {
260265
SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);
261266

262267
// The manager builder sets options for your session
263-
SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
268+
SdlManager.Builder builder = new SdlManager.Builder(this, BuildConfig.SDL_APP_ID, BuildConfig.SDL_APP_NAME, listener);
264269
builder.setAppTypes(appType);
265270
builder.setTransportType(transport);
266271
builder.setAppIcon(appIcon);
@@ -375,7 +380,7 @@ private void performWelcomeSpeak() {
375380
*/
376381
private void performWelcomeShow() {
377382
sdlManager.getScreenManager().beginTransaction();
378-
sdlManager.getScreenManager().setTextField1(APP_NAME);
383+
sdlManager.getScreenManager().setTextField1(BuildConfig.SDL_APP_NAME);
379384
sdlManager.getScreenManager().setTextField2(WELCOME_SHOW);
380385
sdlManager.getScreenManager().setPrimaryGraphic(new SdlArtwork(SDL_IMAGE_FILENAME, FileType.GRAPHIC_PNG, R.drawable.sdl, true));
381386
sdlManager.getScreenManager().commit(new CompletionListener() {

android/hello_sdl_android/src/main/res/values/strings.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33

4-
<string name="app_name">Hello Sdl Android</string>
54
<string name="hello_world">Hello SDL!</string>
65
<string name="action_settings">Settings</string>
76

0 commit comments

Comments
 (0)