Firefox OS/Remote Control Service: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎Introduction: Add how to enable in custom build)
(→‎Architecture Designs: Add service start/stop and MozSettings to Gecko preference)
 
Line 2: Line 2:
Remote control Service is the entry point of [[Firefox_OS/Remote_Control|Remote Control]] feature. This page will introduce how the service works in Gecko.
Remote control Service is the entry point of [[Firefox_OS/Remote_Control|Remote Control]] feature. This page will introduce how the service works in Gecko.


=== How to enable remote control in custom build ===
Bug: {{Bug|1197749}}
 
=== Enable remote control in custom build ===
Remote control is for Firefox OS TV, so it's only available when you add the following line to mozconfig:
Remote control is for Firefox OS TV, so it's only available when you add the following line to mozconfig:


Line 18: Line 20:
Use '''AppConstants.MOZ_B2G_REMOTECONTROLSERVICE''' in following file:
Use '''AppConstants.MOZ_B2G_REMOTECONTROLSERVICE''' in following file:
* b2g/chrome/content/settings.js
* b2g/chrome/content/settings.js
== Architecture Design ==
=== Service start/stop ===
# shell.html includes chrome://b2g/content/remote_control.js
# remote_control.js reads Gecko preference '''remotecontrol.service.enabled''', if true, start service
# remote_control.js monitors the preference to start/stop service
=== Gaia MozSettings mapping ===
User can use remote control app to start/stop service. But the app only write changes to MozSettings, service monitors Gecko preference to start/stop.
In settings.js, function '''setupRemoteControlSettings''' monitors MozSettings '''remote-control.enabled''' and write the value to Gecko preference '''remotecontrol.service.enable'''.

Latest revision as of 09:11, 13 January 2016

Introduction

Remote control Service is the entry point of Remote Control feature. This page will introduce how the service works in Gecko.

Bug: bug 1197749

Enable remote control in custom build

Remote control is for Firefox OS TV, so it's only available when you add the following line to mozconfig:

 ac_add_options --enable-remote-control-service

Gecko uses the macro MOZ_B2G_REMOTECONTROLSERVICE to enable remote control in following files:

  • b2g/app/b2g.js
  • b2g/installer/package-manifest.in
  • b2g/chrome/jar.mn
  • b2g/chrome/content/shell.html
  • b2g/moz.build
  • b2g/components/moz.build
  • toolkit/modules/AppConstants.jsm

Use AppConstants.MOZ_B2G_REMOTECONTROLSERVICE in following file:

  • b2g/chrome/content/settings.js

Architecture Design

Service start/stop

  1. shell.html includes chrome://b2g/content/remote_control.js
  2. remote_control.js reads Gecko preference remotecontrol.service.enabled, if true, start service
  3. remote_control.js monitors the preference to start/stop service

Gaia MozSettings mapping

User can use remote control app to start/stop service. But the app only write changes to MozSettings, service monitors Gecko preference to start/stop. In settings.js, function setupRemoteControlSettings monitors MozSettings remote-control.enabled and write the value to Gecko preference remotecontrol.service.enable.