Skip to content

Commit

Permalink
[APT-10202] Target Android 14
Browse files Browse the repository at this point in the history
Sets service permissions, exports relevant BroadcastReceivers, and changes build to use JDK version 17.
  • Loading branch information
kabliz committed Jul 3, 2024
1 parent b024097 commit 4da44c0
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
11 changes: 7 additions & 4 deletions Armadillo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ plugins {
}

android {
compileSdkVersion 33
compileSdk 34

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

defaultConfig {
minSdkVersion 21
targetSdkVersion 33
targetSdkVersion 34
versionCode 1
versionName project.LIBRARY_VERSION
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
Expand All @@ -44,6 +44,9 @@ android {
}

resourcePrefix 'arm'
buildFeatures {
buildConfig true
}
}

dependencies {
Expand Down
1 change: 1 addition & 0 deletions Armadillo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
android:exported="true"
android:stopWithTask="false"
android:foregroundServiceType="mediaPlayback"
android:permission="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"
tools:ignore="ExportedService">

<intent-filter>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.media.AudioManager
import android.os.Build
import android.util.Log

/**
Expand Down Expand Up @@ -45,7 +46,12 @@ class ArmadilloNoisyReceiver(val application: Application)
if(!isRegistered) {
this.listener = listener
Log.v(TAG, "registered for listening noisy")
application.registerReceiver(this, intentFilter)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
application.registerReceiver(this, intentFilter, Context.RECEIVER_EXPORTED)
} else {
application.registerReceiver(this, intentFilter)
}
isRegistered = true
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.Build
import com.scribd.armadillo.hasSnowCone

/**
Expand All @@ -33,7 +34,11 @@ internal class ArmadilloNotificationDeleteReceiver(val application: Application)

override fun register(listener: NotificationDeleteReceiver.Listener) {
if (!isRegistered) {
application.registerReceiver(this, IntentFilter(ACTION))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
application.registerReceiver(this, IntentFilter(ACTION), Context.RECEIVER_NOT_EXPORTED)
} else {
application.registerReceiver(this, IntentFilter(ACTION))
}
deleteListener = listener
isRegistered = true
}
Expand Down
3 changes: 3 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Project Armadillo Release Notes

## 1.4.0
- Targets Android 14 (SDK 34), with appropriate service permissions.

## 1.3.3
- Reverted fix in 1.3.2 as it may have affected listening progress not being correctly reported
- Added support for passing in load control parameters via ArmadilloConfiguration to the exo player instance
Expand Down
4 changes: 3 additions & 1 deletion TestApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package="com.scribd.armadillotestapp">

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>

<uses-feature
android:name="android.hardware.type.automotive"
Expand Down Expand Up @@ -45,7 +46,8 @@

<service
android:name="com.scribd.armadillo.download.DefaultExoplayerDownloadService"
android:exported="false">
android:exported="false"
android:permission="android.permission.FOREGROUND_SERVICE">
<intent-filter>
<action android:name="com.google.android.exoplayer.downloadService.action.INIT"/>
<category android:name="android.intent.category.DEFAULT"/>
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ SERIALIZATON_VERSION=1.4.1
# Update package-list when updating build tools version
BUILD_TOOLS_VERSION=29.0.3
android.useAndroidX=true
android.enableJetifier=true
android.enableJetifier=true
android.nonTransitiveRClass=true

0 comments on commit 4da44c0

Please sign in to comment.