[Bluetooth] Names of Paired Devices do not appear in Alphabetical order.

RESOLVED FIXED

Status

defect
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: jthomas, Assigned: arthurcc)

Tracking

unspecified
ARM
Gonk (Firefox OS)

Firefox Tracking Flags

(b2g-v2.0 affected, b2g-v2.1 affected, b2g-v2.2 fixed)

Details

(Whiteboard: [2.2-flame-reduced-run], )

Attachments

(2 attachments)

Description:
If the user has previously paired with 3 devices using Bluetooth, the names will sometimes appear not in an alphabetical order. 


Prereq: 2-3 additional devices with blue tooth enabled. Blue tooth devices should have names spread across the alphabet.  

Repro Steps:
1) Update a Flame to 20141208040202
2) From Settings enable Bluetooth.
3) Select Search for devices.
4) Pair with 3 Devices.
5) Observe the alphabetical order under Paired Devices


Actual:
The names under Paired Devices do not appear in alphabetical order.


Expected:
It is expected that the names of the Paired with devices will appear in alphabetical.

Environmental Variables:
Device: Flame 2.2 (319mb) (Kitkat Base)(Full Flash)
Build ID: 20141208040202
Gaia: 0e429d970c160e580e19e61ad8ff5612de159f00
Gecko: c4c7442e9113
Gonk: 48835395daa6a49b281db62c50805bd6ca24077e
Version: 37.0a1 (2.2)
Firmware Version: v188-1
User Agent: Mozilla/5.0 (Mobile; rv:37.0) Gecko/37.0 Firefox/37.0

Link to failed test case: https://moztrap.mozilla.org/manage/case/3501/
Repro frequency: 100%

See attached: Logcat & Video

Video: http://youtu.be/u1Bf3hOdKng
Flags: needinfo?(dharris)
This issue does NOT occur on Flame 2.1 KK (319mb) and Flame 2.0 KK (319mb) 

Result: Paired devices do not appear in alphabetical order.

Flame 2.1

Device: Flame 2.1 (319mb) (Kitkat Base)(Full Flash)
BuildID: 20141205001201
Gaia: 38e17b0219cbc50a4ad6f51101898f89e513a552
Gecko: 8b92c4b8f59a
Gonk: 48835395daa6a49b281db62c50805bd6ca24077e
Version: 34.0 (2.1)
Firmware: V188-1
User Agent: Mozilla/5.0 (Mobile; rv:34.0) Gecko/34.0 Firefox/34.0


Flame 2.0

Device: Flame 2.0 (319mb) (KitKat Base)(Full Flash)
Build ID: 20141208000206
Gaia: 856863962362030174bae4e03d59c3ebbc182473
Gecko: e40fe21e37f1
Gonk: 48835395daa6a49b281db62c50805bd6ca24077e
Version: 32.0 (2.0)
Firmware Version: v188-1
User Agent: Mozilla/5.0 (Mobile; rv:32.0) Gecko/32.0 Firefox/32.0
QA Whiteboard: [QAnalyst-Triage?]
EJ, could you help review this simple patch? Thanks.

Currently the sorted result would look like "a, b, A, B" instead of "a, A, b, B". In this patch it sorts the list by comparing the lower case names.
Attachment #8534097 - Flags: review?(ejchen)
Correction for my results mentioned in Comment 1 Result: Paired devices DO appear in alphabetical order for Flame 2.1 and Flame 2.0.
Not nominating to block on this bug. Names appear in the list and can be connected to. Minor ordering issue
QA Whiteboard: [QAnalyst-Triage?] → [QAnalyst-Triage+]
Flags: needinfo?(dharris)
Comment on attachment 8534097 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/26683

Arthur, use toLowerCase() to compare strings may cause problems.

For example :

var x = ['Az', 'aZ', 'b', 'AZ'];
x.sort(function(a, b) {
  return a.toLowerCase() > b.toLowerCase();
});

// results 
// ["Az", "aZ", "AZ", "b"]

In this way, "Az" would be shown prior to "aZ" and this is not what we want because for "Az" and "aZ", in such sorting algorithm, they are all recognized as "az" and `sort` method would treat them as equal and sort them by its original order.

Are we going to handle such problems ?
Flags: needinfo?(arthur.chen)
Attachment #8534097 - Flags: review?(ejchen)
Indeed, the default sorting algorithm does not handle this case well. If we are going to handle it, the proposed algorithm may only apply to English as we are not likely implementing an algorithm for each language.

Jenny, may I have your input here? Are we going to handle this case?
Flags: needinfo?(arthur.chen) → needinfo?(jelee)
Hi Arthur,

Let's sort the paired device with alphabetical order. Thanks!
Flags: needinfo?(jelee)
(In reply to Jenny Lee from comment #7)
> Hi Arthur,
> 
> Let's sort the paired device with alphabetical order. Thanks!

At this stage, I don't find it necessary to handle cases like this:["Az", "aZ", "AZ", "b"]. Current algorithm is good enough for me, thanks!
Comment on attachment 8534097 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/26683

EJ, could you help review the patch again given the input from UX in comment 8? Thanks!
Attachment #8534097 - Flags: review?(ejchen)
Comment on attachment 8534097 [details]
Link to https://github.com/mozilla-b2g/gaia/pull/26683

Sure, based on Jenny's comment, r+++

Thanks Arthur.
Attachment #8534097 - Flags: review?(ejchen) → review+
master: 0de95b4017de73e72c897e2dcb87564d8f3756eb
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.