Closed Bug 811204 Opened 12 years ago Closed 12 years ago

[Dialer] voice call can't switch between speaker and bt sco audio path

Categories

(Firefox OS Graveyard :: General, defect)

All
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(blocking-basecamp:+, firefox18 fixed, firefox19 fixed)

RESOLVED FIXED
blocking-basecamp +
Tracking Status
firefox18 --- fixed
firefox19 --- fixed

People

(Reporter: rlin, Assigned: rlin)

Details

Attachments

(1 file, 3 obsolete files)

1. make voice call, make sure bt sco is connected
2. switch to speaker
3. switch back to bt sco, found the voice sound output to receiver
Assignee: nobody → rlin
blocking-basecamp: --- → ?
Attached patch fix-patch1 (obsolete) — Splinter Review
Attachment #680983 - Flags: review?(mwu)
blocking-basecamp: ? → +
Comment on attachment 680983 [details] [diff] [review]
fix-patch1

Review of attachment 680983 [details] [diff] [review]:
-----------------------------------------------------------------

Approach looks ok for now, but it needs some cleanup.

::: dom/system/gonk/AudioManager.cpp
@@ +53,5 @@
>  static int sHeadsetState;
>  static int kBtSampleRate = 8000;
>  
>  static bool
> +IsBtScoOn()

Let's just generalize this (and IsFmRadioAudioOn) function to take a device and report whether it is available.

@@ +59,5 @@
> +  if (static_cast<
> +      audio_policy_dev_state_t (*) (audio_devices_t, const char *)
> +      >(AudioSystem::getDeviceConnectionState)) {
> +    return AudioSystem::getDeviceConnectionState(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, "") == 
> +           AUDIO_POLICY_DEVICE_STATE_AVAILABLE ? true : false;

While we're at it, remove ? true : false since the == comparison does that for us already.

@@ +61,5 @@
> +      >(AudioSystem::getDeviceConnectionState)) {
> +    return AudioSystem::getDeviceConnectionState(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET, "") == 
> +           AUDIO_POLICY_DEVICE_STATE_AVAILABLE ? true : false;
> +  } else {
> +    return false;

Remove the else - we can just return false;

@@ +324,5 @@
>  AudioManager::SetForceForUse(int32_t aUsage, int32_t aForce)
>  {
>    status_t status = 0;
> +
> +  if (IsBtScoOn() == true && aUsage == nsIAudioManager::USE_COMMUNICATION 

Comparing against true is unnecessary, especially since that function returns a boolean.

Make sure you put && at the end of lines instead of the beginning.

Avoid any trailing whitespace when adding code.
Attachment #680983 - Flags: review?(mwu)
Hardware: x86_64 → All
Attached patch bug-806262-fix.patch2 (obsolete) — Splinter Review
Attachment #680983 - Attachment is obsolete: true
Attachment #681815 - Flags: review?(mwu)
Comment on attachment 681815 [details] [diff] [review]
bug-806262-fix.patch2

Review of attachment 681815 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/system/gonk/AudioManager.cpp
@@ +65,1 @@
>      return false;

The indentation is off here.

@@ +310,5 @@
>  AudioManager::SetForceForUse(int32_t aUsage, int32_t aForce)
>  {
>    status_t status = 0;
> +
> +  if (IsDeviceOn(AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET) && aUsage == nsIAudioManager::USE_COMMUNICATION &&

This line is a bit long. Put the aUsage == ... check on the next line and align everything with IsDeviceOn.
Attached patch patch3 (obsolete) — Splinter Review
Attachment #681815 - Attachment is obsolete: true
Attachment #681815 - Flags: review?(mwu)
Attachment #681823 - Flags: review?(mwu)
Comment on attachment 681823 [details] [diff] [review]
patch3

Review of attachment 681823 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thanks.

Note that the Mozilla coding style is {} for every if/while/for/etc. statement, even if it's not necessary. I don't care much for this but other reviewers do, and that appears to be the style in this file.
Attachment #681823 - Flags: review?(mwu) → review+
Attached patch checkin patchSplinter Review
add a=blocking-basecamp
Attachment #681823 - Attachment is obsolete: true
https://hg.mozilla.org/mozilla-central/rev/7b766fb679bf
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: