Closed Bug 1048680 Opened 10 years ago Closed 9 years ago

[Telephony] listen to 'ready' event to notice the initialization of telephony object

Categories

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

x86_64
Linux
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: aknow, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

Previously, we abuse 'callschanged' event to indicate that the telephony object is fully initialized. Now we have a specific event 'ready' for the purpose. Please change the usage in current gaia.

Don't worry about the timing you register the event listener. 

1. If the telephony is not ready, the listener will receive 'ready' event as soon as the telephony finishes the initialization.

2. If the telephony is ready, the listener will receive the event immediately after the registration.

Note:
It's possible for one listener to receive multiple times of 'ready' event. Because everytime a new listener is registered, we have to guarantee the 'ready' event will be fired and this event will be broadcast to all the listeners.
I can't find any reference to callschanged in the Dialer app. The only references I see are in the Callscreen and they are used for real callschanged work. Do you have any use case where we should be using it?
Flags: needinfo?(szchen)
(In reply to Anthony Ricaud (:rik) from comment #1)
> I can't find any reference to callschanged in the Dialer app. The only
> references I see are in the Callscreen and they are used for real
> callschanged work. Do you have any use case where we should be using it?

Using "callschanged" for ready is introduced in Bug 823958. I checked the bugs which are blocked by it. Some of them indeed use the event for the ready purpose at that time. However, the architecture is totally different now and all the changes are not valid at this moment...

Also, there are some reference in system app but I can't find anyone which needs change...

Well... I think all the gaia apps use 'callschanged' really "well". The codes are optimized for the current behavior of 'callschanged'. They handle both "ready" and real "callschanged" at the same place. So we can't find a point that could be easily replaced by "ready" event.

The reason why we introduce "ready" event is that in original design, the app is possible to receive "callschanged" when there is no changes actually. This might lead to some problem, for example, layer order in window manager.
Flags: needinfo?(szchen)
Will it better to distinguish the use of "ready" and "callschanged"? Then in gecko, we don't have to fire dummy "callschanged" event when there is no changes.
We could distinguish them in Gaia but from a quick grep, I can't see a case that would benefit from this.
OK, just keep it unchanged.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → WONTFIX
Blocks: 1061210
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Attached patch should wait telephony ready (obsolete) — Splinter Review
Just attached the wrong file. This one is correct.
Attachment #8483350 - Attachment is obsolete: true
I got a use case when working on Bug 1061210.

Let me briefly summarize the scenario of that bug:
1. make two call
2. merge them into a conference
3. back to home menu, remove dialer app from card view
4. open dialer again and make a new call

Expect:
Gaia should notice that there is an active call (conference). So, it should hold it before dialing out the new one.

Please see my fix in attachment 8483352 [details] [diff] [review]
|telephony.calls| and |telephony.active| should only be access after telephony object is initialized (by ready event). Otherwise, the value of them are not correct.
Flags: needinfo?(anthony)
That sounds like a reasonable use. Worst case scenario, how long can this initialisation take? If it's more than 500ms, we may want to show some feedback to the user that we registered the request.
Flags: needinfo?(anthony)
No longer blocks: 1061210
Well... I found that the user case here is not an urgent one. Current gecko also has limit check and could hold the call automatically.

So, I'd prefer to see whether it is possible to have an ultimate solution:  returning an already initiated telephony object (Bug 986333). This may require a sync ipc message between content and chrome. That means the number of message exchanged should also be optimized (Bug 1061089) thus it won't take too much time.
This doesn't seem to be an issue anymore since bug 1081811 landed.
Status: REOPENED → RESOLVED
Closed: 10 years ago9 years ago
Depends on: 1081811
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: