New issue
Advanced search Search tips

Issue 763200 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Sep 11
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Change BUILD ID in User Agent to utilize API version

Project Member Reported by sgu...@chromium.org, Sep 8 2017

Issue description

urrently the user agent format for WebView is specified in Android CDD and enforced by CTS. The format is as below:


The user agent string reported by the WebView MUST be in this format:

Mozilla/5.0 (Linux; Android $(VERSION); $(MODEL) Build/$(BUILD); wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 $(CHROMIUM_VER) Mobile Safari/537.36

The value of the $(VERSION) string MUST be the same as the value for android.os.Build.VERSION.RELEASE.
The value of the $(MODEL) string MUST be the same as the value for android.os.Build.MODEL.
The value of the $(BUILD) string MUST be the same as the value for android.os.Build.ID.
The value of the $(CHROMIUM_VER) string MUST be the version of Chromium in the upstream Android Open Source Project.
Device implementations MAY omit Mobile in the user agent string.


The build ID is continuously creating problems as this is somewhat arbitrarily decided by Android.

The proposal is to change BUILD ID to be:
The value of the $(BUILD) string MUST be the same as the value for android API level.0.0.0. For example for API level 26, it will be 26.0.0.0

This change requires CTS and CDD changes and it can potentially break parsing of Web sites and maybe even Android Apps. This is also a change for Chrome.

1. Let's do the change in a unstable release for both WebView and Chrome and observe the results.

2. If we want we can also do a Finch experiment in Chrome.

3. When comfortable, update both CDD and CTS and do the change. Unfortunately, the CTS change may need to go backwards, unless we gate it for Android SDK level (however, keeping it only for passing CTS tests is not meaningful IMO)

see internal bug b/62400406

*keeping the bug public*
 
Cc: ntfschr@chromium.org
Why would we set it to 26.0.0.0 instead of 26?  API level is an integer.
Cc: ijpedowitz@google.com

Comment 4 by torne@chromium.org, Sep 11 2017

I think Selim meant 26.0.0 - this is to preserve the formatting so that a \d+\.\d+\.\d+ regex will still match. So far we have always presented the android version as three numbers (and the logic to attempt to do so is what has caused many of the problems when dealing with changes in android).

I was assuming we would only change this for future OS versions and would keep the current logic for existing OS versions - not just to avoid breaking CTS retroactively but also because this might not be a web compatible change - people might already be checking for particular values.

There's ongoing discussion about removing $(BUILD) as well elsewhere.
Project Member

Comment 5 by sheriffbot@chromium.org, Sep 11

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
For future reference, CDD is here: https://source.android.com/compatibility/android-cdd#3_4_web_compatibility

> The value of the $(BUILD) string MUST be the same as the value for android API level.0.0.0. For example for API level 26, it will be 26.0.0.0

"$(VERSION)" resembles the pattern "x.y.z," "a.b," etc., not "$(BUILD)". I think "$(BUILD)" was a typo?

"$(VERSION)" gives WebView some headaches: some apps incorrectly parse these Android version numbers. For example, the Android P useragent is "Android 9", but many apps search for "Android x.y" or "Android x.y.z". The result is that P devices aren't detected as Android phones, and the app serves desktop pages.

That said, this was *never* the right way to detect mobile devices. Apps should search for "mobile" instead, which we have since clarified in our docs [1]. But, I'm sure many apps nonetheless assume the wrong thing.

[1] https://developer.android.com/guide/webapps/best-practices
Status: WontFix (was: Untriaged)
Yes, this means $(VERSION), not build ID. We have, since the early days, made it so that the useragent just always roundtrips what Android use for ro.build.version literally, which is why Android 9 is indeed Android 9, not 9.0.0.

So, some of the motivation for this is gone; the UA format is already inconsistent between versions (but consistent with android native APIs) and web developers have to deal with that.

However, it is still the case that android don't generally consider the "version" used here to be important/meaningful for development purposes and the API level is the thing developers should care about.

Given the backward compat requirements would mean we could only change this for future OS versions, the result seems likely to just be very confusing. Let's just not do this. People who are parsing UA have already had to start doing it more carefully as a result of the last couple of android releases changing the format :)

Sign in to add a comment