Mobile/Fennec/Android/App Structure

From MozillaWiki
< Mobile‎ | Fennec‎ | Android
Jump to: navigation, 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. This used to be extremely fennec specific, however there are efforts underway to make it reusable in other apps:
      • Lives under mobile/android/geckoview/*
  • 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)
    • 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.
      • Example of JS+Java interaction: gecko detects a long-press on a link, and fires the "contextmenu" event. This is handled in browser.js (part of the frontend javascript code), passed to "contextmenus.show()". This prepares the context menu content (e.g. the share/open in new tab/open in private tab/etc items), and passes the menu to the Prompt code (also in JS), which fires a "Prompt:Show" event (which includes the menu content, as assembled earlier). That event is then handled in PromptService.java on the Java/Android side. It invokes our Prompt implementation which deals with creating the actual on-screen menu using Java/Android code.
    • Largely under mobile/android/chrome/* and mobile/android/components/*
    • A lot of generic browser code is in mobile/android/chrome/content/browser.js
  • Gecko: the actual web rendering engine, a mix of C++ and JavaScript code
    • lives all over the repository, outside of mobile/

Android and Java code components

Content Providers

Sync

Messaging and components across boundaries

TODO: describe JS <-> Java messaging

Search engine management

TODO: describe this