Skip to content

Commit 403bab1

Browse files
committed
[APT-10212] Android 13/14 + Exoplayer bugfixes
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.
1 parent d9f5bb0 commit 403bab1

File tree

10 files changed

+41
-31
lines changed

10 files changed

+41
-31
lines changed

Armadillo/build.gradle

+23-4
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,40 @@ android {
5050
}
5151

5252
dependencies {
53+
5354
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
5455
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.4.1'
5556

56-
implementation "com.google.android.exoplayer:exoplayer-core:${EXOPLAYER_VERSION}"
57-
implementation "com.google.android.exoplayer:exoplayer-hls:${EXOPLAYER_VERSION}"
58-
implementation "com.google.android.exoplayer:exoplayer-dash:${EXOPLAYER_VERSION}"
59-
implementation "com.google.android.exoplayer:extension-mediasession:${EXOPLAYER_VERSION}"
57+
compileOnly files('../libs/exoplayer-core-release.aar')
58+
implementation "com.google.android.exoplayer:exoplayer-common:${EXOPLAYER_VERSION}"
59+
implementation ("com.google.android.exoplayer:exoplayer-hls:${EXOPLAYER_VERSION}") {
60+
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
61+
}
62+
implementation ("com.google.android.exoplayer:exoplayer-dash:${EXOPLAYER_VERSION}") {
63+
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
64+
}
65+
implementation ("com.google.android.exoplayer:extension-mediasession:${EXOPLAYER_VERSION}"){
66+
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
67+
}
68+
implementation ("com.google.android.exoplayer:exoplayer-database:${EXOPLAYER_VERSION}") {
69+
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
70+
}
71+
implementation ("com.google.android.exoplayer:exoplayer-datasource:${EXOPLAYER_VERSION}") {
72+
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
73+
}
74+
implementation ("com.google.android.exoplayer:exoplayer-extractor:${EXOPLAYER_VERSION}") {
75+
exclude group: 'com.google.android.exoplayer', module: 'exoplayer-core'
76+
}
6077

6178
implementation "io.reactivex.rxjava2:rxjava:${RXJAVA_VERSION}"
6279
implementation "io.reactivex.rxjava2:rxandroid:${RXANDROID_VERSION}"
6380
implementation "com.google.dagger:dagger:${DAGGER_VERSION}"
81+
6482
kapt "com.google.dagger:dagger-compiler:${DAGGER_VERSION}"
6583
implementation 'androidx.media:media:1.6.0'
6684
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:${SERIALIZATON_VERSION}"
6785

86+
testImplementation files('../libs/exoplayer-core-release.aar')
6887
testImplementation "org.robolectric:robolectric:4.9.2"
6988
testImplementation 'junit:junit:4.13.2'
7089
testImplementation("org.assertj:assertj-core:3.10.0")

Armadillo/src/main/AndroidManifest.xml

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
<uses-permission android:name="android.permission.INTERNET"/>
66
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
7+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
8+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK"/>
9+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
710

811
<application>
912

Armadillo/src/main/java/com/scribd/armadillo/broadcast/NotificationDeleteReceiver.kt

+1
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ internal class ArmadilloNotificationDeleteReceiver(val application: Application)
5757
*/
5858
override fun setDeleteIntentOnNotification(notification: Notification) {
5959
val intent = Intent(ArmadilloNotificationDeleteReceiver.ACTION)
60+
intent.`package` = application.packageName
6061
val intentFlag = if (hasSnowCone()) PendingIntent.FLAG_MUTABLE else 0
6162
val pendingIntent = PendingIntent.getBroadcast(application, 0, intent, intentFlag)
6263
notification.deleteIntent = pendingIntent

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ The library is hosted with Github packages so you will need to add the Github re
4242

4343
1. Generate a personal access token from your Github account.
4444
2. Add the Github package registry with authentication to your `build.gradle` file.
45+
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
46+
downloading in Android 14 you will need to use a forked version of this dependency since Exoplayer does not support Android 14.
4547

4648
```kotlin
4749
maven {

RELEASE.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Project Armadillo Release Notes
22

3+
## 1.4.1
4+
- Fixes Download Service issues on Android 14.
5+
- Removes the Exoplayer 2.19.1 `core` module that does not support Android 14. This module must now be included separately by your
6+
project for this version.
7+
38
## 1.4.0
49
- Targets Android 14 (SDK 34), with appropriate service permissions.
510

TestApp/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ android {
5555
}
5656

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

TestApp/src/androidTest/java/com/scribd/armadillotestapp/ExampleInstrumentedTest.kt

-24
This file was deleted.

TestApp/src/main/AndroidManifest.xml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
66
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
7+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_DATA_SYNC"/>
8+
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PLAYBACK" />
9+
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
710

811
<uses-feature
912
android:name="android.hardware.type.automotive"
@@ -46,6 +49,7 @@
4649
<service
4750
android:name="com.scribd.armadillo.download.DefaultExoplayerDownloadService"
4851
android:exported="false"
52+
android:foregroundServiceType="dataSync|mediaPlayback"
4953
android:permission="android.permission.FOREGROUND_SERVICE">
5054
<intent-filter>
5155
<action android:name="com.google.android.exoplayer.downloadService.action.INIT"/>

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ org.gradle.jvmargs=-Xmx1536m
1313
# org.gradle.parallel=true
1414
PACKAGE_NAME=com.scribd.armadillo
1515
GRADLE_PLUGIN_VERSION=7.2.0
16-
LIBRARY_VERSION=1.4.0
17-
EXOPLAYER_VERSION=2.17.1
16+
LIBRARY_VERSION=1.4.1
17+
EXOPLAYER_VERSION=2.19.1
1818
RXJAVA_VERSION=2.2.4
1919
RXANDROID_VERSION=2.0.1
2020
DAGGER_VERSION=2.16

libs/exoplayer-core-release.aar

1.22 MB
Binary file not shown.

0 commit comments

Comments
 (0)