Skip to content

[Android] Add support for 16 KB page sizes, update to NDK r28b #106358

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

Merged
merged 1 commit into from
May 15, 2025

Conversation

m4gr3d
Copy link
Contributor

@m4gr3d m4gr3d commented May 13, 2025

Bump the NDK to version 28.1.13356709; doing so automatically adds support for 16kib page to the Godot Android shared libraries. See https://developer.android.com/guide/practices/page-sizes#compile-16-kb-alignment for details.

Fixes #106313

This PR, alongside #106152 and #105611 should be cherry-picked to previous releases to provide similar support for 16kb page sizes.

Doing so automatically adds support for 16kib page to the Godot Android shared libraries.
See https://developer.android.com/guide/practices/page-sizes#compile-16-kb-alignment for details.
@m4gr3d m4gr3d requested a review from a team as a code owner May 13, 2025 15:34
@m4gr3d m4gr3d requested a review from a team as a code owner May 13, 2025 15:34
@m4gr3d m4gr3d added topic:buildsystem topic:export cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels May 13, 2025
@m4gr3d m4gr3d added this to the 4.5 milestone May 13, 2025
m4gr3d added a commit to m4gr3d/godot that referenced this pull request May 13, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
m4gr3d added a commit to m4gr3d/godot that referenced this pull request May 13, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
@Alex2782
Copy link
Member

Do we still have to test it?
https://developer.android.com/guide/practices/page-sizes#test

@m4gr3d
Copy link
Contributor Author

m4gr3d commented May 13, 2025

Do we still have to test it?
https://developer.android.com/guide/practices/page-sizes#test

I did a quick test building the Android editor and running it on an Android device, but yes more tests would be good!

@Alex2782
Copy link
Member

Alex2782 commented May 15, 2025

adb shell getconf PAGE_SIZE

Have you changed your device to 16 KB via developer options?


There are 4 Android 15 devices on Firebase Test Lab, all running in 4 KB mode.
Pixel 9 Pro XL, Pixel 9, Lenovo Tab P12, Pixel 8.

We can probably take our time with this (Q4 2025 ?), Android 16 will have a 16 KB page size compatibility mode
https://developer.android.com/about/versions/16/behavior-changes-all#16-kb-compatibility-mode

I have a Pixel 8a with Android 15, so I could switch to 16 KB. But that requires a reboot, and I'm currently unsure whether all the apps that are essential in everyday life will run smoothly. I'll continue with an emulator for now; there's a special image for 16KB.


C++ page_size check (UNIX only)
#include <unistd.h>

Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_phase) {
	Thread::make_main_thread();
	set_current_thread_safe_for_nodes(true);

    int page_size;

#ifdef _SC_PAGESIZE
    page_size = sysconf(_SC_PAGESIZE);
#else
    page_size = getpagesize();
#endif
    print_line("Main::setup page_size: ", page_size);

Copy link
Member

@syntaxerror247 syntaxerror247 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!
Did some tests with Android Editor, everything seems to work correctly.

@akien-mga akien-mga changed the title [Android] Add support for 16 KB page sizes [Android] Add support for 16 KB page sizes, update to NDK r28b May 15, 2025
@m4gr3d
Copy link
Contributor Author

m4gr3d commented May 15, 2025

Have you changed your device to 16 KB via developer options?

@Alex2782 I also validated the update using the script provided by Google at https://developer.android.com/guide/practices/page-sizes#alignment-use-script.

@Repiteo Repiteo merged commit 82ea0b9 into godotengine:master May 15, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented May 15, 2025

Thanks!

@m4gr3d m4gr3d deleted the update_ndk_28 branch May 15, 2025 15:38
m4gr3d added a commit to m4gr3d/godot that referenced this pull request May 15, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
DuartePonce added a commit to DuartePonce/godot that referenced this pull request Jun 2, 2025
added some tests for favorite_property

fixed whitespaces and wrong line positioning

fixed identaion on test

fixed identation mistake

same as last

i dont understand why its not passing

another try

fixed finally

fixed finally v2

feito vamos ver onde morre na pipeline

feito vamos ver onde morre na pipeline

feito vamos ver onde morre na pipeline

feito vamos ver onde morre na pipeline

cenas da vida

Wayland: Fix window fitting in single-window mode

We disabled window fitting in multi-window mode as it was broken due to
the limited data but it should still be enabled for embedded windows.

Fix MovieWriter window title in embedded mode.

Fix highlighting warning and error issues related to Godot editor.

Fix Issue godotengine#104413 : Add a limit of 20 lines of warning highlight otherwise paint the background of the first line only.
Fix Issue godotengine#106278 : Extract the logic from clearing and setting background lines from _update_errors() and _update_warnings() to _update_background_text().
Fix Issue godotengine#83979 : Added signal for folding/unfolding lines (fold_lines_updated).
Feature: Highlight the folded line using signals connected to _update_background_text() to keep the editor visuals up to date. The background is set in the following priority order: Error, Warning, then Highlight background.

Remove the option to compress Android native libraries

Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.

Fix for implicit conversion from char16_t to char32_t

Improve performance with non-monitoring areas when using Jolt Physics

Metal: Ensure stencil-only rendering is supported

Closes godotengine#106652

Fix Heap buffer overflow in Animation::_find()

Fixes godotengine#106647

Use a fragment shader copy instead of a blit copy in the final blit to screen in the Compatibility renderer to avoid black screen when "Force MSAA 4x is used" on Android devices

Simplify use of `LocalVector` `force_trivial` template parameter.

Adjusted get_median_from_3 and partitioner to also retrieve the pivot's index and check if either end of the partitioner has reached it to avoid comparing things with themselves

Improve SVGTexture lazy loading.

Fix `GodotApplicationDelegate` init.

Fix print/error ordering issue in editor Output

Relax the requirements for making EditorImportPlugin

Use Grisu2 algorithm in String::num_scientific to fix serializing

Use LocalVector for RingBuffer

Updated RingBuffer to use LocalVector instead of Vector, to avoid _copy_on_write overhead when writing to the buffer.

Adjust LOD selection metrics to use attribute error

- Revert meshoptimizer patch; the metric used for LOD selection now
incorporates attribute error
- Since LOD selection is now aware of attribute deviation, we don't
need to use a higher normal weight
- To prevent normal creases from creating input triangles with very
large normal deviation, reduce default normal merge threshold
- Since we now use combined metric to select LODs, we never need LODs
with error>1 as these should not be selected if the mesh is visible.

Fix crash on exit due to GDScript CallStack mismatched deallocation

Metal: Fix crash when clearing render buffers

Fix `execute_with_pipe` / `create_process` exit code.

Add new StandardMaterial properties to allow users to control FPS-style objects (hands, weapons, tools close to the camera)

Add new shader built in Z_CLIP_SCALE to easily adjust clipping distance to avoid clipping walls etc.

Add fov_override to StandardMaterial3D to easily have a custom FOV for FPS objects

Add IN_SHADOW_PASS built-in to shaders for tweaking materials without impacting shadow maps

Full Theora video support in VideoStreamPlayer

- Implement `set_stream_position` and `get_stream_length`.
- Don't show blank frame when stopping the video (smooth loops).
- Fix audio for videos with up to 8 channels.
- Improve internal audio handling.

Shader: Fix the default behavior when mat uniforms are null

`SceneTreeFTI` faster access to `Node` children

Clarify `String.is_subsequence_of()` working differently from `String.contains()`

`is_subsequence_of()` has very different behavior from `contains()`.

Fix backtrace reporting wrong line numbers in release exports

Ignore destination alpha when blitting to window in compatibility renderer

GDScript: Do phrase level recovery for match

Remove error for degenerate soft body faces when using Jolt Physics

`EditorResourcePicker`: Add `Quick Load` button

Add mid height property to CapsuleShape2D/3D

Fix heap-use-after-free when closing a scene with 2D particle nodes selected

Update meshoptimizer to v0.23

Also remove the reference to a patch that was removed in a prior commit.

This includes improvements to simplification wrt attribute metric for certain
edge cases.

Add correct cursors when scaling bezier keys with box scaling

Mobile: Move _setup_lightmaps before _fill_render_list

Don't hard-code test path when deleting test data

Simplify implementation of errarray.

Make FindInFiles globally accessible

- Make ScriptEditor expose open_find_in_files_dialog to allow opening from anywhere
- Add FindInFiles to EditorNode as a keyboard shortcut, command, and menu option
- Change all find_in_files commands to be editor/find_in_files

FTI - Optimize `SceneTree` traversal

Update time.cpp year/unix time conversions to be constant time

Added functions to convert between year and day from unix timestamps in constant time, to avoid having to iterate one year at a time.

Change `JoltShapeInstance3D` to use move semantics

Change fuzzy search to only set case sensitive within set_query

Fix `option_button.cpp` not updating selected when out of bounds

Implement `get_filesystem_type` on macOS and Linux.

Add feature hint string and "On" text for checkable groups

Move compatible functionality from `GDCLASS` to `GDSOFTCLASS`.

project_manager: Display last edited time using local timezone instead of UTC

C#: Expose byte array compress and decompress

Theora: Fix UV channel offset when cropping region

Implement method lookup for method tracks

fix: Editor, save script file: Triple quote string: spaces are converted into tabs

Do not activate accessibility when screen reader detection failed.

Queue hover update when creating TreeItem

Add hardcoded baseline offset for Apple Color Emoji.

TileSet: Prevent crash in conversion of invalid tiles from Godot 3.x

Fixes godotengine#80898.

Reintroduce the dragging method of Sprite2D's region_rect

Fix Android editor UI

Add SMAA 1x

Fix MenuBar min size not updating after child rename

Fix: Windows OS.get_unique_id() null termination issue
use ascii for encoding-neutral
check buffer size as well

Optimize and simplify sarray.

Physics Interpolation - Add editor configuration warnings

* For physics bodies that are on non-interpolated branches

Fix Ignore External Changes Bug

Fix Issue godotengine#106410 : Add a new list `disk_changed_scenes()` and a boolean `disk_changed_project` to keep track of modfied scenes and the project. Save them only if they are in the list or the boolean value is true, when ignoring external changes.

Expose helper methods for converting UIDs

Allow running EditorScripts from the FileSystemDock

Apply suggestions from code review

Co-Authored-By: Tomasz Chabora <[email protected]>

Android: Add export option for custom theme attributes

- Regenerates the `GodotAppMainTheme` and `GodotAppSplashTheme` during Android export. Any manual changes to these styles will be cleared and replaced with default theme attributes.

- Adds a new export option `gradle_build/custom_theme_attributes` for injecting custom theme attributes directly via the export window, avoiding the need to manually modify themes.xml.

Simplify `Memory::memnew_arr_placement` to always initialize memory, to force callers to make the decision of whether to initialize.

Metal: Disable MetalFX Temporal for `mobile` rendering method

It isn't supported, as `mobile` can't provide motion vectors. We can
revisit once it is supported via godotengine#100283.

Use OkHSV for rainbow labels.

Add functions to apply impulse and force to SoftBody on GodotPhysics and JoltPhysics

Fix ios and android plugin always invalid due to null ConfigFile

OpenXR Futures: Add return value support

unfavorite all fixed

unfavorite all fixed

unfavorite all fixed
DuartePonce pushed a commit to DuartePonce/godot that referenced this pull request Jun 6, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
@skyace65
Copy link
Contributor

skyace65 commented Jun 7, 2025

Whenever this PR gets cherrypicked, this doc PR should be marked for cherrypicking: godotengine/godot-docs#10998

goatchurchprime pushed a commit to goatchurchprime/godot that referenced this pull request Jun 10, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
dsmtE pushed a commit to dsmtE/godot that referenced this pull request Jun 17, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
spanzeri pushed a commit to spanzeri/godot that referenced this pull request Jun 25, 2025
Follow-up to godotengine#106358, this is a separate commit / PR since it shouldn't be cherry-picked in previous releases as it removes existing functionality.

Support for 16kb page size added in the previous PR requires the native libraries to be uncompressed, so we're deprecating and removing the option to compress native libraries.
See https://developer.android.com/guide/practices/page-sizes#agp_version_851_or_higher for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release enhancement platform:android topic:buildsystem topic:export
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Android: Native libraries not aligned to support devices with 16 KB memory page sizes
6 participants