Should GeckoView default to desktop mode UA on tablets? (like iPad Safari)
Categories
(GeckoView :: General, enhancement, P3)
Tracking
(Not tracked)
People
(Reporter: cpeterson, Assigned: calu)
References
(Depends on 1 open bug, Blocks 2 open bugs, Regressed 1 open bug)
Details
(Keywords: parity-chrome, parity-safari, Whiteboard: [fxdroid] [group4])
Attachments
(2 obsolete files)
We have some long-standing issues on Android tablets because Fenix sends a "Mobile" UA on tablets, but some mobile sites aren't usable on a large tablet screen. (For example, see like https://github.com/mozilla-mobile/fenix/issues/1848 and https://github.com/webcompat/web-bugs/issues/107331.)
These tablet issues don't affect other mobile browsers because:
- iPad Safari's UA matches desktop Safari's UA. Users can switch to an iPhone UA if the desktop site is unusable.
- Chrome's UA on tablets mentions "Android", but not "Mobile" or "Tablet". Users can switch to a desktop UA if the Android-without-Mobile site is unusable.
- Legacy Fennec used to send a "Tablet" UA instead of "Mobile". Fenix never implemented this, so it always sends "Mobile". Users can switch to a desktop UA if the mobile site is unusable.
We'd like to follow Safari's approach: when running on a tablet, default to the desktop mode UA and allow users to switch back to the mobile UA. We debated following Chrome's approach, sending an Android-without-Mobile UA, but that is riskier because that's a new and untested UA string. Also, websites would detect "Android" in the UA and show annoying popups promoting their Android apps.
We want to make this change in GeckoView instead of the Fenix frontend because we want all GeckoView-based apps (including Focus and third-party apps) to have an improved user experience on tablets.
I think we can fix this without adding an new UI by changing GeckoView to check if it's running on a tablet when it initializes mDesktopMode
:
https://searchfox.org/mozilla-central/search?q=mDesktopMode&redirect=false
How do we know if we are running on a tablet? I don't know.
Reporter | ||
Comment 1•2 years ago
|
||
Before committing to this approach, we need to test whether the desktop mode UA or the Android-without-Mobile UA fixes more of the sites reported to be unusable on tablets.
Reporter | ||
Updated•2 years ago
|
Comment 2•2 years ago
|
||
iPadOS14+ has both UA and default setting is desktop UA. So I think that we change Fenix's (android-component) default to USER_AGENT_MODE_DESKTOP
if the device is Tablet.
Comment 3•2 years ago
|
||
I found that we return Tablet UA until Fennec 68. But the latest GV returns Mobile UA. As long as our code, we should return tablet UA if tablet. But due to the bug that is explained by bug 1798617, we returns Mobile UA unfortunately.
Comment 4•2 years ago
|
||
Has this been implemented recently? Version 109 has caused websites to serve desktop (tablet?) versions on my Surface Duo. Please see bug 1807209 for details.
Comment 5•2 years ago
|
||
Has this been implemented recently? Version 109 has caused websites to serve desktop (tablet?) versions on my Surface Duo. Please see bug 1807209 for details.
Even if 109, UA on tablet device keep mobile. We don't decide future plan yet.
Reporter | ||
Comment 6•2 years ago
|
||
Tasks and enhancements should have severity N/A.
Reporter | ||
Updated•2 years ago
|
Google now doing this with Chrome on "premium" tablets https://developer.chrome.com/blog/desktop-mode?hl=en
Reporter | ||
Comment 8•7 months ago
|
||
Chrome's criteria for deciding whether an Android tablet is "premium" is defined by display size (in inches), display pixels, and memory here:
/**
* Determines whether the desktop site global setting should be enabled by default.
* @param displaySizeInInches The device primary display size, in inches.
* @param context The current context.
* @return Whether the desktop site global setting should be default-enabled.
*/
static boolean shouldDefaultEnableGlobalSetting(double displaySizeInInches, Context context) {
// Do not default-enable if memory is below threshold.
if (SysUtils.amountOfPhysicalMemoryKB()
< DEFAULT_GLOBAL_SETTING_DEFAULT_ON_MEMORY_LIMIT_THRESHOLD_MB
* ConversionUtils.KILOBYTES_PER_MEGABYTE) {
return false;
}
// Do not default-enable for x86 devices.
if (!isCpuArchitectureArm()) {
return false;
}
// Do not default-enable on external display.
if (isOnExternalDisplay(context)) {
return false;
}
// Do not default-enable if the screen size in inches is below threshold.
if (displaySizeInInches < DEFAULT_GLOBAL_SETTING_DEFAULT_ON_DISPLAY_SIZE_THRESHOLD_INCHES) {
return false;
}
// Do not default-enable if the smallest screen size in dp is below threshold.
if (context.getResources().getConfiguration().smallestScreenWidthDp
< DEFAULT_GLOBAL_SETTING_DEFAULT_ON_SMALLEST_SCREEN_WIDTH_THRESHOLD_DP) {
return false;
}
...
And the default values are defined here:
static final double DEFAULT_GLOBAL_SETTING_DEFAULT_ON_DISPLAY_SIZE_THRESHOLD_INCHES = 10.0;
static final int DEFAULT_GLOBAL_SETTING_DEFAULT_ON_SMALLEST_SCREEN_WIDTH_THRESHOLD_DP = 600;
static final int DEFAULT_GLOBAL_SETTING_DEFAULT_ON_MEMORY_LIMIT_THRESHOLD_MB = 6500;
Comment 9•7 months ago
|
||
The decision to exclude all but ARM from this seems strange. RISC-V and especially x86* devices can certainly benefit from the same logic afforded to ARM devices — my x86-64 (LINX 1010b) tablets are smaller than my ARM tablets.
Updated•5 months ago
|
Assignee | ||
Updated•2 months ago
|
Updated•2 months ago
|
Assignee | ||
Updated•2 months ago
|
Assignee | ||
Comment 10•2 months ago
|
||
Updated•2 months ago
|
Comment 11•1 month ago
|
||
Comment 12•1 month ago
|
||
Backed out for causing gv-unit failures on GeckoInputStreamTest#multipleWriters.
[task 2024-09-05T14:59:53.678Z] 14:59:53 INFO - TEST-START | org.mozilla.geckoview.GeckoInputStreamTest#multipleWriters
[task 2024-09-05T14:59:53.710Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: numtests=1162
[task 2024-09-05T14:59:53.710Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stream=
[task 2024-09-05T14:59:53.710Z] 14:59:53 INFO - org.mozilla.geckoview.test | Error in multipleWriters(org.mozilla.geckoview.GeckoInputStreamTest):
[task 2024-09-05T14:59:53.710Z] 14:59:53 INFO - org.mozilla.geckoview.test | java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.gecko.util.HardwareUtils.init(HardwareUtils.java:29)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.gecko.util.HardwareUtils.isTablet(HardwareUtils.java:42)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.gecko.GeckoAppShell.isTablet(GeckoAppShell.java:1253)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoSessionSettings.<init>(GeckoSessionSettings.java:382)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoSessionSettings.<init>(GeckoSessionSettings.java:354)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoSessionSettings$Builder.<init>(GeckoSessionSettings.java:32)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.<init>(GeckoSessionTestRule.java:875)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.<init>(GeckoSessionTestRule.java:886)
[task 2024-09-05T14:59:53.711Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.BaseSessionTest.<init>(BaseSessionTest.kt:156)
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.BaseSessionTest.<init>(BaseSessionTest.kt:30)
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.BaseSessionTest.<init>(BaseSessionTest.kt)
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoInputStreamTest.<init>(GeckoInputStreamTest.java:25)
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test |
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: test=multipleWriters
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.GeckoInputStreamTest
[task 2024-09-05T14:59:53.712Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stack=java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.gecko.util.HardwareUtils.init(HardwareUtils.java:29)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.gecko.util.HardwareUtils.isTablet(HardwareUtils.java:42)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.gecko.GeckoAppShell.isTablet(GeckoAppShell.java:1253)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoSessionSettings.<init>(GeckoSessionSettings.java:382)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoSessionSettings.<init>(GeckoSessionSettings.java:354)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoSessionSettings$Builder.<init>(GeckoSessionSettings.java:32)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.<init>(GeckoSessionTestRule.java:875)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.rule.GeckoSessionTestRule.<init>(GeckoSessionTestRule.java:886)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.BaseSessionTest.<init>(BaseSessionTest.kt:156)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.BaseSessionTest.<init>(BaseSessionTest.kt:30)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.test.BaseSessionTest.<init>(BaseSessionTest.kt)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | at org.mozilla.geckoview.GeckoInputStreamTest.<init>(GeckoInputStreamTest.java:25)
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test |
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: current=1
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS_CODE: -2
[task 2024-09-05T14:59:53.714Z] 14:59:53 INFO - Printing logcat for test:
[task 2024-09-05T14:59:53.806Z] 14:59:53 INFO - None
[task 2024-09-05T14:59:53.806Z] 14:59:53 WARNING - TEST-UNEXPECTED-FAIL | org.mozilla.geckoview.GeckoInputStreamTest#multipleWriters | java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
[task 2024-09-05T14:59:53.807Z] 14:59:53 INFO - TEST-INFO took 128ms
[task 2024-09-05T14:59:53.807Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: numtests=1162
[task 2024-09-05T14:59:53.807Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: stream=
[task 2024-09-05T14:59:53.807Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: id=AndroidJUnitRunner
[task 2024-09-05T14:59:53.807Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: test=writeError
[task 2024-09-05T14:59:53.808Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: class=org.mozilla.geckoview.GeckoInputStreamTest
[task 2024-09-05T14:59:53.808Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS: current=2
[task 2024-09-05T14:59:53.808Z] 14:59:53 INFO - org.mozilla.geckoview.test | INSTRUMENTATION_STATUS_CODE: 1
[task 2024-09-05T14:59:53.812Z] 14:59:53 INFO - TEST-START | org.mozilla.geckoview.GeckoInputStreamTest#writeError
Comment 13•1 month ago
|
||
Comment 14•1 month ago
|
||
bugherder |
Comment 15•28 days ago
|
||
I'm guessing we want to nominate this for the Fx132 relnotes. Please go ahead and set the relnote-firefox
flag on the bug and fill out the form to do so.
Assignee | ||
Comment 16•27 days ago
|
||
Can QE verify that desktop browsing mode is on default for tablets and large screens and off for mobile devices? Thank you
Assignee | ||
Comment 17•27 days ago
|
||
QE, this will need to be tested for a variety of sites, including ones with video and popular sites.
Reporter | ||
Comment 18•27 days ago
|
||
We should test a foldable device and a large phone (phablet). Those devices are sometimes detected as "tablets", but the desktop site experience might not be appropriate for their screens.
For example, someone on Reddit said Firefox Nightly is detecting their Nokia X20 phone has a tablet and defaulting to desktop sites:
Assignee | ||
Comment 19•27 days ago
|
||
Another device mentioned from this bug (https://bugzilla.mozilla.org/show_bug.cgi?id=1917504) is the Google Pixel 9 Pro XL. It should open mobile viewing, since it is not a tablet, but user says it opened desktop mode. I was not able to reproduce the bug with a Firebase device.
Comment 20•27 days ago
|
||
Running Fenix Nightly, buildid 20240907092150, I started having the FastMail webpage showing something similar to the desktop view. Forcing it to desktop view then disabling gets me back the correct view.
Repro on Sony Xperia I V, Android 14.
Comment 21•27 days ago
|
||
When it happens to me (I just repro'd, it's really trivial for me) what would be the thing to check to make sure the issue is related to that bug? Given the timeline and the behavior, I'm confident, but ...
Reporter | ||
Comment 22•27 days ago
|
||
Sounds like Fenix is treating some large phones as "small tablets". GeckoView's HardwareUtils checks for "large" and "small" tablets. If large phones are detected as "small tablets", maybe we should only default to the desktop UA string on large tablets.
I filed bug 1917730 to investigate that.
Comment 23•25 days ago
|
||
Verified on the Fenix Nightly 132.0a1 build from 9/11 with the following tablets:
- Samsung Galaxy Tab S9 Ultra (Android 14),
- Lenovo TB X606X (Android 10),
- Huawei MediaPad M3 Lite (Android 7),
and the following foldable phones:
- Honor Magic V2 (Android 13) - 7.92 inches screen size unfolded,
- Samsung GalaxyZ Fold 4 (Android 13) - 7.6 inches screen size unfolded.
We do not have phablets to test on.
On all the above mentioned devices, we've verified that desktop browsing mode is on default for tablets and large screens.
We've also verified on the following phones that the desktop mode is not ON by default, unless required by the user:
- Google Pixel 6 (Android 15),
- Oppo Find N2 Flip (Android 14),
- Samsung Galaxy S24 (Android 14),
- Oppo Find X3 Lite (Android 11).
Updated•25 days ago
|
Assignee | ||
Comment 24•24 days ago
|
||
Comment 25•24 days ago
|
||
A patch has been attached on this bug, which was already closed. Filing a separate bug will ensure better tracking. If this was not by mistake and further action is needed, please alert the appropriate party. (Or: if the patch doesn't change behavior -- e.g. landing a test case, or fixing a typo -- then feel free to disregard this message)
Updated•23 days ago
|
Comment 26•23 days ago
|
||
Backed out as requested by developer
Comment 27•23 days ago
|
||
Backout merged to central: https://hg.mozilla.org/mozilla-central/rev/b91e1b615932
Assignee | ||
Updated•18 days ago
|
Assignee | ||
Comment 28•5 days ago
|
||
Closing as this work is being handled by https://bugzilla.mozilla.org/show_bug.cgi?id=1910768.
Updated•5 days ago
|
Description
•