Closed Bug 984559 Opened 11 years ago Closed 7 years ago

Installed certified app's sms/telephony related callbacks doesn't get called

Categories

(Core :: DOM: Device Interfaces, defect)

28 Branch
Other
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: mdas, Unassigned)

References

Details

For oem certification testing, we're pushing a certified app with all permissions to the phone. It has access to certified/privileged only APIs like mozSettings, mozSms etc., but their callback handling is not functioning correctly. For example, if we assign a callback to window.navigator.mozMobileMessage.onreceived, the callback does not get called. We can use mozSms to send a message and it arrives on the other phone, but onsent doesn't work either. MozTelephony's callbacks are also not being called.

Here's the app's manifest: https://github.com/mozilla-b2g/fxos-certsuite/blob/master/webapi_tests/device_setup/manifest.webapp

Here's the code that installs the app: https://github.com/mozilla-b2g/fxos-certsuite/blob/master/webapi_tests/device_setup/app_install.js

Here's an example test: https://github.com/mozilla-b2g/fxos-certsuite/blob/master/webapi_tests/webapi_tests/sms/test_incoming.py, and here's the onreceived callback: https://github.com/mozilla-b2g/fxos-certsuite/blob/master/webapi_tests/webapi_tests/sms/sms_test.py#L11

=========

To reproduce it, pull down https://github.com/mozilla-b2g/fxos-certsuite, go into the webapi_tests directory, and modify https://github.com/mozilla-b2g/fxos-certsuite/blob/master/webapi_tests/setup_and_run.sh#L50 to read "marionette --address=localhost:2828 webapi_tests/sms/test_incoming.py" (so you just run the test in question, not the full suite). If you have a production build in your phone, you need to run "source install_marionette_extension.sh", but if you have an eng build, skip running that script.

Now, run "source setup_and_run.sh", which will push the certified app to your phone and run the sms test. When the test runs, it will ask you to send an sms to your phone. After you do that, it will eventually fail because the onreceived function is not called.
We're testing against 1.3
Version: Trunk → 28 Branch
No longer depends on: b2g-cert-tests
Fabrice, do you know who owns this stuff these days?  Thanks!
Flags: needinfo?(fabrice)
Vicamo?
Flags: needinfo?(fabrice) → needinfo?(vyang)
(In reply to Malini Das [:mdas] from comment #0)
> For oem certification testing, we're pushing a certified app with all
> permissions to the phone. It has access to certified/privileged only APIs
> like mozSettings, mozSms etc., but their callback handling is not
> functioning correctly. For example, if we assign a callback to
> window.navigator.mozMobileMessage.onreceived, the callback does not get
> called. We can use mozSms to send a message and it arrives on the other
> phone, but onsent doesn't work either.

Bug 952875.

> MozTelephony's callbacks are also not being called.

I think that should be ok, or no one can ever pick up an incoming call.  Need some more investigation.  Thank you.
Depends on: 952875
Flags: needinfo?(vyang)
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #4)
> (In reply to Malini Das [:mdas] from comment #0)
> > For oem certification testing, we're pushing a certified app with all
> > permissions to the phone. It has access to certified/privileged only APIs
> > like mozSettings, mozSms etc., but their callback handling is not
> > functioning correctly. For example, if we assign a callback to
> > window.navigator.mozMobileMessage.onreceived, the callback does not get
> > called. We can use mozSms to send a message and it arrives on the other
> > phone, but onsent doesn't work either.
> 
> Bug 952875.
> 
> > MozTelephony's callbacks are also not being called.
> 
> I think that should be ok, or no one can ever pick up an incoming call. 

Yup, I feel the same as Vicamo. The API should work fine, otherwise we cannot even answer a call that is very easy to tell on a real device.

> Need some more investigation.  Thank you.

Could you please share more details of the telephony test part? When you said Telephony's callback isn't called, what were the detailed steps, e.g. for incoming calls or outgoing calls? Did you also try to make a call via this App? Or before a new incoming call comes, is this App already launched? ... etc.

I noticed that the system message "telephony-new-cal" hasn't been added into the manifest. That could be a reason because the App won't be launched without this message.
Hi Hsin-Yi,

Regarding telephony, I just made a simple test that sets up a callback for an incoming phone call, and checks for the mozTelephony.onreceived event. Then after the callback is setup, I make a manual call to the Firefox OS device from a different phone, and I answer the call on the Firefox OS device - the call is received and answered fine, however the mozTelephony.onreceived event is never found.

The test (basic test in progress) is here:

https://github.com/rwood-moz/fxos-certsuite/blob/webtelephony/webapi_tests/webapi_tests/telephony/test_incoming.py

... and the callback is here:

https://github.com/rwood-moz/fxos-certsuite/blob/webtelephony/webapi_tests/webapi_tests/telephony/telephony_test.py#L16

Regards,

Rob
(In reply to Robert Wood [:rwood] from comment #6)
> however the mozTelephony.onreceived event is never found.

Because we don't have "mozTelephony.onreceived".  Please see http://dxr.mozilla.org/mozilla-central/source/dom/webidl/Telephony.webidl
(In reply to Malini Das [:mdas] from comment #0)
> For oem certification testing, we're pushing a certified app with all
> permissions to the phone.

Kind of off the topic here, but do we really need an off-tree certificate app?  Experience tells me that chances are it will be left behind very soon and becomes totally unusable.  See 930839.  Can't we use existing Marionette/Mochitest thing to verify a physical device?
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #8)
> (In reply to Malini Das [:mdas] from comment #0)
> > For oem certification testing, we're pushing a certified app with all
> > permissions to the phone.
> 
> Kind of off the topic here, but do we really need an off-tree certificate
> app?  Experience tells me that chances are it will be left behind very soon
> and becomes totally unusable.  See 930839.  Can't we use existing
> Marionette/Mochitest thing to verify a physical device?

Marionette will need to have an app context to run in, and we don't have a guarantee that the OEMs will be using Gaia as we package it. Also, for OEM testing, they need to have a certified app with all privileges enabled, and there is no Gaia app that has *all* permissions enabled. The OEMS give us no guarantee that they'll run all the Gaia apps (or even use Gaia at all), so we need to package our own certified app to use are our test environment. This lets our app work on all the devices our OEMs want to run on without any additional requirements on their end.
Thanks Vicamo - the telephony test works now that I corrected the event name (my apologies!!). Still not sure why the SMS events are not being received though, am I missing something there also?
(In reply to Robert Wood [:rwood] from comment #10)
> Thanks Vicamo - the telephony test works now that I corrected the event name
> (my apologies!!). Still not sure why the SMS events are not being received
> though, am I missing something there also?

From Bug 952875, apparently we need to do the following:
"The callback of handleReceivedMMS(e) will never be invoked unless we add this snippet code before line#2:
    mm.getThreads();"

Can you try that out and comment on that bug with the results?
where var mm = navigator.mozMobileMessage;
Yes with that work-around the SMS tests do receive the events. I will update the SMS and Telephony tests. Thanks Malini, Vicamo, appreciated!
(In reply to Malini Das [:mdas] from comment #9)
> (In reply to Vicamo Yang [:vicamo][:vyang] from comment #8)
> > (In reply to Malini Das [:mdas] from comment #0)
> > > For oem certification testing, we're pushing a certified app with all
> > > permissions to the phone.
> > 
> > Kind of off the topic here, but do we really need an off-tree certificate
> > app?  Experience tells me that chances are it will be left behind very soon
> > and becomes totally unusable.  See 930839.  Can't we use existing
> > Marionette/Mochitest thing to verify a physical device?
> 
> Marionette will need to have an app context to run in, and we don't have a
> guarantee that the OEMs will be using Gaia as we package it. Also, for OEM
> testing, they need to have a certified app with all privileges enabled, and
> there is no Gaia app that has *all* permissions enabled. The OEMS give us no
> guarantee that they'll run all the Gaia apps (or even use Gaia at all), so
> we need to package our own certified app to use are our test environment.
> This lets our app work on all the devices our OEMs want to run on without
> any additional requirements on their end.

So it sounds like the only thing we need is to create an empty, certificated app, which is actually the test-container we have in Gaia?
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #14)
> So it sounds like the only thing we need is to create an empty, certificated
> app, which is actually the test-container we have in Gaia?

Similar, but the test-container app doesn't have all the permissions we need. Here's the manifest for the test-container: https://github.com/mozilla-b2g/gaia/blob/v1.3/test_apps/test-container/manifest.webapp and here's our certified app with all permissions: https://github.com/mozilla-b2g/fxos-certsuite/blob/master/webapi_tests/device_setup/manifest.webapp.
^we're using this certified app with all permissions to do webapi testing
(In reply to Malini Das [:mdas] from comment #16)
> ^we're using this certified app with all permissions to do webapi testing

Yes.  I mean we can just extract Gaia test-container app code into a stand-alone repository and add whatever permissions you need.  That certificate app should contain only permission declarations.  Nothing more.  An even more ideal case for me is that it then replaces the in-tree test-container app in gaia/.  For every device, inclusive of emulators, install that empty certificate app and go running all existing Marionette/Mochitest test scripts available.  How do you think?
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #17)
> Yes.  I mean we can just extract Gaia test-container app code into a
> stand-alone repository and add whatever permissions you need.  That
> certificate app should contain only permission declarations.  Nothing more. 
> An even more ideal case for me is that it then replaces the in-tree
> test-container app in gaia/.  For every device, inclusive of emulators,
> install that empty certificate app and go running all existing
> Marionette/Mochitest test scripts available.  How do you think?

Sounds reasonable to me, as part of https://bugzilla.mozilla.org/show_bug.cgi?id=970620#c5, I'd like to have that repository not just include a certified app, but the code to generate an app with any number of permissions you need.
If we do this, though, would eng builds of gaia require pulling down this new repository? I'm not sure how to pull in the new repository so that we can remove the test-container app in gaia.
To elaborate more, the new repo can contain both the app generator (to create an privileged/non-privileged/certified app) and will also include the installation code. Installing a certified app after flashing a phone is possible so long as we have access to devtools.
(In reply to Vicamo Yang [:vicamo][:vyang] from comment #17)
> Yes.  I mean we can just extract Gaia test-container app code into a
> stand-alone repository and add whatever permissions you need.  That
> certificate app should contain only permission declarations.  

The appgen code is now https://github.com/mozilla-b2g/fxos-appgen and provided as 'fxos_appgen' on pypi.

I'm unfamiliar with how test-container is used, so I don't know what the preferred way is to use this to replace the test-container in Gaia (whether to use it to generate the test-container and push it into the repo so it gets installed on flash, or use fxos_appgen before running the tests to create and install the test-container dynamically) but it'd be best if you can start a new bug about that with your ideas or CC'ing who would know, if you don't mind?
btw, fxos_appgen both generates and can install the app on the phone at any time (ie: after flashing), including certified apps.
No longer depends on: 952875
No longer blocks: b2g-cert-tests
Cleaning up Device Interfaces component, and mass-marking old FxOS bugs as incomplete.

If any of these bugs are still valid, please let me know.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.