Android System Font Iterator Bug Hunt: A Tale of Hidden Symbols

2025-06-02

This blog post recounts a surprisingly lengthy bug fix. Android defines different API levels, with some symbols only available from a specific version. Firefox for Android (Fenix) uses `ASystemFontIterator_open`, available only from API 29. For backward compatibility, Fenix uses `__ANDROID_UNAVAILABLE_SYMBOLS_ARE_WEAK__` and `__builtin_available` for compile-time and runtime checks. However, Firefox's build system defaults to hidden visibility (`-fvisibility=hidden`), causing the weak symbol `ASystemFontIterator_open` to become undefined in the shared library, leading to crashes. The fix was a simple change to temporarily alter the default visibility when including Android system headers.

Development Bug Fix