Skip to content

Commit

Permalink
Merge pull request #1880 from smartdevicelink/release/5.7.0_RC
Browse files Browse the repository at this point in the history
Release 5.7.0
  • Loading branch information
joeygrover authored Dec 18, 2023
2 parents a924127 + 01604dc commit cc45527
Show file tree
Hide file tree
Showing 38 changed files with 778 additions and 127 deletions.
27 changes: 21 additions & 6 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: GitHub CI
on: [push, pull_request, workflow_dispatch]

jobs:
test:
test_Android:
runs-on: macOS-latest
steps:

Expand All @@ -15,7 +15,7 @@ jobs:
- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 1.8
java-version: 11

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

- name: Hello Sdl Android Tests
run: ./android/gradlew -p ./android/hello_sdl_android test

- name: Codecov
uses: codecov/[email protected]
with:
yml: ./codecov.yml

test_Java:
runs-on: macOS-latest
steps:

- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Setup JDK
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Sdl JavaSE Tests
run: ./javaSE/gradlew -p ./javaSE/javaSE test
Expand All @@ -36,7 +55,3 @@ jobs:
- name: Sdl JavaEE Tests
run: ./javaEE/gradlew -p ./javaEE/javaEE test

- name: Codecov
uses: codecov/[email protected]
with:
yml: ./codecov.yml
42 changes: 39 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,49 @@
# 5.6.1 Release Notes
# 5.7.0 Release Notes

## Summary:

|| Version|
|---|---|
| **Protocol** | 5.4.1 |
| **RPC** | 8.0.0 |
| **Tested Targeting** | Android 33 |
| **Tested Targeting** | Android 34 |

## Bug Fix / Enhancements:

