Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support android 15 16k page size #109

Merged
merged 1 commit into from
Oct 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,27 @@ jobs:
api-level: 31
arch: x86_64
profile: Nexus 6
script: bash tool/scripts/run_android_integration_test.sh
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
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
10 changes: 5 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
18 changes: 18 additions & 0 deletions tool/scripts/check_android15_16k_page_alignment.sh
Original file line number Diff line number Diff line change
@@ -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
Loading