diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index edc6b36..f528819 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -325,4 +325,27 @@ jobs: api-level: 31 arch: x86_64 profile: Nexus 6 - script: bash tool/scripts/run_android_integration_test.sh \ No newline at end of file + script: bash tool/scripts/run_android_integration_test.sh + + 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_method_channel.so diff --git a/example/android/build.gradle b/example/android/build.gradle index 5c61a4a..6617c1e 100644 --- a/example/android/build.gradle +++ b/example/android/build.gradle @@ -26,6 +26,6 @@ subprojects { project.evaluationDependsOn(':app') } -task clean(type: Delete) { +tasks.register("clean", Delete) { delete rootProject.buildDir } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb7ab55..1d6247b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -27,9 +27,9 @@ add_library(${LIBRARY_NAME} SHARED ${SOURCES} ) -# set_target_properties(hello PROPERTIES -# PUBLIC_HEADER hello.h -# OUTPUT_NAME "hello" -# ) - target_compile_definitions(${LIBRARY_NAME} PUBLIC DART_SHARED_LIB) + +if(ANDROID) + # Support Android 15 16k page size + target_link_options(${LIBRARY_NAME} PRIVATE "-Wl,-z,max-page-size=16384") +endif() diff --git a/tool/scripts/check_android15_16k_page_alignment.sh b/tool/scripts/check_android15_16k_page_alignment.sh new file mode 100644 index 0000000..e935d34 --- /dev/null +++ b/tool/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