Skip to content

Commit c5b8054

Browse files
authored
Merge pull request #1837 from smartdevicelink/release/5.6.0_RC
Release/5.6.0
2 parents c1afd4f + b18ae82 commit c5b8054

File tree

28 files changed

+541
-154
lines changed

28 files changed

+541
-154
lines changed

CHANGELOG.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
1-
# 5.5.0 Release Notes
1+
# 5.6.0 Release Notes
22

33
## Summary:
44
||Version|
55
|--|--|
66
| **Protocol** | 5.4.1
77
| **RPC** | 8.0.0
8-
| **Tested Targeting** | Android 31
8+
| **Tested Targeting** | Android 33
99

1010
## Bug Fixes:
1111

12-
- [ScreenManager tries to upload images even if they are not supported (SDL 2.0)](https://github.com/smartdevicelink/sdl_java_suite/issues/1738)
12+
- [Images not displaying correctly on Alerts sent via AlertManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1835)
1313

14-
- [Fix formatting of many tables within the documentation](https://github.com/smartdevicelink/sdl_java_suite/pull/1810)
14+
- [TemplateConfiguration not set in currentScreenData in TextAndGraphicManager on RPC >= 6 ](https://github.com/smartdevicelink/sdl_java_suite/issues/1833)
15+
16+
- [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)
17+
18+
- [ForegroundServiceStartNotAllowedException in SdlRouterStatusProvider](https://github.com/smartdevicelink/sdl_java_suite/issues/1829)
19+
20+
- [`DisplayCapabilities` `ScreenParams` null in SystemCapabilityManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1824)
21+
22+
- [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)
23+
24+
- [Android 13 issues](https://github.com/smartdevicelink/sdl_java_suite/issues/1812)
25+
26+
- [ForegroundServiceStartNotAllowedException in SdlRouterService ](https://github.com/smartdevicelink/sdl_java_suite/issues/1815)
27+
28+
- [SdlArtwork clone issue](https://github.com/smartdevicelink/sdl_java_suite/issues/1818)
1529

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.5.0
1+
5.6.0

android/hello_sdl_android/build.gradle

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

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
defaultConfig {
66
applicationId "com.sdl.hellosdlandroid"
77
minSdkVersion 16
8-
targetSdkVersion 31
8+
targetSdkVersion 33
99
versionCode 1
1010
versionName "1.0"
11+
buildConfigField 'String', 'APP_TYPE', '"DEFAULT"'
12+
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"FALSE"'
1113
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1214
}
1315
buildTypes {
@@ -42,6 +44,13 @@ android {
4244
buildConfigField 'String', 'TRANSPORT', '"TCP"'
4345
buildConfigField 'String', 'SECURITY', '"OFF"'
4446
}
47+
requiresAudioOutput {
48+
buildConfigField 'String', 'TRANSPORT', '"MULTI"'
49+
buildConfigField 'String', 'SECURITY', '"OFF"'
50+
buildConfigField 'String', 'APP_TYPE', '"MEDIA"'
51+
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"TRUE"'
52+
53+
}
4554
}
4655
lintOptions {
4756
disable 'GoogleAppIndexingWarning'

android/hello_sdl_android/src/main/AndroidManifest.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<uses-permission android:name="android.permission.BLUETOOTH" />
77
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"
88
tools:targetApi="31"/>
9+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"
10+
tools:targetApi="33"/>
911
<uses-permission android:name="android.permission.INTERNET" />
1012
<!-- Required to check if WiFi is enabled -->
1113
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

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

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

3+
import android.Manifest;
34
import android.content.Intent;
45
import android.content.pm.PackageManager;
56
import android.os.Build;
67
import android.os.Bundle;
78
import android.view.Menu;
89
import android.view.MenuItem;
9-
1010
import androidx.annotation.NonNull;
1111
import androidx.appcompat.app.AppCompatActivity;
1212
import androidx.core.app.ActivityCompat;
1313
import androidx.core.content.ContextCompat;
14-
15-
import static android.Manifest.permission.BLUETOOTH_CONNECT;
14+
import java.util.ArrayList;
1615

1716
public class MainActivity extends AppCompatActivity {
1817

@@ -23,12 +22,18 @@ protected void onCreate(Bundle savedInstanceState) {
2322
super.onCreate(savedInstanceState);
2423
setContentView(R.layout.activity_main);
2524

26-
2725
if (BuildConfig.TRANSPORT.equals("MULTI") || BuildConfig.TRANSPORT.equals("MULTI_HB")) {
28-
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !checkPermission()) {
29-
requestPermission();
30-
return;
26+
String[] permissionsNeeded = permissionsNeeded();
27+
if (permissionsNeeded.length > 0) {
28+
requestPermission(permissionsNeeded, REQUEST_CODE);
29+
for (String permission : permissionsNeeded) {
30+
if (Manifest.permission.BLUETOOTH_CONNECT.equals(permission)) {
31+
// We need to request BLUETOOTH_CONNECT permission to connect to SDL via Bluetooth
32+
return;
33+
}
34+
}
3135
}
36+
3237
//If we are connected to a module we want to start our SdlService
3338
SdlReceiver.queryForConnectedService(this);
3439
} else if (BuildConfig.TRANSPORT.equals("TCP")){
@@ -37,24 +42,61 @@ protected void onCreate(Bundle savedInstanceState) {
3742
}
3843
}
3944

40-
private boolean checkPermission() {
41-
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH_CONNECT);
45+
/**
46+
* Boolean method that checks API level and check to see if we need to request BLUETOOTH_CONNECT permission
47+
* @return false if we need to request BLUETOOTH_CONNECT permission
48+
*/
49+
private boolean hasBTPermission() {
50+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? checkPermission(Manifest.permission.BLUETOOTH_CONNECT) : true;
51+
}
52+
53+
/**
54+
* Boolean method that checks API level and check to see if we need to request POST_NOTIFICATIONS permission
55+
* @return false if we need to request POST_NOTIFICATIONS permission
56+
*/
57+
private boolean hasPNPermission() {
58+
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ? checkPermission(Manifest.permission.POST_NOTIFICATIONS) : true;
4259
}
4360

44-
private void requestPermission() {
45-
ActivityCompat.requestPermissions(this, new String[]{BLUETOOTH_CONNECT}, REQUEST_CODE);
61+
private boolean checkPermission(String permission) {
62+
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(getApplicationContext(), permission);
63+
}
64+
65+
private void requestPermission(String[] permissions, int REQUEST_CODE) {
66+
ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE);
67+
}
68+
69+
private @NonNull String[] permissionsNeeded() {
70+
ArrayList<String> result = new ArrayList<>();
71+
if (!hasBTPermission()) {
72+
result.add(Manifest.permission.BLUETOOTH_CONNECT);
73+
}
74+
if (!hasPNPermission()) {
75+
result.add(Manifest.permission.POST_NOTIFICATIONS);
76+
}
77+
return (result.toArray(new String[result.size()]));
4678
}
4779

4880
@Override
4981
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
5082
switch (requestCode) {
5183
case REQUEST_CODE:
5284
if (grantResults.length > 0) {
53-
54-
boolean btConnectGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
55-
56-
if (btConnectGranted) {
57-
SdlReceiver.queryForConnectedService(this);
85+
for (int i = 0; i < grantResults.length; i++) {
86+
if (permissions[i].equals(Manifest.permission.BLUETOOTH_CONNECT)) {
87+
boolean btConnectGranted =
88+
grantResults[i] == PackageManager.PERMISSION_GRANTED;
89+
if (btConnectGranted) {
90+
SdlReceiver.queryForConnectedService(this);
91+
}
92+
} else if (permissions[i].equals(Manifest.permission.POST_NOTIFICATIONS)) {
93+
boolean postNotificationGranted =
94+
grantResults[i] == PackageManager.PERMISSION_GRANTED;
95+
if (!postNotificationGranted) {
96+
// User denied permission, Notifications for SDL will not appear
97+
// on Android 13 devices.
98+
}
99+
}
58100
}
59101
}
60102
break;

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,9 @@ private void startProxy() {
162162
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
163163
}
164164
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
165+
if (BuildConfig.REQUIRE_AUDIO_OUTPUT.equals("TRUE") ) {
166+
((MultiplexTransportConfig)transport).setRequiresAudioSupport(true);
167+
}
165168
} else if (BuildConfig.TRANSPORT.equals("TCP")) {
166169
transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
167170
} else if (BuildConfig.TRANSPORT.equals("MULTI_HB")) {
@@ -172,7 +175,8 @@ private void startProxy() {
172175

173176
// The app type to be used
174177
Vector<AppHMIType> appType = new Vector<>();
175-
appType.add(AppHMIType.DEFAULT);
178+
appType.add(AppHMIType.valueForString(BuildConfig.APP_TYPE));
179+
176180

177181
// The manager listener helps you know when certain events that pertain to the SDL Manager happen
178182
// Here we will listen for ON_HMI_STATUS and ON_COMMAND notifications

android/sdl_android/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
apply plugin: 'com.android.library'
22

33
android {
4-
compileSdkVersion 31
4+
compileSdkVersion 33
55
defaultConfig {
66
minSdkVersion 16
7-
targetSdkVersion 31
8-
versionCode 23
7+
targetSdkVersion 33
8+
versionCode 24
99
versionName new File(projectDir.path, ('/../../VERSION')).text.trim()
1010
buildConfigField "String", "VERSION_NAME", '\"' + versionName + '\"'
1111
resValue "string", "SDL_LIB_VERSION", '\"' + versionName + '\"'

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/lifecycle/SystemCapabilityManagerTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ private DisplayCapabilities createDisplayCapabilities(String displayName, Window
176176
convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
177177
convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
178178
convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
179-
convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but can be empty
179+
convertedCapabilities.setMediaClockFormats(TestValues.GENERAL_MEDIACLOCKFORMAT_LIST); // mandatory field but can be empty
180180
convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC));
181+
convertedCapabilities.setScreenParams(TestValues.GENERAL_SCREENPARAMS);
181182

182183
return convertedCapabilities;
183184
}

android/sdl_android/src/androidTest/java/com/smartdevicelink/managers/screen/PresentAlertOperationTest.java

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import com.smartdevicelink.proxy.rpc.enums.FileType;
2828
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
2929
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
30+
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
3031
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
3132
import com.smartdevicelink.test.TestValues;
3233

@@ -42,7 +43,6 @@
4243

4344
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
4445
import static junit.framework.TestCase.assertEquals;
45-
import static junit.framework.TestCase.assertTrue;
4646
import static org.mockito.ArgumentMatchers.any;
4747
import static org.mockito.Mockito.doAnswer;
4848
import static org.mockito.Mockito.mock;
@@ -167,7 +167,7 @@ public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEve
167167
builder.setShowWaitIndicator(true);
168168
alertView = builder.build();
169169

170-
defaultMainWindowCapability = getWindowCapability(3);
170+
defaultMainWindowCapability = getWindowCapability(3, true);
171171
speechCapabilities = new ArrayList<SpeechCapabilities>();
172172
speechCapabilities.add(SpeechCapabilities.FILE);
173173
alertCompletionListener = new AlertCompletionListener() {
@@ -186,13 +186,13 @@ public void testPresentAlertTruncatedText() {
186186
// Same response works for uploading artworks as it does for files
187187

188188
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
189-
WindowCapability windowCapability = getWindowCapability(1);
189+
WindowCapability windowCapability = getWindowCapability(1, true);
190190
PresentAlertOperation presentAlertOperation = new PresentAlertOperation(internalInterface, alertView, windowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);
191191
Alert alert = presentAlertOperation.alertRpc();
192192

193193
assertEquals(alert.getAlertText1(), alertView.getText() + " - " + alertView.getSecondaryText() + " - " + alertView.getTertiaryText());
194194

195-
windowCapability = getWindowCapability(2);
195+
windowCapability = getWindowCapability(2, true);
196196

197197
presentAlertOperation = new PresentAlertOperation(internalInterface, alertView, windowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);
198198
alert = presentAlertOperation.alertRpc();
@@ -258,7 +258,23 @@ public void testPresentAlertNoImages() {
258258
verify(fileManager, times(1)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
259259
verify(internalInterface, times(1)).sendRPC(any(Alert.class));
260260
}
261+
@Test
262+
public void testPresentStaticIcon() {
263+
doAnswer(onAlertSuccess).when(internalInterface).sendRPC(any(Alert.class));
264+
// Same response works for uploading artworks as it does for files
265+
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
266+
when(fileManager.fileNeedsUpload(any(SdlFile.class))).thenReturn(false);
267+
268+
alertView.setIcon(new SdlArtwork(StaticIconName.LEFT));
269+
PresentAlertOperation presentAlertOperationStaticIcon = new PresentAlertOperation(internalInterface, alertView, defaultMainWindowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);
270+
271+
// Test Images need to be uploaded, sending text and uploading images
272+
presentAlertOperationStaticIcon.onExecute();
261273

274+
// Verifies that uploadArtworks gets called only with the fist presentAlertOperation.onExecute call
275+
verify(fileManager, times(0)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
276+
verify(internalInterface, times(1)).sendRPC(any(Alert.class));
277+
}
262278
@Test
263279
public void testCancelOperation() {
264280
//Cancel right away
@@ -267,7 +283,7 @@ public void testCancelOperation() {
267283
verify(internalInterface, times(0)).sendRPC(any(Alert.class));
268284
}
269285

270-
private WindowCapability getWindowCapability(int numberOfAlertFields) {
286+
private WindowCapability getWindowCapability(int numberOfAlertFields, boolean supportsAlertIcon) {
271287
TextField alertText1 = new TextField();
272288
alertText1.setName(TextFieldName.alertText1);
273289
TextField alertText2 = new TextField();
@@ -294,13 +310,13 @@ private WindowCapability getWindowCapability(int numberOfAlertFields) {
294310
WindowCapability windowCapability = new WindowCapability();
295311
windowCapability.setTextFields(returnList);
296312

297-
ImageField imageField = new ImageField();
298-
imageField.setName(ImageFieldName.alertIcon);
299-
List<ImageField> imageFieldList = new ArrayList<>();
300-
imageFieldList.add(imageField);
301-
windowCapability.setImageFields(imageFieldList);
302-
303-
windowCapability.setImageFields(imageFieldList);
313+
if (supportsAlertIcon) {
314+
ImageField imageField = new ImageField();
315+
imageField.setName(ImageFieldName.alertIcon);
316+
List<ImageField> imageFieldList = new ArrayList<>();
317+
imageFieldList.add(imageField);
318+
windowCapability.setImageFields(imageFieldList);
319+
}
304320

305321
SoftButtonCapabilities softButtonCapabilities = new SoftButtonCapabilities();
306322
softButtonCapabilities.setImageSupported(TestValues.GENERAL_BOOLEAN);

0 commit comments

Comments
 (0)