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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java

Issue 2549473002: android: Suppress a StrictMode violation coming from the framework. (Closed)
Patch Set: Created 4 years 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 | no next file » | 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/gsa/GSAServiceClient.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java b/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
index b82a90998561d7e422b5b8532f541162d7d85df6..3f34f3a5ce65dfc06f89579d3670ed2a01ad0613 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/gsa/GSAServiceClient.java
@@ -18,6 +18,7 @@ import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.RemoteException;
+import android.os.StrictMode;
import android.util.Log;
import org.chromium.base.Callback;
@@ -180,8 +181,16 @@ public class GSAServiceClient {
boolean connect() {
if (mService != null) Log.e(TAG, "Already connected.");
Intent intent = new Intent(GSA_SERVICE).setPackage(GSAState.SEARCH_INTENT_PACKAGE);
- return mContext.bindService(
- intent, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND);
+
+ // Third-party modifications to the framework lead to StrictMode violations in
+ // Context#bindService(). See crbug.com/670195.
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ try {
+ return mContext.bindService(
+ intent, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_NOT_FOREGROUND);
+ } finally {
+ StrictMode.setThreadPolicy(oldPolicy);
+ }
}
/**
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698