User Services/Try FMD

From MozillaWiki
Jump to: navigation, search

Get Find My Device Working

FxOS 2.0 Aurora and 2.1 Master

Requirement: build flashed after 15:36 PST - 7/10/2014

  1. On FxOS, goto Settings > Find My Device
  2. sign in with existing Firefox Account or create a new one, then enable FMD
  3. goto
  4. sign in with the same user as step #2
  5. It should locate your device

End-2-End Test

FindMyDevice end-to-end test with options!

  • launches desktopB2G and uses marionette.js to sign into FXA and enable FMD, leaves window open
  • launches webdriver to sign into FMD web site with the same FXA acct
  • tells you if your phone was located withing 60 sec (can be changed)
  • kicks off Ringer on each test
  • specify options: repeat test, FXA server, FMD server, test timeout



  • virtualenv recommended
  • gaia profile generated (if you need to, run make test-integration, then kill when tests begin)
$ mkvirtualenv fmdtest
$ pip install selenium fxa-python-client psutil gaiatest
  • Clone my repo/branch, create a new directory if you already have gaia
$ git clone
$ cd gaia
$ git checkout fmd-e2e-plus


  • if you run into a compiler flag not found error on OSX, you may need to export this env var
$ export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"

Run Test(s)

To see all options:

$ python -h

Example: run a test 3x:

$ python -r 3

optional arguments:

 -h, --help            show this help message and exit
 -x FXA_SERVER, --fxa-server FXA_SERVER
                       Enter path of Firefox Accounts server (default:https
 -f FMD_SERVER, --fmd-server FMD_SERVER
                       Enter the URL of the FMD server
 -g GAIA_DIR, --gaia-dir GAIA_DIR
                       Enter path of gaia dir
 -t TEST_TIMEOUT, --test-timeout TEST_TIMEOUT
                       Enter the test timeout in seconds (default:60)
 -r REPEAT, --repeat REPEAT
                       Enter the number of times to repeat test (default:1)
                       Enter path of selenium jar file



QA Flash Steps

clone this:

git clone


./ -w -g -G

choose gaia+gecko


Client side on device:

User Build

Enable Developer Menu:

  • Check this box: Settings > Device Information > Developer Menu
  • Then check the boxes for:
    • Settings > Developer > Gaia debug traces
    • You may be able to set this via pref: user_pref('browser.dom.window.dump.enabled', true);
    • Settings > Developer > Geolocation output in ADB
    • Then run this:
adb logcat | grep -e GEO -e findmydevice
  • Enable adb access:
    • Settings > Debugging via USB - set to 'ADB' or 'ADB and DevTools'

install adb on desktop then run

adb logcat

Engineering Build

Enabled verbose logging by enabling this:

  • Settings > Developer > Gaia debug traces.

install adb then run

adb logcat

For the web app, open Tools > Web Developer > Web Console

Geolocation data will print to console.

Custom FMD Server

If you want to flash FMD app to use a specific server, follow these steps:

Note: i haven’t been able to figure out if this can be done at runtime editable file vs build then flash. I wasn’t able to find any files with the fmd endpoint URI

Set FMD and Gaia URLS

$ git clone
$ cd gaia
Edit 3 files defined here:

$ make reset-gaia

If you want to confirm the URLs are written correctly to your phone.

adb shell
adb pull /system/b2g/webapps/

on desktop unzip and view


Set Firefox Account URL

1. set fxa to use stage servers download this:

$ chmod +x
$ ./ pull

edit prefs.js and add this to the bottom on it’s own line:

user_pref("identity.fxaccounts.auth.uri", "");

2. Run this

$ ./ push prefs.js

3. on Flame, sign into Fxa, verify email if needed, the verify link should be to…

Note: even if you have an existing account before, you may not have created one in the Stage Database. Just create it again.

4. sign into:

if you look in console i see and it correctly finds my location:

"device:updated" "2731a65040a15a6080c6b48d4231b4d9" Object { 
 hasPasscode: undefined, 
 latitude: 37.xx, 
 longitude: -122.xx, 
 altitude: 0,
 located: true, 
 time: Date 2014-06-20T21:48:46.000Z 
} "{"Latitude":37.xx,

ring, lost mode, erase all work as expected.

Set SimplePush URL

If you also need to use a staging or custom SimplePush server, follow same steps as for setting Firefox Account URL (see above) but add user_pref for "services.push.serverURL".

default setting is:

user_pref("services.push.serverURL", "wss://");

Low Memory Throttling

All testing should be done with a memory limit on the Flame. Run these cmds:

adb reboot bootloader  
*Device will restart*
fastboot oem mem 273
fastboot reboot

To see what you have it set to:

adb reboot bootloader
fastboot getvar mem

Note: There has been debate about 512MB vs 273MB, 273MB has been confirmed by tchung as the shipping memory target.

Test Servers

FMD uses 2 different apps, Firefox Accounts Settings/FirstTimeUse gecko level code. Which is what you use when you sign into firefox accounts. You can modify this endpoint by pushing user_pref onto your b2g device.

Find My Device - Settings has two endpoints: fxa-oauth and fmd app server which is in the Gaia layer. You can modify this endpoint by flashing a locally modified findmydevice.json Gaia to your phone.

Current 2.1 master src of truth:

Flash Gaia URLS

To set the URLS in Gaia, edit these files, and run make reset-gaia


Here's the last commit -

prod env

Default for 2.0 and 2.1 branches

stable env

dev env:

Must Flash Gaia URLS (see above)

stage env:

Must Flash Gaia URLS (see above)