Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java

Issue 2788183002: Fix possible Strictmode crash when initializing non-presenting GVR context. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java
index c70bea449f7ab984e751378a42791be1b4309437..c6010c1e1132fdf29ef2820f1ef958e1d1429e9a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/NonPresentingGvrContextImpl.java
@@ -5,6 +5,7 @@
package org.chromium.chrome.browser.vr_shell;
import android.app.Activity;
+import android.os.StrictMode;
import com.google.vr.ndk.base.GvrLayout;
@@ -15,7 +16,13 @@ public class NonPresentingGvrContextImpl implements NonPresentingGvrContext {
private GvrLayout mGvrLayout;
public NonPresentingGvrContextImpl(Activity activity) {
- mGvrLayout = new GvrLayout(activity);
+ // Creating the GvrLayout can sometimes create the Daydream config file.
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskWrites();
+ try {
+ mGvrLayout = new GvrLayout(activity);
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
}
@Override
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698