android-components icon indicating copy to clipboard operation
android-components copied to clipboard

determineRegion should not use Locale to determine search regioni

Open mconnormoz opened this issue 6 years ago • 2 comments

We're seeing a lot of search traffic using the US Google code in countries other than the US, which is not valid and we don't get credit. Based on Telemetry, this is almost all from users with en-US or es-US. If the location lookup fails or times out, determineRegion falls back to using Locale.getDefault().country, which is not reliable for region detection. This will lead to clients having the wrong region set, and as a result the wrong search configuration will get used. The inverse also appears to be true where most of the US traffic with the global code has a non -US locale.

The most-correct behaviour in this case would be to fall back to "XX" or "ZZ" as a placeholder for "unknown territory", so that we do not apply region overrides incorrectly. That's not perfect, and we should retry if we see that cached value, but it at least allows us to use the global code instead of an invalid code.

┆Issue is synchronized with this Jira Task

mconnormoz avatar Sep 15 '20 21:09 mconnormoz

cc @pocmo @boek

liuche avatar Sep 15 '20 22:09 liuche

We have this in our sprint: https://github.com/mozilla-mobile/android-components/issues/7865

I'm currently writing the RFC for how we want to determine the region and what sources we can use. I'll flag all of you on that for input once I open the PR.

In the meantime we could try to deploy this falback as quick fix. But it is tricky. Fenix wraps the AC search code and applies additional logic on top. That's what we are currently trying to untangle to have one single implementation in AC, approved through the RFCs. This overall progress we track here: https://github.com/orgs/mozilla-mobile/projects/63

pocmo avatar Sep 16 '20 08:09 pocmo