Mobile/Fennec/Android/App Structure
Jump to navigation
Jump to search
Fennec is slightly more complicated than the average Android app, here's a brief overview of the most important components:
- Java code:
- Frontend: most of the Fennec specific UI, and also data storage code, i.e. most things that are Android specific
- mostly lives under mobile/android/base/*
- Services: firefox account code, and sync code
- mostly under mobile/android/services/*
- GeckoView: embeddable web browser widget, i.e. this lets us display web content within Android. Used to be extremely fennec specific, however there are efforts underway to make this reusable:
- Lives under mobile/android/geckoview/*
- Frontend: most of the Fennec specific UI, and also data storage code, i.e. most things that are Android specific
- Frontend javascript code: glue code between our Java UI and the gecko backend, it is used to control gecko and for interactions with web content. (We are able to push messages from Java->JS and JS->Java)
- Example: handling of link long-presses: gecko detects long-press, fires "contextmenu" event. This is handled in browser.js (part of the frontend javascript code), passed to "contextmenus.show()", which prepares the context menu content, that uses the (also JS based) prompt code, to fire a "Prompt:Show" event (which includes the menu content, as assembled earlier), that is then handled in PromptService.java on the Java/Android side. Finally that invokes our Prompt implementation which deals with creating the actual on-screen menu using Java/Android code.
- Many interactions involving web content are structured like this: gecko events are handled in our javascript glue code, before calling into the actually visible Java code.
- Largely under mobile/android/chrome/* and mobile/android/components/*
- A lot of generic browser code is in mobile/android/chrome/content/browser.js
- Example: handling of link long-presses: gecko detects long-press, fires "contextmenu" event. This is handled in browser.js (part of the frontend javascript code), passed to "contextmenus.show()", which prepares the context menu content, that uses the (also JS based) prompt code, to fire a "Prompt:Show" event (which includes the menu content, as assembled earlier), that is then handled in PromptService.java on the Java/Android side. Finally that invokes our Prompt implementation which deals with creating the actual on-screen menu using Java/Android code.
- Gecko: the actual web rendering engine, a mix of C++ and JavaScript code
- lives all over the repository, outside of mobile/