- [Nearby Devices permission on Android 12 and Above #1839](https://github.com/smartdevicelink/sdl_java_suite/issues/1839)
- [Add pending intent to ping intents] (https://github.com/smartdevicelink/sdl_java_suite/pull/1844

- [Fixes #1845 typo in SdlBroadcastReceiver for uncaughtException handler](https://github.com/smartdevicelink/sdl_java_suite/pull/1846

- [Bugfix/issue #1842 - NPE in BaseTextAndGraphicsManager](https://github.com/smartdevicelink/sdl_java_suite/pull/1847

- [Fix case for UncaughtExceptionHandler in SdlBroadcastReceiver for RemoteServiceException](https://github.com/smartdevicelink/sdl_java_suite/pull/1849

- [Update gradle to 7.4.2](https://github.com/smartdevicelink/sdl_java_suite/pull/1853

- [Fix NPE in SdlRouterService](https://github.com/smartdevicelink/sdl_java_suite/pull/1870

- [Bugfix/issue 1867 Bluetooth notification error fix](https://github.com/smartdevicelink/sdl_java_suite/pull/1868

- [Clean LifecycleManager before closing](https://github.com/smartdevicelink/sdl_java_suite/pull/1866

- [Move router service message sending to its own thread](https://github.com/smartdevicelink/sdl_java_suite/pull/1871

- [Bugfix/issue 1863 update gradle build variants for hello_sdl](https://github.com/smartdevicelink/sdl_java_suite/pull/1864

- [Android 14 add package to PendingIntents in RouterService](https://github.com/smartdevicelink/sdl_java_suite/pull/1862

- [Android 14 Runtime registered broadcast receivers export behavior](https://github.com/smartdevicelink/sdl_java_suite/pull/1858

- [Add logic to handle RAI response failure](https://github.com/smartdevicelink/sdl_java_suite/pull/1873

- [Android 14 foreground service type required](https://github.com/smartdevicelink/sdl_java_suite/pull/1860

- [Update integration validator with latest permissions and checks for exported](https://github.com/smartdevicelink/sdl_java_suite/pull/1875

- [Fix SDLLockScreenActivityEspressoTest for newer devices](https://github.com/smartdevicelink/sdl_java_suite/pull/1877

- [Remove only app logic for device listener start](https://github.com/smartdevicelink/sdl_java_suite/pull/1879)

- [Fix NPE in TransportBroker](https://github.com/smartdevicelink/sdl_java_suite/pull/1882)

**Full Changelog**: https://github.com/smartdevicelink/sdl_java_suite/compare/5.6.1...RC_5.7.0
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.6.1
5.7.0
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:7.4.2'


// NOTE: Do not place your application dependencies here; they belong
Expand Down
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
10 changes: 8 additions & 2 deletions android/hello_sdl_android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 33
compileSdkVersion 34
defaultConfig {
applicationId "com.sdl.hellosdlandroid"
minSdkVersion 16
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName "1.0"
resValue "string", "app_name", "Hello Sdl Android"
buildConfigField 'String', 'APP_TYPE', '"DEFAULT"'
buildConfigField 'String', 'REQUIRE_AUDIO_OUTPUT', '"FALSE"'
buildConfigField 'String', 'SDL_APP_NAME', '"Hello Sdl"'
buildConfigField 'String', 'SDL_APP_ID', '"8678309"'
manifestPlaceholders = [
appIcon: "@mipmap/ic_launcher"
]
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
Expand Down
4 changes: 3 additions & 1 deletion android/hello_sdl_android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
tools:targetApi="31"/>
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"
tools:targetApi="33"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE"
tools:targetApi="34"/>
<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 @@ -28,7 +30,7 @@

<application
android:allowBackup="false"
android:icon="@mipmap/ic_launcher"
android:icon="${appIcon}"
android:label="@string/app_name"
android:theme="@style/AppTheme"
tools:ignore="DeepLinks">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
package com.sdl.hellosdlandroid;

import android.app.PendingIntent;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.hardware.usb.UsbAccessory;
import android.hardware.usb.UsbManager;
import android.os.Build;

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

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

private static final String ACTION_USB_PERMISSION = "com.android.example.USB_PERMISSION";
private PendingIntent pendingIntentToStartService;
private Intent startSdlServiceIntent;

@Override
public void onSdlEnabled(Context context, Intent intent) {
DebugTool.logInfo(TAG, "SDL Enabled");
Expand All @@ -24,6 +33,15 @@ public void onSdlEnabled(Context context, Intent intent) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
PendingIntent pendingIntent = (PendingIntent) intent.getParcelableExtra(TransportConstants.PENDING_INTENT_EXTRA);
if (pendingIntent != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) {
if (!AndroidTools.hasForegroundServiceTypePermission(context)) {
requestUsbAccessory(context);
startSdlServiceIntent = intent;
this.pendingIntentToStartService = pendingIntent;
DebugTool.logInfo(TAG, "Permission missing for ForegroundServiceType connected device." + context);
return;
}
}
try {
pendingIntent.send(context, 0, intent);
} catch (PendingIntent.CanceledException e) {
Expand Down Expand Up @@ -56,4 +74,47 @@ public void onReceive(Context context, Intent intent) {
public String getSdlServiceName() {
return SdlService.class.getSimpleName();
}

private final BroadcastReceiver usbPermissionReceiver = new BroadcastReceiver() {
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (ACTION_USB_PERMISSION.equals(action) && context != null && startSdlServiceIntent != null && pendingIntentToStartService != null) {
if (AndroidTools.hasForegroundServiceTypePermission(context)) {
try {
pendingIntentToStartService.send(context, 0, startSdlServiceIntent);
context.unregisterReceiver(this);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
};

/**
* Request permission from USB Accessory if USB accessory is not null.
* If the user has not granted the BLUETOOTH_CONNECT permission,
* we can request the USB Accessory permission to satisfy the requirements for
* FOREGROUND_SERVICE_CONNECTED_DEVICE and can start our service and allow
* it to enter the foreground. FOREGROUND_SERVICE_CONNECTED_DEVICE is a requirement
* in Android 14
*/
private void requestUsbAccessory(Context context) {
UsbManager manager = (UsbManager) context.getSystemService(Context.USB_SERVICE);
UsbAccessory[] accessoryList = manager.getAccessoryList();
if (accessoryList == null || accessoryList.length == 0) {
startSdlServiceIntent = null;
pendingIntentToStartService = null;
return;
}
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(context, 0, new Intent(ACTION_USB_PERMISSION), PendingIntent.FLAG_IMMUTABLE);
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);

AndroidTools.registerReceiver(context, usbPermissionReceiver, filter,
Context.RECEIVER_EXPORTED);

for (final UsbAccessory usbAccessory : accessoryList) {
manager.requestPermission(usbAccessory, mPermissionIntent);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,8 @@ public class SdlService extends Service {

private static final String TAG = "SDL Service";

private static final String APP_NAME = "Hello Sdl";
private static final String APP_NAME_ES = "Hola Sdl";
private static final String APP_NAME_FR = "Bonjour Sdl";
private static final String APP_ID = "8678309";

private static final String ICON_FILENAME = "hello_sdl_icon.png";
private static final String SDL_IMAGE_FILENAME = "sdl_full_image.png";
Expand Down Expand Up @@ -104,18 +102,25 @@ public void onCreate() {
@SuppressLint("NewApi")
public void enterForeground() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
NotificationChannel channel = new NotificationChannel(APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
Notification.Builder builder = new Notification.Builder(this, channel.getId())
.setContentTitle("Connected through SDL")
.setSmallIcon(R.drawable.ic_sdl);
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
builder.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE);
try {
NotificationChannel channel = new NotificationChannel(BuildConfig.SDL_APP_ID, "SdlService", NotificationManager.IMPORTANCE_DEFAULT);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
if (notificationManager != null) {
notificationManager.createNotificationChannel(channel);
Notification.Builder builder = new Notification.Builder(this, channel.getId())
.setContentTitle("Connected through SDL")
.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);
}
Notification serviceNotification = builder.build();
startForeground(FOREGROUND_SERVICE_ID, serviceNotification);
} catch (Exception e) {
// This should only catch for TCP connections on Android 14+ due to needing
// permissions for ForegroundServiceType ConnectedDevice that don't make sense for
// a TCP connection
DebugTool.logError(TAG, "Unable to start service in foreground", e);
}
}
}
Expand Down Expand Up @@ -161,14 +166,14 @@ private void startProxy() {
} else {
securityLevel = MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF;
}
transport = new MultiplexTransportConfig(this, APP_ID, securityLevel);
transport = new MultiplexTransportConfig(this, BuildConfig.SDL_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")) {
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
MultiplexTransportConfig mtc = new MultiplexTransportConfig(this, BuildConfig.SDL_APP_ID, MultiplexTransportConfig.FLAG_MULTI_SECURITY_OFF);
mtc.setRequiresHighBandwidth(true);
transport = mtc;
}
Expand Down Expand Up @@ -215,8 +220,8 @@ public void onError(String info, Exception e) {
@Override
public LifecycleConfigurationUpdate managerShouldUpdateLifecycle(Language language, Language hmiLanguage) {
boolean isNeedUpdate = false;
String appName = APP_NAME;
String ttsName = APP_NAME;
String appName = BuildConfig.SDL_APP_NAME;
String ttsName = BuildConfig.SDL_APP_NAME;
switch (language) {
case ES_MX:
isNeedUpdate = true;
Expand Down Expand Up @@ -260,7 +265,7 @@ public boolean onSystemInfoReceived(SystemInfo systemInfo) {
SdlArtwork appIcon = new SdlArtwork(ICON_FILENAME, FileType.GRAPHIC_PNG, R.mipmap.ic_launcher, true);

// The manager builder sets options for your session
SdlManager.Builder builder = new SdlManager.Builder(this, APP_ID, APP_NAME, listener);
SdlManager.Builder builder = new SdlManager.Builder(this, BuildConfig.SDL_APP_ID, BuildConfig.SDL_APP_NAME, listener);
builder.setAppTypes(appType);
builder.setTransportType(transport);
builder.setAppIcon(appIcon);
Expand Down Expand Up @@ -375,7 +380,7 @@ private void performWelcomeSpeak() {
*/
private void performWelcomeShow() {
sdlManager.getScreenManager().beginTransaction();
sdlManager.getScreenManager().setTextField1(APP_NAME);
sdlManager.getScreenManager().setTextField1(BuildConfig.SDL_APP_NAME);
sdlManager.getScreenManager().setTextField2(WELCOME_SHOW);
sdlManager.getScreenManager().setPrimaryGraphic(new SdlArtwork(SDL_IMAGE_FILENAME, FileType.GRAPHIC_PNG, R.drawable.sdl, true));
sdlManager.getScreenManager().commit(new CompletionListener() {
Expand Down
1 change: 0 additions & 1 deletion android/hello_sdl_android/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">Hello Sdl Android</string>
<string name="hello_world">Hello SDL!</string>
<string name="action_settings">Settings</string>

Expand Down
Loading

0 comments on commit cc45527

Please sign in to comment.