From 9b9babc091420966c124e07637c88e3f4dc56ab7 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Thu, 9 May 2024 08:16:54 +0200 Subject: [PATCH 1/2] api34 --- IOIOLibAndroid/build.gradle | 4 ++-- IOIOLibAndroidAccessory/build.gradle | 4 ++-- IOIOLibAndroidBluetooth/build.gradle | 4 ++-- IOIOLibAndroidDevice/build.gradle | 4 ++-- applications/HelloIOIO/build.gradle | 4 ++-- applications/HelloIOIOService/build.gradle | 4 ++-- applications/HolidayIOIO/build.gradle | 4 ++-- applications/IOIOConnectionTesterAndroid/build.gradle | 4 ++-- applications/IOIOManager/build.gradle | 4 ++-- applications/IOIOSimpleApp/build.gradle | 4 ++-- applications/IOIOTestBed/build.gradle | 4 ++-- applications/IOIOTortureTest/build.gradle | 4 ++-- applications/ShoeBot/build.gradle | 4 ++-- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/IOIOLibAndroid/build.gradle b/IOIOLibAndroid/build.gradle index 90625011..79007c98 100644 --- a/IOIOLibAndroid/build.gradle +++ b/IOIOLibAndroid/build.gradle @@ -7,8 +7,8 @@ android { namespace 'ioio.lib' defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 } } diff --git a/IOIOLibAndroidAccessory/build.gradle b/IOIOLibAndroidAccessory/build.gradle index acaf7002..662a4d40 100644 --- a/IOIOLibAndroidAccessory/build.gradle +++ b/IOIOLibAndroidAccessory/build.gradle @@ -7,8 +7,8 @@ android { namespace 'ioio.lib.accessory' defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 } } diff --git a/IOIOLibAndroidBluetooth/build.gradle b/IOIOLibAndroidBluetooth/build.gradle index 6cbe0df0..7da47637 100644 --- a/IOIOLibAndroidBluetooth/build.gradle +++ b/IOIOLibAndroidBluetooth/build.gradle @@ -7,8 +7,8 @@ android { namespace 'ioio.lib.bluetooth' defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 } } diff --git a/IOIOLibAndroidDevice/build.gradle b/IOIOLibAndroidDevice/build.gradle index 1b6cc565..5a0062e0 100644 --- a/IOIOLibAndroidDevice/build.gradle +++ b/IOIOLibAndroidDevice/build.gradle @@ -7,8 +7,8 @@ android { namespace 'ioio.lib.android.device' defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 } } diff --git a/applications/HelloIOIO/build.gradle b/applications/HelloIOIO/build.gradle index ff9268c8..3d8b3b65 100644 --- a/applications/HelloIOIO/build.gradle +++ b/applications/HelloIOIO/build.gradle @@ -6,8 +6,8 @@ android { defaultConfig { minSdkVersion 21 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/HelloIOIOService/build.gradle b/applications/HelloIOIOService/build.gradle index 77c7ece5..3db08709 100644 --- a/applications/HelloIOIOService/build.gradle +++ b/applications/HelloIOIOService/build.gradle @@ -4,8 +4,8 @@ android { namespace 'ioio.examples.hello_service' defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/HolidayIOIO/build.gradle b/applications/HolidayIOIO/build.gradle index b9f65419..75f7fa38 100644 --- a/applications/HolidayIOIO/build.gradle +++ b/applications/HolidayIOIO/build.gradle @@ -5,8 +5,8 @@ android { namespace "ioio.examples.holiday" defaultConfig { minSdkVersion 21 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/IOIOConnectionTesterAndroid/build.gradle b/applications/IOIOConnectionTesterAndroid/build.gradle index 8513c4de..15d3e1aa 100644 --- a/applications/IOIOConnectionTesterAndroid/build.gradle +++ b/applications/IOIOConnectionTesterAndroid/build.gradle @@ -4,8 +4,8 @@ android { namespace "ioio.connection_tester" defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/IOIOManager/build.gradle b/applications/IOIOManager/build.gradle index 3c574bce..dc7e1135 100644 --- a/applications/IOIOManager/build.gradle +++ b/applications/IOIOManager/build.gradle @@ -5,8 +5,8 @@ android { namespace "ioio.manager" defaultConfig { minSdkVersion 21 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/IOIOSimpleApp/build.gradle b/applications/IOIOSimpleApp/build.gradle index 812f6473..2da68180 100644 --- a/applications/IOIOSimpleApp/build.gradle +++ b/applications/IOIOSimpleApp/build.gradle @@ -5,8 +5,8 @@ android { namespace "ioio.examples.simple" defaultConfig { minSdkVersion 21 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/IOIOTestBed/build.gradle b/applications/IOIOTestBed/build.gradle index eb704c46..ced7ecf7 100644 --- a/applications/IOIOTestBed/build.gradle +++ b/applications/IOIOTestBed/build.gradle @@ -4,8 +4,8 @@ android { namespace "ioio.test_bed" defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/IOIOTortureTest/build.gradle b/applications/IOIOTortureTest/build.gradle index 201d3458..91a3debd 100644 --- a/applications/IOIOTortureTest/build.gradle +++ b/applications/IOIOTortureTest/build.gradle @@ -4,8 +4,8 @@ android { namespace "ioio.tests.torture" defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() diff --git a/applications/ShoeBot/build.gradle b/applications/ShoeBot/build.gradle index aef3cf68..283b0e1e 100644 --- a/applications/ShoeBot/build.gradle +++ b/applications/ShoeBot/build.gradle @@ -4,8 +4,8 @@ android { namespace "ioio.applications.shoebot" defaultConfig { minSdkVersion 14 - compileSdk 33 - targetSdkVersion 33 + compileSdk 34 + targetSdkVersion 34 versionCode getGitCommitCount() versionName getTag() From 823836ec8341e925e794baeafa0d20e2b32f8bd9 Mon Sep 17 00:00:00 2001 From: Hannes Achleitner Date: Fri, 10 May 2024 08:07:06 +0200 Subject: [PATCH 2/2] Adopt registerReceiver --- .../accessory/AccessoryConnectionBootstrap.java | 10 +++++++++- .../lib/android/device/DeviceConnectionBootstrap.java | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/IOIOLibAndroidAccessory/src/main/java/ioio/lib/android/accessory/AccessoryConnectionBootstrap.java b/IOIOLibAndroidAccessory/src/main/java/ioio/lib/android/accessory/AccessoryConnectionBootstrap.java index ef3c6ae3..e969c692 100644 --- a/IOIOLibAndroidAccessory/src/main/java/ioio/lib/android/accessory/AccessoryConnectionBootstrap.java +++ b/IOIOLibAndroidAccessory/src/main/java/ioio/lib/android/accessory/AccessoryConnectionBootstrap.java @@ -47,6 +47,7 @@ import java.io.OutputStream; import java.util.Collection; +import android.annotation.SuppressLint; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; @@ -267,9 +268,16 @@ private boolean tryOpen() { } } + @SuppressLint("UnspecifiedRegisterReceiverFlag") private void registerReceiver() { IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION); - activity_.registerReceiver(this, filter); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + activity_.registerReceiver(this, filter, Context.RECEIVER_NOT_EXPORTED); + } else + activity_.registerReceiver(this, filter); + } else + activity_.registerReceiver(this, filter); } private void unregisterReceiver() { diff --git a/IOIOLibAndroidDevice/src/main/java/ioio/lib/android/device/DeviceConnectionBootstrap.java b/IOIOLibAndroidDevice/src/main/java/ioio/lib/android/device/DeviceConnectionBootstrap.java index 71b63c5b..0c264691 100644 --- a/IOIOLibAndroidDevice/src/main/java/ioio/lib/android/device/DeviceConnectionBootstrap.java +++ b/IOIOLibAndroidDevice/src/main/java/ioio/lib/android/device/DeviceConnectionBootstrap.java @@ -42,6 +42,7 @@ import java.util.Collection; import java.util.HashMap; +import android.annotation.SuppressLint; import android.annotation.TargetApi; import android.app.PendingIntent; import android.content.BroadcastReceiver; @@ -484,11 +485,18 @@ private void checkPermission() { } } + @SuppressLint("UnspecifiedRegisterReceiverFlag") private void registerReceiver() { IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION); filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED); filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED); - activity_.registerReceiver(this, filter); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + activity_.registerReceiver(this, filter, Context.RECEIVER_NOT_EXPORTED); + } else + activity_.registerReceiver(this, filter); + } else + activity_.registerReceiver(this, filter); } private void unregisterReceiver() {