Closed Bug 915611 Opened 11 years ago Closed 10 years ago

[Bluetooth] Cannot receive 'bluetooth-pairing-request' system message callback in the first time, if we use bluetooth inline pairing.

Categories

(Firefox OS Graveyard :: Gaia::Settings, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(b2g-v1.3T affected)

RESOLVED WORKSFORME
Tracking Status
b2g-v1.3T --- affected

People

(Reporter: iliu, Unassigned)

References

Details

(Whiteboard: [sprd295117])

STD:
0. Don't launch settings app
1. Launch gallery and select a picture
2. Share the picture via bluetooth
3. Turn on Bluetooth in bluetooth file transfer app
4. Select an unpaired device for pairing and sending file
Just followed the STR and I can reproduce. Under this circumstances, Gecko Bluetooth did broadcast the right system message up to Gaia, but somehow the message didn't arrive in Gaia right away. I tried to dump logs from SystemMessageInternal.js / SystemMessageManager.js, but unfortunately the issue was unable to be reproduced in this case.
See Also: → 859168
Quick update: cannot reproduce with today's build on Nexus 4.
I can reproduce by using today's build with Unagi.
= Scenario =
bluetooth-pairing-request would be broadcasted during a inline-pairing process, which can be triggered by sending a photo from Gallery to a non-paired remote Bluetooth device. Please note that Settings app can't be launched beforehand, and we expect it should be launched after it gets bluetooth-pairing-request, unfortunately it won't.

= Log (I enable the debug mode of SystemMessage manually) =
12-23 15:55:00.767 I/GeckoBluetooth(  108): Notify: [S] Notify: RequestConfirmation
12-23 15:55:00.767 I/Gecko   (  108): -- SystemMessageInternal 1387785300785 : Broadcasting bluetooth-pairing-request {"address":"A8:26:D9:DF:64:7A","method":"confirmation","passkey":738961,"name":"EricChou"}; extra = undefined
12-23 15:55:00.787 I/Gecko   (  108): -- SystemMessageInternal 1387785300796 : Acquiring a CPU wake lock for page key = N1mFHp75Jx2zqEIlQ8WqGIamK7k=
12-23 15:55:00.787 I/Gecko   (  108): -- SystemMessageInternal 1387785300803 : Returned status of sending message: 2
12-23 15:55:00.787 I/Gecko   (  108): -- SystemMessageInternal 1387785300803 : _getMessageConfigurator for type: bluetooth-pairing-request
12-23 15:55:00.787 I/Gecko   (  108): -- SystemMessageInternal 1387785300804 : Asking to open {"uri":"app://settings.gaiamobile.org/index.html#root","manifest":"app://settings.gaiamobile.org/manifest.webapp","type":"bluetooth-pairing-request","onlyShowApp":false,"showApp":false}

Then nothing happened.
Have talked to Gene. He is looking into it.
Update: This also happens in v1.3. I kept hitting this when tried to reproduce bug 952212.
Just had an initiative diagnosis, the 'open-app' can be fired to the Gaia bug but the initSystemMessageHandler() in connectivity.js isn't triggered. Need to look into this from the Gaia side.
Thanks, Gene. Reset component to Gaia::Settings per comment 7.
Component: Bluetooth → Gaia::Settings
initSystemMessageHandler() is called only when idle. Maybe there is something wrong with the idleObserver. Need to do further survey.
I found that IdleObserver does not work for apps running in background. I also try to launch settings app at first, and then back to home screen after the system message handler initialized. In which the settings app still not got any system message when pairing. (Note that the messages were still in the queue. It received multiple messages when I brought settings app to foreground)

Gene, is there any difference on handling system messages and idle observer for apps running in background?
Flags: needinfo?(gene.lian)
Hi Arthur, would you please come by to have a discussion tomorrow? Thanks!
Hi Arthur and Gene,

This bug has been reported for several times. I really want to help and cooperate with you guys to get this solved. Please count me in when you have a discussion. Thank you.
We can still meet this issue on tarako.
Flags: needinfo?(fabrice)
Whiteboard: [sprd295117]
Gene, do you remember if you actually discussed that after comment 11?
Flags: needinfo?(fabrice)
I'll ping Arthur. Thanks for the reminder.
Flags: needinfo?(gene.lian)
This seems a duplicate of bug 989742, in which settings app was killed when OOM. After bug 989742 landed, the bluetooth app handles the pairing request. In v1.3t, the bluetooth app runs in the b2g process and has a simpler request handling path, which should fix the problem. Ask for verifying if the issue still exists.
Keywords: qawanted
Per comment 17, for qawanted info, the migration bug 1003739 is landed in Gaia/master too. And I remember the bug here is possible to reproduce on master(v1.2/v1.3/v1.4 ?) while I filed it. So, we could keep to check the issue in Gaia/master now.
(In reply to Arthur Chen [:arthurcc] from comment #17)
> This seems a duplicate of bug 989742, in which settings app was killed when
> OOM. After bug 989742 landed, the bluetooth app handles the pairing request.
> In v1.3t, the bluetooth app runs in the b2g process and has a simpler
> request handling path, which should fix the problem. Ask for verifying if
> the issue still exists.

Checked in the latest master with a variety of device and was unable to repro with any of them.

Environmental Variables:
Device: Buri (Hamachi)
BuildID: 20140523070522
Gaia: e83bd91c8f7c66f95d55cb741299e12bc8f7b429
Gecko: 681c5668d881
Version: 32.0a1
Firmware Version: v1.2-device.cfg

Environmental Variables:
Device: Tarako 1.3T
BuildID: 20140523081121
Gaia: 44aeb45296737299a988b4d91e3f0c1059caec08
Gecko: 25248a151dfa
Version: 28.1
Firmware Version: sp6821a-gonk-4.0-5-12

Environmental Variables:
Device: Flame
BuildID: 20140523073017
Gaia: b61129780e085636d09406f2a46e922d0f8b9757
Gecko: 315b244f4e90
Version: 32.0a1
Firmware Version: v10F-3
Keywords: qawanted
Per Joshua's comment 19, looks like the issue is no longer to be reproduced. And I believe the callback handler of 'bluetooth-pairing-request' system message is more light weight to be executed in Bluetooth app than Settings app. Because Bluetooth app has less page and module needed to be loading before execute the callback handler.(https://github.com/mozilla-b2g/gaia/blob/master/apps/bluetooth/js/pair_manager.js#L26)

I think we can close the issue. But feel free to reopen it while the issue is happened again. Thanks for Joshua's verification.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.