Closed Bug 1311480 Opened 3 years ago Closed 3 years ago

Show Devices in Alphabetical Order on Send to Device

Categories

(Firefox for Android :: General, defect, P3)

50 Branch
All
Android
defect

Tracking

()

VERIFIED FIXED
Firefox 53
Tracking Status
firefox53 --- verified

People

(Reporter: amr, Assigned: maliu)

Details

(Whiteboard: [TPE-1])

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20161019030208

Steps to reproduce:

- Share a link using Android's share
- Choose "Add to Firefox Beta"
- Choose "Send to other devices"
- The list of devices show up in an order that changes every time, maybe it's based on recent device, but it's not clear.


Actual results:

List of devices shows up in a changing order every time a link is shared.
I have to read through the list and figure out which is the correct device instead of relying on memory.


Expected results:

Show devices in an alphabetical order to offer users certainty when sharing to the same device multiple times in a row. It lets users avoid reading the list and go to the part of the list where they usually go.
OS: Unspecified → Android
Hardware: Unspecified → All
Sounds like a good first bug for the team in Taipei.

@antlam: Any concerns from UX side?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(alam)
Priority: -- → P3
Whiteboard: [TPE-1]
It should be showing in reverse chronological order, with the most recently synced device first. That's what we do on iOS and desktop, too.

The idea is that a device that hasn't synced in a while will age down to the bottom of the list. This is particularly useful given that most device names will be things like "Firefox on Richard's iPhone", "Firefox on Windows 7".

If you're seeing the order change every time, that might be because you have a bunch of very active devices. If that's a case we're concerned about, I would suggest sorting alphabetically within a time window only -- devices that have synced within the last two days are in one 'bucket', sorted alphabetically for stability.
My use case (that resulted in this report) is that I'm browsing Twitter and there are articles that I'd like to read on my work machine, and others that I'm reading on home machine.
I share a link, and home machine is 2nd on list. I share another link, and home machine is 2nd on list, then I share a 3rd link, and now home machine is 1st.
This is why I wasn't sure if it's based on recent device or not, because it doesn't take effect immediately.

I understand that inactive devices gets pushed down the list and disappear after a while, but also has its downsides. When I go on vacation, after a while (let's say a week) my home machine is gone, because it's offline. However, it's still an active machine for me, and I'd like to send links to it, but I can't, and there's nothing I can do to fix that.
> I share a link, and home machine is 2nd on list. I share another link, and
> home machine is 2nd on list, then I share a 3rd link, and now home machine
> is 1st.

Your desktop syncs on a timer, and then your Android device updates its device list periodically. The list is sorted in the order that the other devices synced at the moment the list was last refreshed.

In your case, that means that your home machine synced at some point, and your Android device refreshed between the 2nd and 3rd links you sent.


> I understand that inactive devices gets pushed down the list and disappear
> after a while, but also has its downsides. When I go on vacation, after a
> while (let's say a week) my home machine is gone, because it's offline.
> However, it's still an active machine for me, and I'd like to send links to
> it, but I can't, and there's nothing I can do to fix that.

That's actually a limitation of Sync itself. There's no mechanism for client records to be deleted when an FxA leaves an account, so instead client records are TTLed.

They disappear from the server three weeks after the device last synced. Clients can behave differently, but they can't offer to send a tab to a device that hasn't synced recently, because it literally no longer exists from Sync's perspective.

At some point in the future this function might be delegated to the FxA device manager, which should be able to do better…
The main "pro" for the current ordering structure is (like Rnewman has pointed out) that it places the last used device highest, and the least (probably rarely used) device at the bottom.

I think my main concern is consistency. As long as we keep the same order across mobile (iOS too) and desktop, then we should be OK. 

But if we can't do that, we should investigate this more before committing to such a change on just one platform.
Flags: needinfo?(alam)
Just chatted about this in person too.

The main concern is consistency. With other Fennecs on other platforms, as well as inside our app (like the History panel).

It makes sense to sort this list by alphabetical order since you're searching for a device to send to. Whereas in the History tab, we show "Last synced" and it's more about recalling/ task continuity based on synced data. 

We can make sort this alphabetically but lets make sure we do this consistently too.
Assignee: nobody → max
Status: NEW → ASSIGNED
Attachment #8811167 - Flags: review?(s.kaspari) → review?(gkruglov)
I've redirected the review request to grisha. He has more experience with the sync code.
Comment on attachment 8811167 [details]
Bug 1311480 - Add support to query client with order by name alphabetically,

https://reviewboard.mozilla.org/r/93376/#review93940

You should be able to drop most of the changes and simplify this patch - see my comment below. I'll clear the review flag while waiting for changes.

Generally speaking, I agree with rnewman - sorting by recency is great when a lot of older clients are cluttering up the list. However, playing around with this locally, our "exclude stale clients" logic seems to do a good enough job of clearing up that list to a sane subset (way more usable than what I see on desktop). As a result, the list is usually manageable (from what I've seen), and alphabetical sorting becomes useful.

I still think a better solution is akin to what rnewman proposed - alphabetical sorting within "recency buckets". You get best of both approaches, at the expense of having to write a more complicated query.

Also, note that we're already inconsistent with desktop, client lists look rather different. So that ship has sailed, unless we want to unify this logic across clients.

::: mobile/android/base/java/org/mozilla/gecko/db/TabsProvider.java:318
(Diff revision 1)
>                  break;
>  
> +            case CLIENTS_NAME:
>              case CLIENTS_RECENCY:
> -                trace("Query is on CLIENTS_RECENCY: " + uri);
>                  if (TextUtils.isEmpty(sortOrder)) {

If you're going to switch to alphabetical sorting entirely, just change the default sort order value instead of adding CLIENTS_NAME, and probably rename the helper method in the TabAccessor to something like `getRemoteClientsNoStaleSorted`, and add a comment describing default sort order as alphabetical.
Attachment #8811167 - Flags: review?(gkruglov)
Comment on attachment 8811167 [details]
Bug 1311480 - Add support to query client with order by name alphabetically,

https://reviewboard.mozilla.org/r/93376/#review94310
Attachment #8811167 - Flags: review?(gkruglov) → review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/f3e6d1ac9a5d
Add support to query client with order by name alphabetically, r=Grisha
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/f3e6d1ac9a5d
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 53
Verified as fixed in build 53.0a1 (2016-11-23);
Device: Asus ZenPad 8 (Android 6.0.1).
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.