From MozillaWiki
Jump to: navigation, search
Stop (medium size).png
The Marketplace has been placed into maintenance mode. It is no longer under active development. You can read complete details here.

OpenMobile ACL and Marketplace


OpenMobile's Application Compatibility Layer (ACL)™ enables Android apps to run on non-Android operating systems. Specifically in our case, Firefox OS.

The flow is unfortunately rather complicated and involves Marketplace. Only specific devices can work with the whole thing, because it needs some code from OpenMobile on the device on top of the code that we install via Marketplace. In addition, some specific gecko patches are required.

There are 3 parts:

  • GSL is the Generic Service Loader. It's the OpenMobile code that lives on compatible devices. It's already installed by the manufacturer.
  • ACL is the Application Compatibility Layer. It's also OpenMobile code, but it is installed dynamically on the devices via Marketplace when an app relying on it is launched. It's an app itself, so the rest of this doc calls it "ACL app" sometimes.
  • The app that the end-user wants to use. It's wrapped into a special kind of webapp that includes the Android APK and some code to download the ACL to make everything work.

Install Flow

When the user launches their app, the app checks if an ACL is present and if not, calls a marketplace-openmobile-acl WebActivity to install one.

When the activity is trigged, the package passes down the value of getFeature('acl.version') to the activity message it sends the iframed code (necessary because getFeature() is a privileged API).

The iframed code (webactivites.js) then parses the acl_version parameter that the package sent. It's in the following form: DEVICE;PRODUCT;MODEL;GSL_VERSION;<ACL_VERSION>

If ACL_VERSION exists, then it means an ACL is already installed and the activity returns an error.

Otherwise, it checks PRODUCT to determine which ACL app to install, and manually triggers the install of the ACL app. Since that means downloading a big package, it shows the ACL app detail page with its install button spinning to make the user wait.

Once the install of the ACL app is done, Marketplace launches the ACL app and let the activity return successfully to its caller.

The activity also returns an error to its caller if anything goes wrong: unknown PRODUCT, install failure, etc.

Checking for compatibility

We don't want to show apps requiring an ACL to devices without a GSL - since both components are necessary it would not work. Therefore, we have a feature flag that's enabled when getFeature('acl.version') returns something. That feature flag is hidden to regular developers but available for admins to change in the devhub.

Faking ACL/GSL presence

Through adb shell setprop persist.acl.version<code>, we can set the value returned in <code>getFeature("acl.version") calls, allowing us to pretend a GSL and/or an ACL are installed:

# Double quotes are necessary for adb, Single quotes around it are to prevent
# your own shell from parsing the double quotes for itself.
$ adb shell setprop persist.acl.version '";P172R12"'

# Check that everything works is correct by doing:
$ adb shell getprop persist.acl.version

Remember: when manipulating the string via adb, you need the persist. prefix, but it's not used when calling getFeature().