Skip to content

Commit

Permalink
[APT-10212] Android 13/14 + Exoplayer bugfixes
Browse files Browse the repository at this point in the history
Addresses missing foregroundServiceType. Gets TestApp working for downloads again. Deletes an unused test.  Updates Exoplayer to 2.19.1, which is its last update.

There's a problem with the deprecated version of Exoplayer in that it does not support Android 14. The media3 upgrade script isn't working for Armadillo. As a temporary measure, since Android 14 support is mandatory next month, I've forked Exoplayer and addressed the issue there https://github.com/scribd/ExoPlayer/pull/1/files.
The aar is included manually here with these changes.
  • Loading branch information
kabliz committed Jul 12, 2024
1 parent d9f5bb0 commit 403bab1
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 31 deletions.
27 changes: 23 additions & 4 deletions Armadillo/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,40 @@ android {
}

dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'

implementation "com.google.android.exoplayer:exoplayer-core:${EXOPLAYER_VERSION}"
implementation "com.google.android.exoplayer:exoplayer-hls:${EXOPLAYER_VERSION}"
implementation "com.google.android.exoplayer:exoplayer-dash:${EXOPLAYER_VERSION}"
implementation "com.google.android.exoplayer:extension-mediasession:${EXOPLAYER_VERSION}"
compileOnly files('../libs/exoplayer-core-release.aar')
implementation "com.google.android.exoplayer:exoplayer-common:${EXOPLAYER_VERSION}"
implementation ("com.google.android.exoplayer:exoplayer-hls:${EXOPLAYER_VERSION}") {
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
}
implementation ("com.google.android.exoplayer:exoplayer-dash:${EXOPLAYER_VERSION}") {
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
}
implementation ("com.google.android.exoplayer:extension-mediasession:${EXOPLAYER_VERSION}"){
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
}
implementation ("com.google.android.exoplayer:exoplayer-database:${EXOPLAYER_VERSION}") {
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
}
implementation ("com.google.android.exoplayer:exoplayer-datasource:${EXOPLAYER_VERSION}") {
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
}
implementation ("com.google.android.exoplayer:exoplayer-extractor:${EXOPLAYER_VERSION}") {
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
}

implementation "io.reactivex.rxjava2:rxjava:${RXJAVA_VERSION}"
implementation "io.reactivex.rxjava2:rxandroid:${RXANDROID_VERSION}"
implementation "com.google.dagger:dagger:${DAGGER_VERSION}"

kapt "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
implementation 'androidx.media:media:1.6.0'
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:${SERIALIZATON_VERSION}"

testImplementation files('../libs/exoplayer-core-release.aar')
testImplementation "org.robolectric:robolectric:4.9.2"
testImplementation 'junit:junit:4.13.2'
testImplementation("org.assertj:assertj-core:3.10.0")
Expand Down
3 changes: 3 additions & 0 deletions Armadillo/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>

<application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ internal class ArmadilloNotificationDeleteReceiver(val application: Application)
*/
override fun setDeleteIntentOnNotification(notification: Notification) {
val intent = Intent(ArmadilloNotificationDeleteReceiver.ACTION)
intent.`package` = application.packageName
val intentFlag = if (hasSnowCone()) PendingIntent.FLAG_MUTABLE else 0
val pendingIntent = PendingIntent.getBroadcast(application, 0, intent, intentFlag)
notification.deleteIntent = pendingIntent
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ The library is hosted with Github packages so you will need to add the Github re

1. Generate a personal access token from your Github account.
2. Add the Github package registry with authentication to your `build.gradle` file.
3. For Armadillo version 4.0.1: Add a gradle dependency for com.google.android.exoplayer:exoplayer-core:2.19.1. If you wish to use
downloading in Android 14 you will need to use a forked version of this dependency since Exoplayer does not support Android 14.

```kotlin
maven {
Expand Down
5 changes: 5 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Project Armadillo Release Notes

## 1.4.1
- Fixes Download Service issues on Android 14.
- Removes the Exoplayer 2.19.1 `core` module that does not support Android 14. This module must now be included separately by your
project for this version.

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

Expand Down
2 changes: 1 addition & 1 deletion TestApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ android {
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation files('../libs/exoplayer-core-release.aar')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
Expand Down

This file was deleted.

4 changes: 4 additions & 0 deletions TestApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

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

<uses-feature
android:name="android.hardware.type.automotive"
Expand Down Expand Up @@ -46,6 +49,7 @@
<service
android:name="com.scribd.armadillo.download.DefaultExoplayerDownloadService"
android:exported="false"
android:foregroundServiceType="dataSync|mediaPlayback"
android:permission="android.permission.FOREGROUND_SERVICE">
<intent-filter>
<action android:name="com.google.android.exoplayer.downloadService.action.INIT"/>
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ org.gradle.jvmargs=-Xmx1536m
# org.gradle.parallel=true
PACKAGE_NAME=com.scribd.armadillo
GRADLE_PLUGIN_VERSION=7.2.0
LIBRARY_VERSION=1.4.0
EXOPLAYER_VERSION=2.17.1
LIBRARY_VERSION=1.4.1
EXOPLAYER_VERSION=2.19.1
RXJAVA_VERSION=2.2.4
RXANDROID_VERSION=2.0.1
DAGGER_VERSION=2.16
Expand Down
Binary file added libs/exoplayer-core-release.aar
Binary file not shown.

0 comments on commit 403bab1

Please sign in to comment.