FxOS Geo Stumbling for Mozilla Location Service

Alphan Chen, FxOS System Team

Introduction

  • What is location service?
  • Introduction of Mozilla Location Service
  • Help MLS by stumbling

1-1

What is location service?

  • It is how your device knows where it is relative to the things around it, like WiFi access points and cell towers.
  • It is crucial in two conditions
    • There is no GPS signal.
    • You don't have a GPS chip. (e.g. laptop)
  • Right now, location services are not open services.

1-2

Mozilla Location Service

  • Built by Mozilla.
  • Give an open and trustworthy location service.
  • The database relies on the community to collect data.
    • The process of gathering data is called "stumbling".

1-3

Help MLS by stumbling

  • On Android, you can install "Mozilla Stumbler" app and start collecting data.
  • On FxOS, we need today's work to do the stumbling.

1-4

Right Person for MLS :)

1-5

Team: Services Engineering TE (Toby Elliott)

Cost Center: 3210 - Services and Engineering Operations

Stumbling

  • All data in the MLS database are contributed by user
    • The process of gathering data is called stumbling

> 15 KB

MLS Server

2-1

Upload

Stumbling

> 15 KB

MLS Server

2-2

Upload

Stumbling

Collect Data

> 15 KB

MLS Server

2-3

Upload

Stumbling

Write Stumble

> 15 KB

MLS Server

2-4

Upload

Stumbling

Upload Stumble

> 15 KB

MLS Server

3-1

Upload

Stumbling

Collect Data

Collect Data

3-2

3-3

Is there finished stumble?

Is the new location valid?

No

Yes

Exit

Try to upload finished stumble

Collect data

MozStumble

3-4

Yes

No

MozStumble

  • Validate new location
    • New locations need to be 30 meters and 3 seconds apart.
  • Collect data
    • Dispatch a runnable for scanning to main thread.

3-5

Runnable for scanning

  • Purpose:
    • Trigger a cell-tower scan.
    • Trigger a WiFi access point scan.
  • Implementation:
    • For cell-tower scan
      • Use "GetCellInfoList" with callback.
      • Set the number of expected Cell-Info responses.
    • For WiFi AP scan
      • Use "GetWifiScanResults" with callback.

3-6

Cell-Tower scan result callback

WiFi AP scan result callback

Prepare the string. (Location Info/Cell Network/WiFi AP)

Trigger a runnable to write stumble

3-7

> 15 KB

MLS Server

4-1

Upload

Stumbling

Write Stumble

Is there finished stumble?

Does finished stumble ready to upload?

Yes

No

Exit

Write stumble

Upload stumble

Write Stumble

4-2

No

Yes

Write Stumble

  • The status of finished stumble:
    • ExistsAndReadyToUpload:                                    Finished stumble exists and is older than 1 day.
    • Exists:                                                                       Finished stumble exists and is newer than 1 day.

4-3

Write Stumble

  • Write stumble
    • The maximum size of stumble is 15 KB.
    • Rename the file from stumbles.json.gz to stumbles.done.json.gz when it is bigger than 15KB.
  • Only one file exists at the same time.
    • stumbles.json.gz is for writing.
    • stumbles.done.json.gz is for uploading.

4-4

> 15 KB

MLS Server

4-5

Upload

Stumbling

stumbles.json.gz

> 15 KB

MLS Server

4-6

Upload

Stumbling

stumbles.done.json.gz

> 15 KB

MLS Server

4-7

Upload

Stumbling

stumbles.done.json.gz

> 15 KB

MLS Server

5-1

Upload

Stumbling

Upload Stumble

Is request successful?

Yes

Delete the finished stumble.

Do a XMLHttpRequest for uploading.

Upload Stumble

5-2

No

Keep the finished stumble. Retry to upload it next time.

Wait for the result

Upload Stumble

5-3

> 15 KB

MLS Server

5-4

Upload

Stumbling

Stumble Format

6-1

{"items":[

]}

location Information

cell-tower Information

WiFi AP Information

},

{

{

},

{

},

location information

cell-tower information

WiFi AP information

In the end

7-1

Future Work

  • A better event to trigger the upload. Ideally we would preferentially upload when connected to WiFi.

    • Currently we trigger the upload by a new location

      • Maximum upload currently: 15 KB per day.

      • Maximum attempt of upload is 20 times a day.

  • Solve the problem on QCT BSP
    • QC replaces "GonkGPSGeolocationProvider.cpp" with their implementation. They collect the data by themselves.
  • Show the contribution of stumbling to users

  • Follow-up bug: 1199093

7-2

Thanks.

Stumbler on B2G: alchen@mozilla.com

MLS server: hschlichting@mozilla.com

Q & A

number size
1 item (3 cellTowers, 63 WiFi AP) 609 bytes
20 - 30 15 KB

8-2

Privacy

8-3

FxOS Geo Stumbling for Mozilla Location Service

By Alphan Chen

FxOS Geo Stumbling for Mozilla Location Service

  • 964