Closed Bug 930607 Opened 11 years ago Closed 10 years ago

[dialer] The phone number is emptied even when the call can't be made

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: julienw, Assigned: darkowlzz)

References

Details

(Whiteboard: [mentor=etienne])

Attachments

(1 file, 3 obsolete files)

STR:
* enable airplane mode or remove the SIM card
* launch dialer
* enter a phone number
* try to call

Expected:
* there is an alert explaining why a call can't be made
* the phone number is _not_ emptied

Actual:
* there is an alert explaining why a call can't be made
* the phone number is emptied

This is IMO important because when the user is in a location with a bad reception (say, in a house, or a shop), he will probably want to try the call again in another location, and will be pissed off because he'll have to enter the phone number again.

Asking a blocking for 1.3, and NI the UX team.
Flags: needinfo?(firefoxos-ux-bugzilla)
Flagging Jacqueline, who is Dialer on Comms for 1.3.
Flags: needinfo?(firefoxos-ux-bugzilla) → needinfo?(jsavory)
I agree with the expected result here, the phone number should not empty when an alert appears so that the user can easily try again when they have changed their settings.
Flags: needinfo?(jsavory)
triage: should not block reelase. please land it in master when ready
blocking-b2g: 1.3? → 1.4?
blocking-b2g: 1.4? → ---
Etienne, should we convert this to a mentoring bug ?
Flags: needinfo?(etienne)
Thanks Julien, great idea!
Flags: needinfo?(etienne)
Whiteboard: [mentor=etienne]
Hi, 

I am working on this bug.

I found that the PhoneView is cleared by `connected` & `disconnected` in [1], which are passed to `TelephonyHelper.call` as parameters later.

On TelephonyHelper side,
`call.onconnected` and `call.ondisconnected` are called at [2], which clears the PhoneView.

On commenting out the above, PhoneView retains it's value even after a successful call, which is undesirable.
`call.onerror` seems to be invoked very late. Moving it above call.onconnected doesn't help.

Can I get some hint on how should I organize things in order to get the desired behaviour?

[1]: http://mxr.mozilla.org/gaia/source/apps/communications/dialer/js/dialer.js#250
[2]: http://mxr.mozilla.org/gaia/source/apps/communications/dialer/js/telephony_helper.js#101
Hey Sunny, thanks for looking at this bug.

And you're right, we will always get the disconnected callback, there's a nice documentation showing the various call states on the WebTelephony API page [1].

The complexity of this bug is that we still want to clean the phone number when somebody hangs up right away (before the call is connected).

So I think our best bet here is to call |KeypadManager.updatePhoneNumber| again in the |error| callback to put the number back in place (we have the number as a parameter of the |call| function).

Hsin-Yi, do you know if the call.onerror callback is guaranteed to be triggered _after_ the call.ondisconnected? (looks like it's the case).

[1] https://wiki.mozilla.org/WebAPI/WebTelephony
Flags: needinfo?(htsai)
(In reply to Etienne Segonzac (:etienne) from comment #7)
> Hey Sunny, thanks for looking at this bug.
> 
> And you're right, we will always get the disconnected callback, there's a
> nice documentation showing the various call states on the WebTelephony API
> page [1].
> 
> The complexity of this bug is that we still want to clean the phone number
> when somebody hangs up right away (before the call is connected).
> 
> So I think our best bet here is to call |KeypadManager.updatePhoneNumber|
> again in the |error| callback to put the number back in place (we have the
> number as a parameter of the |call| function).
> 
> Hsin-Yi, do you know if the call.onerror callback is guaranteed to be
> triggered _after_ the call.ondisconnected? (looks like it's the case).
> 
> [1] https://wiki.mozilla.org/WebAPI/WebTelephony

call.onerror is triggered only when a call is released abnormally.
So Etienne's suggestion should work for this bug!
Flags: needinfo?(htsai)
Attached file Link to pull request 15477 (obsolete) —
Attachment #8361828 - Flags: review?(etienne)
Attached file Link to pull request 15479 (obsolete) —
Attachment #8361857 - Flags: review?(etienne)
Attachment #8361828 - Attachment is obsolete: true
Attachment #8361828 - Flags: review?(etienne)
It seems that both the things I tried failed in Travis CI [1] & [2]. I don't understand what went wrong. Could someone help me out?

[1]: https://github.com/mozilla-b2g/gaia/pull/15477
[2]: https://github.com/mozilla-b2g/gaia/pull/15479
[1] is not your fault, but [2] probably is :)

for [2] look at https://travis-ci.org/mozilla-b2g/gaia/jobs/17149116 and you'll see the errors.
Yea, I have seen that
TypeError: number is undefined

So, the 1st PR was fine.
Sending it again.

Thanks Julien.
Attachment #8361828 - Attachment is obsolete: false
Attachment #8361828 - Flags: review?(etienne)
Attachment #8361857 - Attachment is obsolete: true
Attachment #8361857 - Flags: review?(etienne)
Attached file Link to pull request 15520 (obsolete) —
Attachment #8361828 - Attachment is obsolete: true
Attachment #8361828 - Flags: review?(etienne)
Attachment #8362429 - Flags: review?(etienne)
Comment on attachment 8362429 [details] [review]
Link to pull request 15520

Thanks for the update, 2 issues:

* The telephony helper can be used from other places (eg contacts app) where the |KeypadManager| isn't defined. Your change needs to live in |dialer.js|, in the error callback that we pass to the TelephonyHelper [1].

* We should use the number and not the sanitized number otherwise we might loose formatting, good thing is, you have access to it more easily from dialer.js :)

[1] https://github.com/darkowlzz/gaia/blob/bc64b2ed9c847c39995fbcb798dd985e6973b45f/apps/communications/dialer/js/dialer.js#L257
Attachment #8362429 - Flags: review?(etienne) → review-
Attachment #8362429 - Attachment is obsolete: true
Attachment #8362788 - Flags: review?(etienne)
Assignee: nobody → indiasuny000
Comment on attachment 8362788 [details] [review]
Link to pull request 15541

A simple patch in the end, but you got to see how one of the most critical file in the dialer works :)

r=me
Thank you for fixing this bug!
Attachment #8362788 - Flags: review?(etienne) → review+
https://github.com/mozilla-b2g/gaia/commit/f4dd126585c49245a3d3a1bb28886323a0d07651
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
(I'm so happy)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: