New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 905725 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Nov 22
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug



Sign in to add a comment

Chrome on Android bundle crashes on startup after switching system language to unsupported locale.

Project Member Reported by digit@google.com, Nov 15

Issue description

For more context, see http://b/119248395 (Google only).

Chrome on Android, when built as a bundle with language-based splits will crash at startup in the following scenario:

1) Have the device configured to only have "Spanish" as the
   system locale (i.e. "English" should *not* be in the list).

2) Install the bundle locally.

3) Chrome starts properly and displays its UI in Spanish.

4) Switch the system language to Slovenskso (sk_SK locale), and
   *remove* Spanish from the list of languages as well.

5) Restart Chrome, it will crash immediately on startup.


 
Status: Started (was: Assigned)
IMPORTANT NOTE: This is about the bug described in comment #11 of the internal bug (which actually is about a different issue).

The root of the problem is that Chrome will fallback to the English locale (en), as seen by the following logcat lines:

11-15 16:57:09.135  2171  2201 I cr_ui   : Using UI locale en, system locale: sk (Android name: sk)
11-15 16:57:09.135  2171  2201 I cr_ui   : Missing asset file: locales#lang_en/en-US.pak
11-15 16:57:09.136  2171  2201 I cr_ui   : Missing asset file: locales/en-GB.pak
11-15 16:57:09.136  2171  2201 E cr_ui   : Android Locale: sk_SK misses split for .pak files: [en-GB, en-US]

They mean the following:

1) Chrome doesn't provide localized strings for the "sk" language, and its UI will default to English (en)

2) It doesn't find anything under locales#lang_en/ probably because it is a split-specific path, and the "en" split was not installed.

3) It then looks under assets/locales/, because that's where the fallback locale (English) should be. But doesn't find anything either.

The English .pak files are duplicated into two splits (as seen by inspecting the generated .apks archive locally):

base-en.apk   (the split for the English language), under assets/locale#lang_en/

base-other_lang.apk  (the split for "other languages"), under assets/locales/

The correct way to fix this is to ensure that the English .pak files are always part of the base module. Because English is the fallback used by the platform when it cannot find any resource associated with the current system locale in a bundle / application.

The quickest way to achieve this is to store these files under a new directory that will not be affected by language-based asset splits, for example:

  assets/locales-fallback/

And then update the ResourceExtractor class to look there as a last attempt.

Project Member

Comment 3 by bugdroid1@chromium.org, Nov 19

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/697a88b14abcfec82278dd46c7bf155e210d7cdf

commit 697a88b14abcfec82278dd46c7bf155e210d7cdf
Author: David 'Digit' Turner <digit@google.com>
Date: Mon Nov 19 19:15:41 2018

android: Place English locale pak files into fallback directory.

This change ensures that all English locale pak files (i.e.
en-US.pak and en-GB.pak) are stored inside an app bundle into
a directory named:

  assets/fallback-locales/

This ensures that said .pak files are always stored in the base
module split APK, and thus available on all Chrome installs, after
any system locale change.

This prevents Chrome from crashing on startup under rare
circumstances (see related bug for details).

Testing was performed manually because we don't have a good regression
test suite that can change the device's system locale programmatically
(see http://crbug.com/904360 for this). Following these steps:

1) Set device's language to Spanish
2) Ensure Chrome is not installed, then install the bundle.
3) Start Chrome. It displays its UI in Spanish.
4) Change system language to SlovenĨina, and *remove* Spanish from
   the list of system languages.
5) Start Chrome. It displays its UI in English (the fallback)
   instead of crashing.

English is chosen because it is the fallback language that the Android
framework actually choses when the application doesn't have any
resources compatible with the current system language.

BUG= 905725 
R=agrieve@chromium.org,estevenson@chromium.org,yfriedman@chromium.org,tiborg@chromium.org,tedchoc@chromium.org

Change-Id: I2c1f53a805122b6e48fb5105c1d9aa8c6262fa1d
Reviewed-on: https://chromium-review.googlesource.com/c/1340303
Reviewed-by: Tibor Goldschwendt <tiborg@chromium.org>
Reviewed-by: Eric Stevenson <estevenson@chromium.org>
Reviewed-by: agrieve <agrieve@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: David Turner <digit@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609385}
[modify] https://crrev.com/697a88b14abcfec82278dd46c7bf155e210d7cdf/build/android/gyp/create_app_bundle.py
[modify] https://crrev.com/697a88b14abcfec82278dd46c7bf155e210d7cdf/ui/android/java/src/org/chromium/ui/resources/ResourceExtractor.java

Status: Verified (was: Started)
Manually tested that this now works properly.

Sign in to add a comment