Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java |
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java |
index 4b3eed1e42f5228c0b6222a9cef9abfbfe85c03f..e2c4f0ed8bf359c8fca13989f69a36cc18471b24 100644 |
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java |
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationService.java |
@@ -8,12 +8,14 @@ import android.app.IntentService; |
import android.content.BroadcastReceiver; |
import android.content.Context; |
import android.content.Intent; |
+import android.os.StrictMode; |
import android.util.Log; |
import org.chromium.base.ThreadUtils; |
import org.chromium.base.annotations.SuppressFBWarnings; |
import org.chromium.base.library_loader.ProcessInitException; |
import org.chromium.chrome.browser.init.ChromeBrowserInitializer; |
+import org.chromium.chrome.browser.webapps.WebappRegistry; |
/** |
* The Notification service receives intents fired as responses to user actions issued on Android |
@@ -76,6 +78,17 @@ public class NotificationService extends IntentService { |
try { |
ChromeBrowserInitializer.getInstance(this).handleSynchronousStartup(); |
+ // Warm up the WebappRegistry and all web app SharedPreferences, as we will need check |
gone
2016/09/29 21:06:44
need to check
dominickn
2016/09/30 00:17:01
Done.
|
+ // if this notification should launch a standalone web app. This no-ops if the registry |
+ // is already initialized, but triggers a strict mode violation otherwise (i.e. the |
+ // browser isn't running). Temporarily disable strict mode to work around the violation. |
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads(); |
+ try { |
+ WebappRegistry.warmUpSharedPrefs(""); |
+ } finally { |
+ StrictMode.setThreadPolicy(oldPolicy); |
+ } |
+ |
// Now that the browser process is initialized, we pass forward the call to the |
// NotificationPlatformBridge which will take care of delivering the appropriate events. |
if (!NotificationPlatformBridge.dispatchNotificationEvent(intent)) { |