Closed Bug 1948059 Opened 1 year ago Closed 1 year ago

Consider adjusting how file sizes are displayed (binary v. decimal definition of a byte display incongruity)

Categories

(Firefox for Android :: Design System and Theming, task)

All
Android
task

Tracking

()

RESOLVED FIXED
138 Branch
Tracking Status
firefox136 --- wontfix
firefox137 --- wontfix
firefox138 --- verified

People

(Reporter: olivia, Unassigned)

References

Details

Attachments

(1 file)

Fenix is calculating file sizes using the binary definition of a byte (1024), but displaying them using decimal definition of a byte.

For example, translations is displaying 17.2 MB for a model size, but to be perfectly correct, it is 17.2 MiB based on the calculation.

The calculation originates from DownloadDialogFragment and seems to be used in many places.

I think I've seen this reported before for other scenarios, but couldn't find a ticket.

I suspect this bug will mostly be collaborating with UX and L10N to confirm if we want to change conventions. According to this, it sounds like the US locale at least should be following the binary definition of a byte.

See Also: → 1947822
Summary: Consider adjusting how file sizes are displayed → Consider adjusting how file sizes are displayed (binary v. decimal definition of a byte display incongruity)
See Also: → 1953923

Just to clarify the issue:

  • Raw value is 17972343 bytes
  • Fenix displays 17.2 MB <- this is incorrect, the calculation + units don't match
    • Format is of the form: [binary calculation] + [decimal units notation]
  • The correct display should be either:
    • 17.2 MiB (binary definition)
    • 17.97 MB (decimal definition)

This has likely been fixed for many areas by bug 1951907. Would need to spot check raw bytes v. displayed format to be sure.

See Also: → 1951907

Cross-posting this comment from Bug 1953923 for visibility,

I just took a look into this! This new method seems to be calculating (and displaying) the decimal definition of a byte. I changed Translations to be using this new method and the preview changed from showing 3.91MB (should be MiB) to 4 MB, which is the correct conversion from 4000 bytes. After I land this, I can ask QA to verify if Bug 1948059 is fixed.

Update: This is not always the case. From the documentation,

In android. os. Build. VERSION_CODES. N and earlier, powers of 1024 are used instead, with KB = 1024 bytes, MB = 1,048,576 bytes, etc.

Since the patches for Bug 1953923 and Bug 1951907 have landed, can QA please verify that we now calculate and display file sizes with the decimal definition of a byte? This can be verified by going to http://xcal1.vodafone.co.uk/ and trying to download any of the files. Notice that this website uses the base 2 definition of a byte. I.e. KB = 1024 bytes, MB = 1,048,576 bytes, etc... This means that if trying to download a 5MB file, it is really a 5MiB file and our downloads page and dialogs should really be showing 5.24 MB

Severity: -- → N/A
Flags: qe-verify+

Verified as fixed in latest Nightly from 0/25 with Google Pixel 8 Pro (Android 15). The file size is displayed with the decimal definition of a byte.

Status: NEW → RESOLVED
Closed: 1 year ago
Flags: qe-verify+
Resolution: --- → FIXED
Target Milestone: --- → 138 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: