Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d0563c4
Remove package from manifest and put in build.gradle
JulianKast Feb 14, 2024
28564de
Update gradle version to 8.2.2
JulianKast Feb 14, 2024
1b1f7e3
Update gradle version to 8.2.2
JulianKast Feb 14, 2024
18d36fa
update maven plugin
JulianKast Feb 14, 2024
1a5fe56
add buildFeatures aidl as suggested by AGP update assistant
JulianKast Feb 14, 2024
088e811
Formatting
JulianKast Feb 14, 2024
b49b173
add androidTestImplementation 'androidx.test:rules:1.5.0' to test per…
JulianKast Feb 14, 2024
e0fbb56
Add permissions queries for routerService to Android test manifest
JulianKast Feb 14, 2024
7e5310d
Add TestSdlReceiver for unit test
JulianKast Feb 14, 2024
a1390bd
Reset SDK_INT version in AudioStreamManagerTest after it is changed f…
JulianKast Feb 14, 2024
1c63291
update manager layer test sleep calls to 1 sec
JulianKast Feb 14, 2024
486777b
Update DeviceUtil.isEmulator to catch new emulator for ci checks
JulianKast Feb 14, 2024
0f3792d
grant BLUETOOTH_CONNECT for TransportManagerTests
JulianKast Feb 14, 2024
2e53014
grant BLUETOOTH_CONNECT permission for MediaStreamingStatusTests
JulianKast Feb 14, 2024
fd5eab8
Ignore TransportBrokerTest with note to have an app with a running Ro…
JulianKast Feb 14, 2024
2912fb3
MultiplexBluetoothTransportTest testStateTransitions only check state…
JulianKast Feb 14, 2024
154a98a
Starting with API 30 we can not use reflection to fake NetworkCapabil…
JulianKast Feb 14, 2024
d186229
update comment for WiFiSocketFactoryTest
JulianKast Feb 14, 2024
d3027b3
Update yml to target proper API level, use newer JDK and beef up emul…
JulianKast Feb 14, 2024
690252c
Update targetSdkVersion to 36 and minSdkVersion to 21
JulianKast Nov 4, 2025
8fc0b9d
Update gradle to 8.13
JulianKast Nov 4, 2025
50402b3
update dependencies
JulianKast Nov 4, 2025
88620ca
update CI
JulianKast Nov 4, 2025
3f58414
downgrade api level on CI
JulianKast Nov 4, 2025
4308999
try arm runner with api level 36
JulianKast Nov 4, 2025
a4bacbd
update android test to use arm based emulator for api 36
JulianKast Nov 4, 2025
7bb575c
update to run on ubuntu with x86_64 android image
JulianKast Nov 4, 2025
e3e69c2
change back to mac
JulianKast Nov 4, 2025
c48ff18
beef up emulator
JulianKast Nov 4, 2025
187a94f
update emulator options
JulianKast Nov 4, 2025
c2b62f7
Use ubuntu runner
JulianKast Nov 4, 2025
b77f68e
improve emulator boot time
JulianKast Nov 4, 2025
7e3fd13
use google_apis for the emulator type
JulianKast Nov 4, 2025
15f35e3
Add enable kvm to make Android emulator run faster
JulianKast Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request, workflow_dispatch]

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

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

- name: Sdl Android Tests
# For more info, please check out: https://github.com/marketplace/actions/android-emulator-runner
java-version: 17

- name: Enable KVM group perms
run: |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
sudo udevadm control --reload-rules
sudo udevadm trigger --name-match=kvm
ls -l /dev/kvm || true

- name: SDL Android Tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
script: ./android/gradlew -p ./android :sdl_android:connectedCheck

api-level: 36
target: google_apis
arch: x86_64
profile: pixel_7
ram-size: 2048M
disk-size: 4096M
disable-animations: true
emulator-boot-timeout: 1200
emulator-options: "-no-window -no-snapshot -no-audio"
script: ./android/gradlew -p ./android :sdl_android:connectedDebugAndroidTest

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

Expand All @@ -33,7 +47,7 @@ jobs:
yml: ./codecov.yml

test_Java:
runs-on: macOS-latest
runs-on: ubuntu-latest
steps:

- name: Checkout
Expand Down
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:7.4.2'
classpath 'com.android.tools.build:gradle:8.13.0'


// NOTE: Do not place your application dependencies here; they belong
Expand Down
3 changes: 3 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536m

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-7.5-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-all.zip
11 changes: 6 additions & 5 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 34
compileSdkVersion 36
defaultConfig {
applicationId "com.sdl.hellosdlandroid"
minSdkVersion 16
targetSdkVersion 34
minSdkVersion 21
targetSdkVersion 36
versionCode 1
versionName "1.0"
resValue "string", "app_name", "Hello Sdl Android"
Expand Down Expand Up @@ -61,6 +61,7 @@ android {
lintOptions {
disable 'GoogleAppIndexingWarning'
}
namespace 'com.sdl.hellosdlandroid'
}


Expand All @@ -69,7 +70,7 @@ dependencies {
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.appcompat:appcompat:1.7.1'
implementation project(path: ':sdl_android')
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13.2'
}
3 changes: 1 addition & 2 deletions android/hello_sdl_android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.sdl.hellosdlandroid">
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"
Expand Down
38 changes: 22 additions & 16 deletions android/sdl_android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 34
compileSdkVersion 36
defaultConfig {
minSdkVersion 16
targetSdkVersion 34
versionCode 26
versionName new File(projectDir.path, ('/../../VERSION')).text.trim()
minSdkVersion 21
targetSdkVersion 36
buildConfigField "String", "VERSION_NAME", '\"' + versionName + '\"'
resValue "string", "SDL_LIB_VERSION", '\"' + versionName + '\"'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
Expand Down Expand Up @@ -38,25 +36,33 @@ android {
main.java.srcDirs += '../../base/src/main/java'
androidTest.assets.srcDirs += '../../generator/rpc_spec/'
}

buildFeatures {
aidl true
}

namespace 'com.smartdevicelink'
testNamespace 'com.smartdevicelink.test'
}

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

dependencies {
api fileTree(dir: 'libs', include: ['*.jar'])
//api 'com.livio.taskmaster:taskmaster:0.6.0'
api 'com.smartdevicelink:bson_java_port:1.2.5'
api 'com.smartdevicelink:bson_java_port:1.2.6'
api 'androidx.lifecycle:lifecycle-extensions:2.2.0'
api 'androidx.annotation:annotation:1.1.0'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.2.0'
api 'androidx.annotation:annotation:1.9.1'
annotationProcessor 'androidx.lifecycle:lifecycle-compiler:2.9.4'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:5.7.0'
androidTestImplementation 'org.mockito:mockito-core:5.7.0'
androidTestImplementation 'org.mockito:mockito-android:5.7.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.5.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:5.20.0'
androidTestImplementation 'androidx.test:rules:1.7.0'
androidTestImplementation 'org.mockito:mockito-core:5.20.0'
androidTestImplementation 'org.mockito:mockito-android:5.20.0'
androidTestImplementation 'androidx.test.ext:junit:1.3.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.7.0'
androidTestImplementation 'androidx.test.espresso:espresso-intents:3.7.0'
}

buildscript {
Expand All @@ -65,7 +71,7 @@ buildscript {
}
dependencies {
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.13.0'
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.34.0'
}
}

Expand Down
28 changes: 25 additions & 3 deletions android/sdl_android/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<manifest package="com.smartdevicelink.test"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-sdk android:minSdkVersion="16" />
<uses-sdk android:minSdkVersion="21" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Required to pair Bluetooth devices -->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Expand All @@ -13,10 +12,33 @@
android:name="android.test.InstrumentationTestRunner"
android:targetPackage="com.smartdevicelink.test" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_CONNECTED_DEVICE" />

<queries>
<intent>
<action android:name="com.smartdevicelink.router.service" />
</intent>
<intent>
<action android:name="sdl.router.startservice" />
</intent>
</queries>

<application android:debuggable="true">
<uses-library android:name="android.test.runner" />
<activity android:name="com.smartdevicelink.managers.lockscreen.SDLLockScreenActivity" />
<receiver
android:name=".TestSdlReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.smartdevicelink.USB_ACCESSORY_ATTACHED" /> <!--For AOA -->
<action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
<action android:name="sdl.router.startservice" />
</intent-filter>
</receiver>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.smartdevicelink;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

/**
* Added so we pass IntegrationValidator when running unit test.
*/
public class TestSdlReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,99 +134,131 @@ public void onComplete(boolean success) {
}

public void testWithSquareSampleAudio16BitAnd8KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._8KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(8000, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd16KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._16KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(16000, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd22KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._22KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(22050, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd44KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._44KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(44100, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd8KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._8KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(8000, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd16KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._16KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(16000, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd22KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._22KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(22050, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd44KhzApi16() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 16);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._44KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(44100, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd8KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._8KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(8000, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd16KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._16KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(16000, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd22KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._22KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(22050, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio16BitAnd44KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._44KHZ, BitsPerSample._16_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(44100, SampleType.SIGNED_16_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd8KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._8KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(8000, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd16KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._16KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(16000, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd22KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._22KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(22050, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

public void testWithSquareSampleAudio8BitAnd44KhzApi21() throws Exception {
int versionCode = Build.VERSION.SDK_INT;
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), 21);
AudioPassThruCapabilities audioPassThruCapabilities = new AudioPassThruCapabilities(SamplingRate._44KHZ, BitsPerSample._8_BIT, AudioType.PCM);
runFullAudioManagerDecodeFlowWithSquareSampleAudio(44100, SampleType.UNSIGNED_8_BIT, audioPassThruCapabilities);
setFinalStatic(Build.VERSION.class.getField("SDK_INT"), versionCode);
}

private int testFullAudioManagerDecodeFlowCorrectCounter = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public Void answer(InvocationOnMock invocation) {

private void sleep() {
try {
Thread.sleep(100);
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Expand Down
Loading
Loading