Contained in the FIrefox OS Settings app is the Developer panel. This panel offers a number of options that can make debugging your open web app on Firefox OS easier. This article covers the options available and how to make use of them.
The Developer panel
The settings panel for developer options is intentionally buried deep to avoid having end users who have no need for these options inadvertently turning on options that make their device run more slowly or add strange visual effects to their displays. The panel looks something like this (the following is from a Geeksphone Keon running a late February 2014 build of Firefox OS 1.4; yours may differ if you are running a different version):
The developer panel is reached as follows:
- In Firefox OS <1.4, you open the developer panel via Settings > Device information > More Information > Developer.
- In Firefox 1.4+, you have to enable the developer panel via Settings > Device information > More Information > Check the Developer Menu checkbox. Once you've done this, you can then access the developer panel via Settings > Developer.
The following sections cover each of the options in the Developer panel, explaining what they do and why they're useful.
In newer versions of Firefox OS 1.4, tapping this section brings you to the Developer HUD selection view. There's a checkbox you can use to enable or disable the Developer HUD altogether (a section at the top of the Firefox OS UI for displaying developer information), and then five checkboxes to enable or disable:
- Errors: Displays console errors.
- Warnings: Displays console warnings.
- Reflows: Displays reflows as they occur.
- Frames per second: Displays frames per second, as explained in the Frames_per_second section below.
- Time to load: Displays time to load information, as explained in the Time_to_load section below.
Frames per second
Enabling this option reports three numbers in the top left of the Firefox OS display; the values reported are an average of recent results within a sliding window, meant to be "instantaneous" but fairly accurate. As such, all numbers are "guesses":
- The left number is the composition rate: the estimated number of times per second Firefox OS is drawing frames to the hardware framebuffer. This is an estimate of the user-perceived framerate, and only an estimate. For example, the counter may report 60 compositions per second even if the screen is not changing. In that case the user-perceived framerate would be 0. However, when used with this caveat in mind and corroborated with other measurements, the monitor can be a useful and simple tool.
- The middle number is the layer transaction rate, the estimated number of times per second processes are repainting and notifying the compositor. This number is mostly useful for Gecko platform engineers, but it should be less than or equal to the composition rate number on the left.
- The right hand number is a measure of the number of pixels drawn as a percentage of the screen size. A number of 273 means the screen was painted 2.73 times. Ideally this number should be as close to 100 as possible.
Time to load
Firefox OS also has a tool that can help measure startup time, specifically the "first paint" time. The value shown by the tool — in the top right of the Firefox OS display — is the elapsed time between when the most recent application was launched, and an estimate of the first time that application painted its UI, in milliseconds. This number only approximates the real "first paint" time, and in particular underestimates it. However, lowering this number almost always correlates to improvements in real startup time, so it can be useful to quickly measure optimization ideas.
Flash repainted area
In this mode, every time a region of the screen is painted by Gecko, Gecko blits a random translucent color over the painted region. Ideally, only parts of the screen that visually change between frames will "flash" with a new color. But sometimes more area than is needed is repainted, causing large areas to "flash". This symptom may indicate that application code is forcing too much of its scene to update. It may also indicate bugs in Gecko itself.
Draw layers borders
When this setting is enabled, a brightly colored border is added around all the different layers painted to the display — great for diagnosing layout issues.
Enable hardware compositing
When enabled, this setting causes the device to use its Hardware Composer to composite visual elements (surfaces) to the screen.
Log slow animations
This tool tries to help developers understand why animations are not offloaded to the compositor to be run efficiently as possible. It reports "bugs" like trying to animate elements that are too large, or trying to animate CSS properties that can't be offloaded. The messages you'll get on the device will look like the following:
I/Gecko ( 5644): Performance warning: Async animation disabled because frame size (1280, 410) is bigger than the viewport (360, 518) [div with id 'views']
The "Remote debugging" option enables support for remotely debugging your Firefox OS device. This also enables adb. In Firefox <1.4 there is only a single checkbox; in Firefox 1.4 there are three options available in a select box:
- Disabled: remote debugging is turned off (the default.)
- ADB only: Allows access to the device by ADB.
- ADB and Devtools: Allows access to the device by ADB and Firefox Devtools such as the App Manager.
Wi-Fi output in adb
Enabling this option adds information about Wi-Fi to the adb logs (error logs from the console can be accessed using
adb logcat | grep "Error" in the Terminal.)
Bluetooth output in adb
Enabling this option adds information about Bluetooth to the adb logs (error logs from the console can be accessed using
adb logcat | grep "Error" in the Terminal.)
Contacts debugging output in adb
Enabling this option adds debugging information about contacts to the adb logs (error logs from the console can be accessed using
adb logcat | grep "Error" in the Terminal.)
Enable software home button
Enabling this option creates a software home button that can provide the same functionality as the equivalent hardware button if it is not available. This is intended for future use on devices that are likely to not have hardware home buttons, like tablets.
Home gesture enabled
Enabling this option allows you to swipe upwards towards the center from outside the screen to bring up the homescreen. Again, this can provide the same functionality as the equivalent hardware button if it is not available, and is intended for future use on devices that are likely to not have hardware home buttons, like tablets.
Edges gesture enabled
Enabling this option allows you to swipe left and right from outside the screen towards the center, to navigate to the next and previous sheets (either web pages in the browser, or views inside another app.) This basically works like the browser navigator bar in Firefox.
Continuous transition enabled
This setting allows you to decide whether app keyboards open immediately or continuously (with a transition). Disabling such transition effects are useful on low end devices, when they cause performance to suffer.
Gaia debug traces
Enabling this directly enables DEBUG traces in Gaia; see bug 881672 for more details.
Note: Unfortunately, not every app supports this mechanism to print their debug log. Instead, they control a "DEBUG" flag in code directly, so enabling this flag does NOT ensure that you'll see all debug logs.
App transition enabled
Turn this on and then off again and you will disable all app closing/opening transitions: all apps will now just show immediately, without the smooth animation, and keyboards will also open/close without animation. Like "Continuous transition enabled", this is meant for improving performance on low end devices, but it has more of an effect.
Launch first time use
The "Launch first time use" button runs the first-time startup program; this lets you go through the initial setup and tutorial process, and is useful when trying to debug that process, or if you want to re-configure your device from scratch.
Show accessibility settings
This enables the accessibility settings menu, subsequently found at Settings > Accessibility. The options contained within are as follows:
Enabling this option turns on Firefox OS's screen reader. Currently at a very early stage, it changes the way the standard touch events work. For example, you can:
- Long press somewhere to focus that app (or whatever) and be alerted as to what it is, then double click to select it.
- Swipe from top to bottom to do a "tab" equivalent, moving sequentially through apps and being alerted to each one's name.
- Swipe from bottom to top to do "shift tab", moving sequentially backwards through apps and being alerted to each one's name.
A slider that controls how loud the speech is delivered.
A slider that controls how fast the speech is delivered.
Enable APZ for all content
When enabled, the Async Pan/Zoom module allows panning and zooming to be performed on asynchronously, on another thread, with some noticeable differences to rendering behaviour. To find out more, read the MozillaWiki APZ article.
Layers: Enable tiles
Layers: Progressive paint
Layers: Draw tile borders
- Center displayport:
- Assume perfect paints:
- Taller displayport:
- Faster paints:
- No checkerboarding:
This section lists settings that are no longer provided, or no longer exist in the same state, but might still be interesting if you are running an older version of Firefox OS.
In versions of Firefox earlier than newer 1.4 versions, this controls the accessibility settings, as explained in the Show_accessibility_settings section above.
The "Grid" option, when enabled, causes the Firefox OS display to be overlaid with a grid pattern to help you gauge positioning and alignment of items. For example, below we see the Browser app running with the Grid option enabled:
The grid's heavier lines are 32 pixels apart, both horizontally and vertically.
Show frames per second
In Firefox OS versions older than newer 1.4, enabling this displays frames per second, as explained in the Frames_per_second section above.
Show time to load
In Firefox OS versions older than newer 1.4, enabling this displays time to load information, as explained in the Time_to_load section above.
In Firefox OS versions older than newer 1.4, this option enables the new Firefox Rocketbar on your device, which provides a useful new way to switch between apps, search, and more. When enabled, you'll find a search icon at the top left of the device, and the RocketBar can be brought up by swiping from the top left of the device towards the bottom left.
Note: In newer versions of Firefox OS, Rocketbar is enabled automatically and cannot be turned off.
In addition to the developer-specific options listed above, Firefox OS < 1.4's developer settings featured keyboard layout options. These let you toggle on and off the then-experimental Chinese input methods:
As of Firefox 1.4, these options have been removed. This is because the Chinese keyboard layout implementations (zhuyin and pinyin) have now been completed.
Note: For other keyboard layouts still under development, such as Japanese, we now have a build-time config to opt them in.