Commit c9092292 authored by Finnur Thorarinsson's avatar Finnur Thorarinsson Committed by Chromium LUCI CQ

[Android] Fix crash when installing PWA.

A recent refactor of ShortcutManager left an uninitialized
static member variable, which causes a crash on install.

TBR=dominickn@chromium.org

Bug: 1155763
Change-Id: I29db4dae2756fd100f05c67980e6ae613674d150
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2577361
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Auto-Submit: Finnur Thorarinsson <finnur@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834293}
parent 92350af5
...@@ -87,8 +87,6 @@ public class ShortcutHelper { ...@@ -87,8 +87,6 @@ public class ShortcutHelper {
private static final String TAG = "ShortcutHelper"; private static final String TAG = "ShortcutHelper";
private static ShortcutManager sShortcutManager;
// Holds splash images for web apps that are currently being installed. After installation is // Holds splash images for web apps that are currently being installed. After installation is
// complete, the image associated with the web app will be moved to the appropriate {@link // complete, the image associated with the web app will be moved to the appropriate {@link
// WebappDataStorage}. // WebappDataStorage}.
...@@ -223,7 +221,9 @@ public class ShortcutHelper { ...@@ -223,7 +221,9 @@ public class ShortcutHelper {
.setIntent(shortcutIntent) .setIntent(shortcutIntent)
.build(); .build();
try { try {
sShortcutManager.requestPinShortcut(shortcutInfo, null); ShortcutManager shortcutManager =
ContextUtils.getApplicationContext().getSystemService(ShortcutManager.class);
shortcutManager.requestPinShortcut(shortcutInfo, null);
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
Log.d(TAG, Log.d(TAG,
"Could not create pinned shortcut: device is locked, or " "Could not create pinned shortcut: device is locked, or "
......
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