Fennec/NativeUI/Architecture Overview
From MozillaWiki
It's always nice to have a bird's eye view of how something is working to help make it easier to understand. With that in mind here is quick summary of the current Java Fennec system. Please correct and add details where needed:
Overview
- Application UI is comprised mainly of Android Java and layout XML files found in /mobile/android/base
- GeckoApp.java and gecko_app.xml comprise the main UI.
- GeckoAppShell.java handles a lot of the non-visual tasks, like handling Android intents, starting the Gecko thread, communicating with Gecko through JNI and messaging.
- The Java compositor, used to handle panning and zooming web content is found in /mobile/android/gfx
- XUL/JS and still used primarily as a communication shim from the Gecko platform to the Java UI.
- browser.js and browser.xul create a <deck> of <browser>s for only displaying the web content.
- Some helpers in browser.js are used to communicate network activity and mouse gestures to Java. More helpers will be needed for adding support for different Gecko features. Easily poached from the XUL-based code.
- A JSON based message system is used to send messages from XUL to Java. nsIAndroidBridge is the XPCOM object that makes this happen, but the messages are just forwarded to GeckoAppShell and routed out to Java from there.
- An event based message system is used to send messages from Java to XUL. From Java, you create a GeckoEvent with a subject and data strings. This is sent to XUL as an nsIObserver notification.
Interaction with Other Teams
- L10N: Localization of the native UI can work very similar to how we localize Java UI parts now. Even that could be made easier though. The bigger issue is the affect of native UI on the dynamic way we can change localizations of the XUL UI without being locked or affected by the OS locale. I mean, Firefox Mobile (XUL) can be launched in a locale that isn't even shipped with the OS itself. This ability might be affected.