Skip to content

Sorting by "Account (Z to A)" or "Issuer (Z to A)" incorrectly reverses secondary sort keys, and alphabetical sorting lacks locale awareness #1819

Description

@HrshD1eux

Version

3.4.2

Source

Google Play

Vault encryption

Yes (with biometric unlock)

Device

Pixel 9a

Android version

Android 16

ROM

No response

Steps to reproduce

  1. Create two entries with the exact same Account Name but different Issuers (e.g., Entry 1: Account testuser, Issuer Amazon | Entry 2: Account testuser, Issuer Google).
  2. Open the sort menu and select Account (Z to A). Observe the order of the two entries.
  3. Next, create entries with accented characters (e.g., Ämazon, Apple, Zebra).
  4. Change the sort to Issuer (A to Z) or Account (A to Z) and observe the placement of the accented entry.
  5. Create two identical entries that only differ by casing (e.g., apple and Apple), trigger a few sorts, and observe their relative order.

What do you expect to happen?

  1. For Z to A: When sorting by Account (Z to A), the primary list should be sorted by Account from Z to A. However, entries that share the exact same Account name should fall back to being sorted by their Issuer from A to Z. Reversing a primary sort should not reverse the secondary tie-breaker.

  2. For A to Z: Accented characters (like Ä) should be sorted naturally alongside their base letters (like A), honoring standard localized collation rules. Identical strings that only differ by capitalization should maintain a deterministic, stable order rather than randomly swapping places.

What happens instead?

  1. For Z to A: Selecting Account (Z to A) or Issuer (Z to A) in SortCategory.java applies Collections.reverseOrder() to the entire chained comparator. This incorrectly reverses the secondary sort key as well, placing Google before Amazon when their account names tie.

  2. For A to Z: Alphabetical sorting relies on String.compareToIgnoreCase(), which performs raw Unicode code point comparisons. This pushes accented characters to the very bottom of the list (e.g., Ämazon appears after Zebra). Additionally, case-differing identical strings return 0 with this method, which causes the stable sorter to lose determinism, resulting in items randomly swapping positions upon UI refreshes.

Log

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA bug reportbug-confirmedA confirmed and reproducible bug report

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions