Skip to content

Commit

Permalink
Merge pull request #1837 from smartdevicelink/release/5.6.0_RC
Browse files Browse the repository at this point in the history
Release/5.6.0
  • Loading branch information
joeygrover authored Oct 26, 2022
2 parents c1afd4f + b18ae82 commit c5b8054
Show file tree
Hide file tree
Showing 28 changed files with 541 additions and 154 deletions.
22 changes: 18 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
# 5.5.0 Release Notes
# 5.6.0 Release Notes

## Summary:
||Version|
|--|--|
| **Protocol** | 5.4.1
| **RPC** | 8.0.0
| **Tested Targeting** | Android 31
| **Tested Targeting** | Android 33

## Bug Fixes:

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

- [Fix formatting of many tables within the documentation](https://github.com/smartdevicelink/sdl_java_suite/pull/1810)
- [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)

2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.5.0
5.6.0
13 changes: 11 additions & 2 deletions android/hello_sdl_android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 31
compileSdkVersion 33
defaultConfig {
applicationId "com.sdl.hellosdlandroid"
minSdkVersion 16
targetSdkVersion 31
targetSdkVersion 33
versionCode 1
versionName "1.0"
buildConfigField 'String', 'APP_TYPE', '"DEFAULT"'
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"FALSE"'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand Down Expand Up @@ -42,6 +44,13 @@ android {
buildConfigField 'String', 'TRANSPORT', '"TCP"'
buildConfigField 'String', 'SECURITY', '"OFF"'
}
requiresAudioOutput {
buildConfigField 'String', 'TRANSPORT', '"MULTI"'
buildConfigField 'String', 'SECURITY', '"OFF"'
buildConfigField 'String', 'APP_TYPE', '"MEDIA"'
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"TRUE"'

}
}
lintOptions {
disable 'GoogleAppIndexingWarning'
Expand Down
2 changes: 2 additions & 0 deletions android/hello_sdl_android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"
tools:targetApi="31"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"
tools:targetApi="33"/>
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to check if WiFi is enabled -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package com.sdl.hellosdlandroid;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;

import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat;

import static android.Manifest.permission.BLUETOOTH_CONNECT;
import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

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


if (BuildConfig.TRANSPORT.equals("MULTI") || BuildConfig.TRANSPORT.equals("MULTI_HB")) {
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S && !checkPermission()) {
requestPermission();
return;
String[] permissionsNeeded = permissionsNeeded();
if (permissionsNeeded.length > 0) {
requestPermission(permissionsNeeded, REQUEST_CODE);
for (String permission : permissionsNeeded) {
if (Manifest.permission.BLUETOOTH_CONNECT.equals(permission)) {
// We need to request BLUETOOTH_CONNECT permission to connect to SDL via Bluetooth
return;
}
}
}

//If we are connected to a module we want to start our SdlService
SdlReceiver.queryForConnectedService(this);
} else if (BuildConfig.TRANSPORT.equals("TCP")){
Expand All @@ -37,24 +42,61 @@ protected void onCreate(Bundle savedInstanceState) {
}
}

private boolean checkPermission() {
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH_CONNECT);
/**
* Boolean method that checks API level and check to see if we need to request BLUETOOTH_CONNECT permission
* @return false if we need to request BLUETOOTH_CONNECT permission
*/
private boolean hasBTPermission() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S ? checkPermission(Manifest.permission.BLUETOOTH_CONNECT) : true;
}

/**
* Boolean method that checks API level and check to see if we need to request POST_NOTIFICATIONS permission
* @return false if we need to request POST_NOTIFICATIONS permission
*/
private boolean hasPNPermission() {
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU ? checkPermission(Manifest.permission.POST_NOTIFICATIONS) : true;
}

