Skip to content

Commit

Permalink
Merge pull request #1795 from smartdevicelink/5.4.0_RC
Browse files Browse the repository at this point in the history
Release 5.4.0
  • Loading branch information
joeygrover authored Apr 13, 2022
2 parents db5c943 + a174b5d commit 16b2ab6
Show file tree
Hide file tree
Showing 92 changed files with 1,464 additions and 588 deletions.
51 changes: 47 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,57 @@
# 5.3.1 Release Notes
# 5.4.0 Release Notes

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

## Bug Fixes / Enhancements:

- [userDidSubmitInput getting called multiple times after a search request is submitted](https://github.com/smartdevicelink/sdl_java_suite/issues/1768)
- [Video auto restarts streaming regardless if HMI level is streamable ](https://github.com/smartdevicelink/sdl_java_suite/issues/1807)

- [Video Streaming Fails on Android 12 at Low Resolutions](https://github.com/smartdevicelink/sdl_java_suite/issues/1803)

- [sdl_java_se uses deprecated testCompile in build.gradle](https://github.com/smartdevicelink/sdl_java_suite/issues/1805)

- [Incorrect behavior and potential crashes in PresentAlertOperation.supportsSoftButtonImages()](https://github.com/smartdevicelink/sdl_java_suite/issues/1800)

- [Bugfix/rs notification issue usb](https://github.com/smartdevicelink/sdl_java_suite/pull/1797)

- [Attempting to Send Voice Command with No Strings Fails to Log Error](https://github.com/smartdevicelink/sdl_java_suite/issues/1798)

- [Fix LCM to close down properly](https://github.com/smartdevicelink/sdl_java_suite/pull/1796)

- [Cleanup/proposal sdl 0286 spacing](https://github.com/smartdevicelink/sdl_java_suite/pull/1782)

- [API Reference Docs Typos](https://github.com/smartdevicelink/sdl_java_suite/issues/1792)

- [Foreground Service Notifications can be delayed by 10 seconds](https://github.com/smartdevicelink/sdl_java_suite/issues/1733)

- [Bluetooth Permission Requirements will change in Android 12](https://github.com/smartdevicelink/sdl_java_suite/issues/1732)

- [[SDL 0345] Android 12 Issues](https://github.com/smartdevicelink/sdl_java_suite/issues/1794)

- [SdlRouterService crashes if SDL app sets targetSdkVersion to 31, and running on Android 12](https://github.com/smartdevicelink/sdl_java_suite/issues/1751)

- [Error Code is cut off from bulk data when reading a SEND_INTERNAL_ERROR query](https://github.com/smartdevicelink/sdl_java_suite/issues/1790)

- [NPE crash in BaseLifecycleManager on checkLifecycleConfiguration](https://github.com/smartdevicelink/sdl_java_suite/issues/1783)

- [NPE crash in SdlDeviceListener](https://github.com/smartdevicelink/sdl_java_suite/issues/1780)

- [NPE crash in BaseLifecycleManager](https://github.com/smartdevicelink/sdl_java_suite/issues/1781)

- [SoftButtonObject doesn't handle error states correctly](https://github.com/smartdevicelink/sdl_java_suite/issues/1774)

- [ScrollableMessage.timeout units should be specified in documentation](https://github.com/smartdevicelink/sdl_java_suite/issues/1775)

- [Incorrect SPP error notification presented to user](https://github.com/smartdevicelink/sdl_java_suite/issues/1661)

- [SecurityQuery error notification payload not set](https://github.com/smartdevicelink/sdl_java_suite/issues/1753)

- [Menu Manager won't send submenu cell images on RPC versions >= 5.0 && < 7.0 #2047](https://github.com/smartdevicelink/sdl_java_suite/issues/1756)

- [GenerateSources gradle task in javaSE incorrectly reads the version from gradle.properties instead of VERSION file](https://github.com/smartdevicelink/sdl_java_suite/issues/1763)

- [NPE in SoftButtonReplaceOperation](https://github.com/smartdevicelink/sdl_java_suite/issues/1767)
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.1
5.4.0
4 changes: 2 additions & 2 deletions android/hello_sdl_android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "com.sdl.hellosdlandroid"
minSdkVersion 16
targetSdkVersion 30
targetSdkVersion 31
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down
5 changes: 5 additions & 0 deletions android/hello_sdl_android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package="com.sdl.hellosdlandroid">

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"
tools:targetApi="31"/>
<uses-permission android:name="android.permission.INTERNET" />
<!-- Required to check if WiFi is enabled -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -30,6 +32,7 @@
tools:ignore="DeepLinks">
<activity
android:name=".MainActivity"
android:exported="true"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand All @@ -40,6 +43,7 @@

<activity
android:name="com.smartdevicelink.transport.USBAccessoryAttachmentActivity"
android:exported="true"
android:launchMode="singleTop">
<intent-filter>
<action android:name="android.hardware.usb.action.USB_ACCESSORY_ATTACHED" />
Expand All @@ -52,6 +56,7 @@

<service
android:name="com.sdl.hellosdlandroid.SdlService"
android:exported="true"
android:foregroundServiceType="connectedDevice">
</service>
<service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,66 @@
package com.sdl.hellosdlandroid;

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;

public class MainActivity extends AppCompatActivity {

private static final int REQUEST_CODE = 200;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//If we are connected to a module we want to start our SdlService


if (BuildConfig.TRANSPORT.equals("MULTI") || BuildConfig.TRANSPORT.equals("MULTI_HB")) {
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")) {
} else if (BuildConfig.TRANSPORT.equals("TCP")){
Intent proxyIntent = new Intent(this, SdlService.class);
startService(proxyIntent);
}
}

private boolean checkPermission() {
return PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH_CONNECT);
}

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

@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);
}
}
break;
}
}

@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.sdl.hellosdlandroid;

import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.os.Build;

import com.smartdevicelink.transport.SdlBroadcastReceiver;
import com.smartdevicelink.transport.SdlRouterService;
import com.smartdevicelink.transport.TransportConstants;
import com.smartdevicelink.util.DebugTool;

public class SdlReceiver extends SdlBroadcastReceiver {
Expand All @@ -16,13 +18,27 @@ public void onSdlEnabled(Context context, Intent intent) {
DebugTool.logInfo(TAG, "SDL Enabled");
intent.setClass(context, SdlService.class);

// SdlService needs to be foregrounded in Android O and above
// This will prevent apps in the background from crashing when they try to start SdlService
// Because Android O doesn't allow background apps to start background services
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(intent);
// Starting with Android S SdlService needs to be started from a foreground context.
// We will check the intent for a pendingIntent parcelable extra
// This pendingIntent allows us to start the SdlService from the context of the active router service which is in the foreground
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra(TransportConstants.PENDING_INTENT_EXTRA);
if (pendingIntent != null) {
try {
pendingIntent.send(context, 0, intent);
} catch (PendingIntent.CanceledException e) {
e.printStackTrace();
}
}
} else {
context.startService(intent);
// SdlService needs to be foregrounded in Android O and above
// This will prevent apps in the background from crashing when they try to start SdlService
// Because Android O doesn't allow background apps to start background services
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
context.startForegroundService(intent);
} else {
context.startService(intent);
}
}
}

Expand All @@ -35,4 +51,9 @@ public Class<? extends SdlRouterService> defineLocalSdlRouterClass() {
public void onReceive(Context context, Intent intent) {
super.onReceive(context, intent); // Required if overriding this method
}

@Override
public String getSdlServiceName() {
return SdlService.class.getSimpleName();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ public void enterForeground() {
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
Notification serviceNotification = new Notification.Builder(this, channel.getId())
Notification.Builder builder = new Notification.Builder(this, channel.getId())
.setContentTitle("Connected through SDL")
.setSmallIcon(R.drawable.ic_sdl)
.build();
.setSmallIcon(R.drawable.ic_sdl);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
builder.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE);
}
Notification serviceNotification = builder.build();
startForeground(FOREGROUND_SERVICE_ID, serviceNotification);
}
}
Expand Down
8 changes: 5 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 30
compileSdkVersion 31
defaultConfig {
minSdkVersion 16
targetSdkVersion 30
versionCode 21
targetSdkVersion 31
versionCode 22
versionName new File(projectDir.path, ('/../../VERSION')).text.trim()
buildConfigField "String", "VERSION_NAME", '\"' + versionName + '\"'
resValue "string", "SDL_LIB_VERSION", '\"' + versionName + '\"'
Expand Down Expand Up @@ -40,6 +40,8 @@ android {
}
}

ext { VERSION_NAME = "$project.android.defaultConfig.versionName" }

dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
//api 'com.livio.taskmaster:taskmaster:0.6.0'
Expand Down
1 change: 0 additions & 1 deletion android/sdl_android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
GROUP=com.smartdevicelink
POM_ARTIFACT_ID=sdl_android
VERSION_NAME=5.3.1

POM_NAME=sdl_android
POM_PACKAGING=aar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ public void setUp() throws Exception {
public Void answer(InvocationOnMock invocation) {
Object[] args = invocation.getArguments();
OnPermissionChangeListener onPermissionChangeListener = (OnPermissionChangeListener) args[2];
Map<FunctionID, PermissionStatus > allowedPermissions = new HashMap<>();
Map<FunctionID, PermissionStatus> allowedPermissions = new HashMap<>();
int permissionGroupStatus = PermissionManager.PERMISSION_GROUP_STATUS_DISALLOWED;
onPermissionChangeListener.onPermissionsChange(allowedPermissions,permissionGroupStatus);
onPermissionChangeListener.onPermissionsChange(allowedPermissions, permissionGroupStatus);
return null;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ public void testPresentAlertTruncatedText() {

windowCapability = getWindowCapability(2);

presentAlertOperation = new PresentAlertOperation(internalInterface, alertView, windowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);
presentAlertOperation = new PresentAlertOperation(internalInterface, alertView, windowCapability, speechCapabilities, fileManager, 1, alertCompletionListener, alertSoftButtonClearListener);
alert = presentAlertOperation.alertRpc();
assertEquals(alert.getAlertText1(), alertView.getText());
assertEquals(alert.getAlertText2(),alertView.getSecondaryText() + " - " + alertView.getTertiaryText());
assertEquals(alert.getAlertText2(), alertView.getSecondaryText() + " - " + alertView.getTertiaryText());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,19 @@ public void testSettingSoftButtonId() {
SoftButtonObject softButtonObject3 = new SoftButtonObject("object1", Arrays.asList(softButtonState1, softButtonState2), softButtonState1.getName(), null);
SoftButtonObject softButtonObject4 = new SoftButtonObject("object2", Arrays.asList(softButtonState3, softButtonState4), softButtonState3.getName(), null);
assertTrue(screenManager.checkAndAssignButtonIds(softButtonObjects, BaseScreenManager.ManagerLocation.SOFTBUTTON_MANAGER));





}

@Test
public void testAssigningIdsToSoftButtonObjects() {
SoftButtonState defaultState = new SoftButtonState("default", "hi", null);
SoftButtonObject sbo1, sbo2, sbo3, sbo4, sbo5;

// Case 1 - don't set id for any button (Manager should set ids automatically starting from 1 and up)
sbo1 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo2 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo3 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo4 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo5 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo1 = new SoftButtonObject(null, defaultState, null);
sbo2 = new SoftButtonObject(null, defaultState, null);
sbo3 = new SoftButtonObject(null, defaultState, null);
sbo4 = new SoftButtonObject(null, defaultState, null);
sbo5 = new SoftButtonObject(null, defaultState, null);
screenManager.checkAndAssignButtonIds(Arrays.asList(sbo1, sbo2, sbo3, sbo4, sbo5), BaseScreenManager.ManagerLocation.SOFTBUTTON_MANAGER);
assertEquals("SoftButtonObject id doesn't match the expected value", 1, sbo1.getButtonId());
assertEquals("SoftButtonObject id doesn't match the expected value", 2, sbo2.getButtonId());
Expand All @@ -234,15 +231,15 @@ public void testAssigningIdsToSoftButtonObjects() {


// Case 2 - Set ids for all buttons (Manager shouldn't alter the ids set by developer)
sbo1 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo1 = new SoftButtonObject(null, defaultState, null);
sbo1.setButtonId(100);
sbo2 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo2 = new SoftButtonObject(null, defaultState, null);
sbo2.setButtonId(200);
sbo3 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo3 = new SoftButtonObject(null, defaultState, null);
sbo3.setButtonId(300);
sbo4 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo4 = new SoftButtonObject(null, defaultState, null);
sbo4.setButtonId(400);
sbo5 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo5 = new SoftButtonObject(null, defaultState, null);
sbo5.setButtonId(500);
screenManager.checkAndAssignButtonIds(Arrays.asList(sbo1, sbo2, sbo3, sbo4, sbo5), BaseScreenManager.ManagerLocation.SOFTBUTTON_MANAGER);
assertEquals("SoftButtonObject id doesn't match the expected value", 100, sbo1.getButtonId());
Expand All @@ -253,13 +250,13 @@ public void testAssigningIdsToSoftButtonObjects() {


// Case 3 - Set ids for some buttons (Manager shouldn't alter the ids set by developer. And it should assign ids for the ones that don't have id)
sbo1 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo1 = new SoftButtonObject(null, defaultState, null);
sbo1.setButtonId(50);
sbo2 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo3 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo4 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo2 = new SoftButtonObject(null, defaultState, null);
sbo3 = new SoftButtonObject(null, defaultState, null);
sbo4 = new SoftButtonObject(null, defaultState, null);
sbo4.setButtonId(100);
sbo5 = new SoftButtonObject(null, Collections.EMPTY_LIST, null, null);
sbo5 = new SoftButtonObject(null, defaultState, null);
screenManager.checkAndAssignButtonIds(Arrays.asList(sbo1, sbo2, sbo3, sbo4, sbo5), BaseScreenManager.ManagerLocation.SOFTBUTTON_MANAGER);
assertEquals("SoftButtonObject id doesn't match the expected value", 50, sbo1.getButtonId());
assertEquals("SoftButtonObject id doesn't match the expected value", 101, sbo2.getButtonId());
Expand Down
Loading

0 comments on commit 16b2ab6

Please sign in to comment.