Commit b621a5dc authored by Henry Jian's avatar Henry Jian Committed by Commit Bot

[Android WebAPKs] Fix Chrome crashes when updating bad WebAPKs

We have a few bad v106/v109 shell in the wild for clankium, chromium,
canary and dev channel. The bad shells can cause Chrome to crash
when Chrome tries to update that WebAPK but either times out or
couldn't reach the website.

The cause of the crash is that the shell has a resource id when
it shouldn't. This CL fixes that.

Bug: 1019318, 977173
Change-Id: I27b214f374d77942122365455cfac561244a161e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1902076
Commit-Queue: Henry Jian <hzjian@google.com>
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarPeter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarDominick Ng <dominickn@chromium.org>
Cr-Commit-Position: refs/heads/master@{#713582}
parent 70e0e659
......@@ -227,6 +227,16 @@ public class WebApkIntentDataProvider extends BrowserServicesIntentDataProvider
int primaryMaskableIconId =
IntentUtils.safeGetInt(bundle, WebApkMetaDataKeys.MASKABLE_ICON_ID, 0);
// There are a few WebAPKs with bad shells (between v105 and v114) that would previously
// cause chrome to crash. The check below fixes it. See crbug.com/1019318#c8 for details.
if (shellApkVersion >= 105 && shellApkVersion <= 114) {
try {
ApiCompatibilityUtils.getDrawable(res, primaryMaskableIconId);
} catch (Resources.NotFoundException e) {
primaryMaskableIconId = 0;
}
}
boolean isPrimaryIconMaskable =
primaryMaskableIconId != 0 && ShortcutHelper.doesAndroidSupportMaskableIcons();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment