android: Work on API level 36 support (though target 35 for now)

This commit is contained in:
rdb 2025-11-08 23:55:52 +01:00
parent 27d905feff
commit 32bdca9015
7 changed files with 17 additions and 4 deletions

View File

@ -633,7 +633,7 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ./thirdparty
key: cache-android-thirdparty-afc7ad98aee90da0f2f6bad826a41f9b71e0cdd0-${{ matrix.android-abi }}-ndk${{ matrix.ndk-version }}
key: cache-android-thirdparty-935c80380ca171e08587c570e9dad678d29db3c8-${{ matrix.android-abi }}-ndk${{ matrix.ndk-version }}
- name: Install yasm
if: steps.cache-android-thirdparty-restore.outputs.cache-hit != 'true'
@ -642,7 +642,7 @@ jobs:
- name: Build thirdparty packages
if: steps.cache-android-thirdparty-restore.outputs.cache-hit != 'true'
run: |
git clone --revision=afc7ad98aee90da0f2f6bad826a41f9b71e0cdd0 --depth=1 https://github.com/rdb/panda3d-thirdparty.git thirdparty
git clone --revision=935c80380ca171e08587c570e9dad678d29db3c8 --depth=1 https://github.com/rdb/panda3d-thirdparty.git thirdparty
cd thirdparty
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \

View File

@ -1970,6 +1970,9 @@ class Freezer:
elif self.platform.endswith('_aarch64') or self.platform.endswith('_arm64'):
# Most arm64 operating systems are configured with 16 KiB pages.
blob_align = 16384
elif self.platform.replace('-', '_') == 'android_x86_64':
# Android nowadays requires 16 KiB pages on 64-bit Intel as well.
blob_align = 16384
else:
# Align to page size, so that it can be mmapped.
blob_align = 4096

View File

@ -174,6 +174,7 @@ ANDROID_ATTRIBUTES = {
'debuggable': bool_resource(0x0101000f),
'documentLaunchMode': enum_resource(0x1010445, "none", "intoExisting", "always", "never"),
'enabled': bool_resource(0x101000e),
'enableOnBackInvokedCallback': bool_resource(0x0101066c),
'excludeFromRecents': bool_resource(0x1010017),
'exported': bool_resource(0x1010010),
'extractNativeLibs': bool_resource(0x10104ea),
@ -195,6 +196,7 @@ ANDROID_ATTRIBUTES = {
'multiprocess': bool_resource(0x1010013),
'name': str_resource(0x1010003),
'noHistory': bool_resource(0x101022d),
'pageSizeCompat': bool_resource(0x010106ab),
'pathPattern': str_resource(0x101002c),
'preferMinimalPostProcessing': bool_resource(0x101060c),
'required': bool_resource(0x101028e),

View File

@ -300,7 +300,7 @@ class build_apps(setuptools.Command):
self.android_version_code = 1
self.android_min_sdk_version = 21
self.android_max_sdk_version = None
self.android_target_sdk_version = 36
self.android_target_sdk_version = 35
self.android_manifest_file = None
self.gui_apps = {}
self.console_apps = {}

View File

@ -251,7 +251,7 @@ def create_aab(command, basename, build_dir):
entry.entry_id.id = entry_id
entry.name = res_name
for density, tag in (160, 'mdpi'), (240, 'hdpi'), (320, 'xhdpi'), (480, 'xxhdpi'), (640, 'xxxhdpi'):
for density, tag in (120, 'ldpi'), (160, 'mdpi'), (240, 'hdpi'), (320, 'xhdpi'), (480, 'xxhdpi'), (640, 'xxxhdpi'):
path = f'res/mipmap-{tag}-v4/{res_name}.png'
if (build_dir_fn / path).exists():
bundle.add_subfile('base/' + path, build_dir_fn / path, 0)

View File

@ -618,6 +618,9 @@ determine_page_size() const {
_page_size = (size_t)sysinfo.dwPageSize;
#elif defined(ANDROID)
_page_size = getpagesize();
#else
// Posix case.
_page_size = sysconf(_SC_PAGESIZE);

View File

@ -1906,6 +1906,11 @@ def CompileLink(dll, obj, opts):
cmd += " -march=armv7-a -Wl,--fix-cortex-a8"
elif arch == 'mips':
cmd += ' -mips32'
if arch.endswith('64'):
# See https://developer.android.com/guide/practices/page-sizes
cmd += ' -Wl,-z,max-page-size=16384'
cmd += ' -lc -lm'
elif GetTarget() == 'emscripten':