private void requestPermission() {
ActivityCompat.requestPermissions(this, new String[]{BLUETOOTH_CONNECT}, REQUEST_CODE);
private boolean checkPermission(String permission) {
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(getApplicationContext(), permission);
}

private void requestPermission(String[] permissions, int REQUEST_CODE) {
ActivityCompat.requestPermissions(this, permissions, REQUEST_CODE);
}

private @NonNull String[] permissionsNeeded() {
ArrayList<String> result = new ArrayList<>();
if (!hasBTPermission()) {
result.add(Manifest.permission.BLUETOOTH_CONNECT);
}
if (!hasPNPermission()) {
result.add(Manifest.permission.POST_NOTIFICATIONS);
}
return (result.toArray(new String[result.size()]));
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case REQUEST_CODE:
if (grantResults.length > 0) {

boolean btConnectGranted = grantResults[0] == PackageManager.PERMISSION_GRANTED;

if (btConnectGranted) {
SdlReceiver.queryForConnectedService(this);
for (int i = 0; i < grantResults.length; i++) {
if (permissions[i].equals(Manifest.permission.BLUETOOTH_CONNECT)) {
boolean btConnectGranted =
grantResults[i] == PackageManager.PERMISSION_GRANTED;
if (btConnectGranted) {
SdlReceiver.queryForConnectedService(this);
}
} else if (permissions[i].equals(Manifest.permission.POST_NOTIFICATIONS)) {
boolean postNotificationGranted =
grantResults[i] == PackageManager.PERMISSION_GRANTED;
if (!postNotificationGranted) {
// User denied permission, Notifications for SDL will not appear
// on Android 13 devices.
}
}
}
}
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ private void startProxy() {
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
}
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
if (BuildConfig.REQUIRE_AUDIO_OUTPUT.equals("TRUE") ) {
((MultiplexTransportConfig)transport).setRequiresAudioSupport(true);
}
} else if (BuildConfig.TRANSPORT.equals("TCP")) {
transport = new TCPTransportConfig(TCP_PORT, DEV_MACHINE_IP_ADDRESS, true);
} else if (BuildConfig.TRANSPORT.equals("MULTI_HB")) {
Expand All @@ -172,7 +175,8 @@ private void startProxy() {

// The app type to be used
Vector<AppHMIType> appType = new Vector<>();
appType.add(AppHMIType.DEFAULT);
appType.add(AppHMIType.valueForString(BuildConfig.APP_TYPE));


// The manager listener helps you know when certain events that pertain to the SDL Manager happen
// Here we will listen for ON_HMI_STATUS and ON_COMMAND notifications
Expand Down
6 changes: 3 additions & 3 deletions android/sdl_android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 31
compileSdkVersion 33
defaultConfig {
minSdkVersion 16
targetSdkVersion 31
versionCode 23
targetSdkVersion 33
versionCode 24
versionName new File(projectDir.path, ('/../../VERSION')).text.trim()
buildConfigField "String", "VERSION_NAME", '\"' + versionName + '\"'
resValue "string", "SDL_LIB_VERSION", '\"' + versionName + '\"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,9 @@ private DisplayCapabilities createDisplayCapabilities(String displayName, Window
convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
convertedCapabilities.setMediaClockFormats(new ArrayList<MediaClockFormat>()); // mandatory field but can be empty
convertedCapabilities.setMediaClockFormats(TestValues.GENERAL_MEDIACLOCKFORMAT_LIST); // mandatory field but can be empty
convertedCapabilities.setGraphicSupported(defaultMainWindow.getImageTypeSupported().contains(ImageType.DYNAMIC));
convertedCapabilities.setScreenParams(TestValues.GENERAL_SCREENPARAMS);

return convertedCapabilities;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import com.smartdevicelink.proxy.rpc.enums.FileType;
import com.smartdevicelink.proxy.rpc.enums.ImageFieldName;
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
import com.smartdevicelink.proxy.rpc.enums.StaticIconName;
import com.smartdevicelink.proxy.rpc.enums.TextFieldName;
import com.smartdevicelink.test.TestValues;

Expand All @@ -42,7 +43,6 @@

import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
import static junit.framework.TestCase.assertEquals;
import static junit.framework.TestCase.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
Expand Down Expand Up @@ -167,7 +167,7 @@ public void onEvent(SoftButtonObject softButtonObject, OnButtonEvent onButtonEve
builder.setShowWaitIndicator(true);
alertView = builder.build();

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

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

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

windowCapability = getWindowCapability(2);
windowCapability = getWindowCapability(2, true);

presentAlertOperation = new PresentAlertOperation(internalInterface, alertView, windowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);
alert = presentAlertOperation.alertRpc();
Expand Down Expand Up @@ -258,7 +258,23 @@ public void testPresentAlertNoImages() {
verify(fileManager, times(1)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
verify(internalInterface, times(1)).sendRPC(any(Alert.class));
}
@Test
public void testPresentStaticIcon() {
doAnswer(onAlertSuccess).when(internalInterface).sendRPC(any(Alert.class));
// Same response works for uploading artworks as it does for files
when(internalInterface.getSdlMsgVersion()).thenReturn(new SdlMsgVersion(6, 0));
when(fileManager.fileNeedsUpload(any(SdlFile.class))).thenReturn(false);

alertView.setIcon(new SdlArtwork(StaticIconName.LEFT));
PresentAlertOperation presentAlertOperationStaticIcon = new PresentAlertOperation(internalInterface, alertView, defaultMainWindowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);

// Test Images need to be uploaded, sending text and uploading images
presentAlertOperationStaticIcon.onExecute();

// Verifies that uploadArtworks gets called only with the fist presentAlertOperation.onExecute call
verify(fileManager, times(0)).uploadArtworks(any(List.class), any(MultipleFileCompletionListener.class));
verify(internalInterface, times(1)).sendRPC(any(Alert.class));
}
@Test
public void testCancelOperation() {
//Cancel right away
Expand All @@ -267,7 +283,7 @@ public void testCancelOperation() {
verify(internalInterface, times(0)).sendRPC(any(Alert.class));
}

private WindowCapability getWindowCapability(int numberOfAlertFields) {
private WindowCapability getWindowCapability(int numberOfAlertFields, boolean supportsAlertIcon) {
TextField alertText1 = new TextField();
alertText1.setName(TextFieldName.alertText1);
TextField alertText2 = new TextField();
Expand All @@ -294,13 +310,13 @@ private WindowCapability getWindowCapability(int numberOfAlertFields) {
WindowCapability windowCapability = new WindowCapability();
windowCapability.setTextFields(returnList);

ImageField imageField = new ImageField();
imageField.setName(ImageFieldName.alertIcon);
List<ImageField> imageFieldList = new ArrayList<>();
imageFieldList.add(imageField);
windowCapability.setImageFields(imageFieldList);

windowCapability.setImageFields(imageFieldList);
if (supportsAlertIcon) {
ImageField imageField = new ImageField();
imageField.setName(ImageFieldName.alertIcon);
List<ImageField> imageFieldList = new ArrayList<>();
imageFieldList.add(imageField);
windowCapability.setImageFields(imageFieldList);
}

SoftButtonCapabilities softButtonCapabilities = new SoftButtonCapabilities();
softButtonCapabilities.setImageSupported(TestValues.GENERAL_BOOLEAN);
Expand Down
Loading

0 comments on commit c5b8054

Please sign in to comment.