From 1e67ac62c4edafb0b93b74517ee1865a744e0697 Mon Sep 17 00:00:00 2001 From: littleGnAl Date: Fri, 11 Oct 2024 15:41:49 +0800 Subject: [PATCH 1/2] fix: support android 15 16k page size --- .github/workflows/build.yml | 23 +++++++++++++++++++ android/src/main/cpp/CMakeLists.txt | 3 +++ scripts/check_android15_16k_page_alignment.sh | 18 +++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 scripts/check_android15_16k_page_alignment.sh diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c3ec9d6fa..076933e69 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -596,3 +596,26 @@ jobs: with: name: web-debug-golden-files path: test_shard/rendering_test/screenshot/*.debug.png + + check_android15_16k_page_alignment: + name: Check android15 16k page size alignment + if: ${{ !contains(github.event.pull_request.labels.*.name, 'ci:skip') }} + strategy: + matrix: + version: ['3.x'] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: '11' + - uses: subosito/flutter-action@v2 + with: + flutter-version: ${{ matrix.version }} + cache: true + - run: flutter pub get + - name: Run flutter build apk + run: flutter build apk + working-directory: example + - name: Check android15 16k page size alignment + run: bash tool/scripts/check_android15_16k_page_alignment.sh example/build/app/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libiris_rendering_android.so diff --git a/android/src/main/cpp/CMakeLists.txt b/android/src/main/cpp/CMakeLists.txt index 186297976..aeab9d278 100644 --- a/android/src/main/cpp/CMakeLists.txt +++ b/android/src/main/cpp/CMakeLists.txt @@ -28,6 +28,9 @@ target_link_libraries(${LIBRARY_NAME} EGL ) +# Support Android 15 16k page size +target_link_options(${LIBRARY_NAME} PRIVATE "-Wl,-z,max-page-size=16384") + set(THIRD_PARTY_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/third_party/include/iris" "${CMAKE_CURRENT_SOURCE_DIR}/third_party/include/agora_rtc" diff --git a/scripts/check_android15_16k_page_alignment.sh b/scripts/check_android15_16k_page_alignment.sh new file mode 100644 index 000000000..e935d3490 --- /dev/null +++ b/scripts/check_android15_16k_page_alignment.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# usage: check_android15_16k_page_alignment.sh path/to/lib.so + +SO_FILE="$1" + +RED="\e[31m" +GREEN="\e[32m" +ENDCOLOR="\e[0m" + +res="$(objdump -p ${SO_FILE} | grep LOAD | awk '{ print $NF }' | head -1)" +if [[ $res =~ "2**14" ]] || [[ $res =~ "2**16" ]]; then + echo -e "${SO_FILE}: ALIGNED ($res)" + exit 0 +else + echo -e "${SO_FILE}: UNALIGNED ($res)" + exit 1 +fi \ No newline at end of file From 734d26cf3c75466fcd01797d626c5a40fb063b83 Mon Sep 17 00:00:00 2001 From: littleGnAl Date: Fri, 11 Oct 2024 16:16:38 +0800 Subject: [PATCH 2/2] ++ --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 076933e69..df9b829d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -618,4 +618,4 @@ jobs: run: flutter build apk working-directory: example - name: Check android15 16k page size alignment - run: bash tool/scripts/check_android15_16k_page_alignment.sh example/build/app/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libiris_rendering_android.so + run: bash scripts/check_android15_16k_page_alignment.sh example/build/app/intermediates/merged_native_libs/release/out/lib/arm64-v8a/libiris_rendering_android.so