Skip to content

Commit 2640ebd

Browse files
rohitjoinscopybara-github
authored andcommitted
Add 16 KB page support for decoder extensions on Android 15
We need to rebuild any native components of the app to prevent crashes on devices with 16 KB page support. Tested on a device that supports 16 KB pages and runs Android 15, as well as on older Android devices. Issue: #1685 PiperOrigin-RevId: 684488244
1 parent 6acddfe commit 2640ebd

File tree

13 files changed

+71
-1
lines changed

13 files changed

+71
-1
lines changed

RELEASENOTES.md

+2
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@
145145
* Fix user info removal for URLs that contain encoded @ characters
146146
([#1138](https://github.com/androidx/media/pull/1138)).
147147
* Decoder Extensions (FFmpeg, VP9, AV1, etc.):
148+
* Add 16 KB page support for decoder extensions on Android 15
149+
([#1685](https://github.com/androidx/media/issues/1685)).
148150
* MIDI extension:
149151
* Leanback extension:
150152
* Cast Extension:

libraries/decoder_av1/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ android {
2727
}
2828
}
2929
}
30+
31+
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
32+
// to version 8.5.1 or higher.
33+
packagingOptions {
34+
jniLibs {
35+
useLegacyPackaging true
36+
}
37+
}
3038
}
3139

3240
// Configure the native build only if libgav1 is present to avoid gradle sync

libraries/decoder_av1/src/main/jni/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,7 @@ target_link_libraries(gav1JNI
6161
PRIVATE libgav1_static
6262
PRIVATE ${android_log_lib})
6363

64+
# Enable 16 KB ELF alignment.
65+
target_link_options(gav1JNI
66+
PRIVATE "-Wl,-z,max-page-size=16384")
67+

libraries/decoder_ffmpeg/build.gradle

+11-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,17 @@
1313
// limitations under the License.
1414
apply from: "$gradle.ext.androidxMediaSettingsDir/common_library_config.gradle"
1515

16-
android.namespace = 'androidx.media3.decoder.ffmpeg'
16+
android {
17+
namespace 'androidx.media3.decoder.ffmpeg'
18+
19+
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
20+
// to version 8.5.1 or higher.
21+
packagingOptions {
22+
jniLibs {
23+
useLegacyPackaging true
24+
}
25+
}
26+
}
1727

1828
// Configure the native build only if ffmpeg is present to avoid gradle sync
1929
// failures if ffmpeg hasn't been built according to the README instructions.

libraries/decoder_ffmpeg/src/main/jni/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,7 @@ target_link_libraries(ffmpegJNI
5656
if(ANDROID_ABI STREQUAL "arm64-v8a")
5757
target_link_options(ffmpegJNI PRIVATE "-Wl,-Bsymbolic")
5858
endif()
59+
60+
# Enable 16 KB ELF alignment.
61+
target_link_options(ffmpegJNI
62+
PRIVATE "-Wl,-z,max-page-size=16384")

libraries/decoder_flac/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ android {
2323
}
2424
androidTest.assets.srcDir '../test_data/src/test/assets'
2525
}
26+
27+
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
28+
// to version 8.5.1 or higher.
29+
packagingOptions {
30+
jniLibs {
31+
useLegacyPackaging true
32+
}
33+
}
2634
}
2735

2836
dependencies {

libraries/decoder_flac/src/main/jni/Android.mk

+2
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,6 @@ LOCAL_CFLAGS += -D_REENTRANT -DPIC -DU_COMMON_IMPLEMENTATION -fPIC -DHAVE_SYS_PA
3535
LOCAL_CFLAGS += -O3 -funroll-loops -finline-functions -DFLAC__NO_ASM '-DFLAC__HAS_OGG=0'
3636

3737
LOCAL_LDLIBS := -llog -lz -lm
38+
# Enable 16 KB ELF alignment.
39+
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"
3840
include $(BUILD_SHARED_LIBRARY)

libraries/decoder_iamf/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ android {
2727
}
2828
}
2929
}
30+
31+
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
32+
// to version 8.5.1 or higher.
33+
packagingOptions {
34+
jniLibs {
35+
useLegacyPackaging true
36+
}
37+
}
3038
}
3139

3240
// Configure the native build only if libiamf is present to avoid gradle sync

libraries/decoder_iamf/src/main/jni/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,7 @@ target_link_libraries(iamfJNI
4444
PRIVATE android
4545
PRIVATE iamf
4646
PRIVATE ${android_log_lib})
47+
48+
# Enable 16 KB ELF alignment.
49+
target_link_options(iamfJNI
50+
PRIVATE "-Wl,-z,max-page-size=16384")

libraries/decoder_opus/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ android {
2323
}
2424
androidTest.assets.srcDir '../test_data/src/test/assets'
2525
}
26+
27+
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
28+
// to version 8.5.1 or higher.
29+
packagingOptions {
30+
jniLibs {
31+
useLegacyPackaging true
32+
}
33+
}
2634
}
2735

2836
dependencies {

libraries/decoder_opus/src/main/jni/Android.mk

+2
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,6 @@ LOCAL_CPP_EXTENSION := .cc
3030
LOCAL_SRC_FILES := opus_jni.cc
3131
LOCAL_LDLIBS := -llog -lz -lm
3232
LOCAL_STATIC_LIBRARIES := libopus
33+
# Enable 16 KB ELF alignment.
34+
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"
3335
include $(BUILD_SHARED_LIBRARY)

libraries/decoder_vp9/build.gradle

+8
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ android {
2323
}
2424
androidTest.assets.srcDir '../test_data/src/test/assets'
2525
}
26+
27+
// TODO(Internal: b/372449691): Remove packagingOptions once AGP is updated
28+
// to version 8.5.1 or higher.
29+
packagingOptions {
30+
jniLibs {
31+
useLegacyPackaging true
32+
}
33+
}
2634
}
2735

2836
dependencies {

libraries/decoder_vp9/src/main/jni/Android.mk

+2
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ LOCAL_SRC_FILES := vpx_jni.cc
3232
LOCAL_LDLIBS := -llog -lz -lm -landroid
3333
LOCAL_SHARED_LIBRARIES := libvpx
3434
LOCAL_STATIC_LIBRARIES := cpufeatures
35+
# Enable 16 KB ELF alignment.
36+
LOCAL_LDFLAGS += "-Wl,-z,max-page-size=16384"
3537
include $(BUILD_SHARED_LIBRARY)
3638

3739
$(call import-module,android/cpufeatures)

0 commit comments

Comments
 (0)