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

Unified Diff: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java

Issue 2963523003: Add StrictMode exemption from getDrawable. (Closed)
Patch Set: Created 3 years, 6 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
diff --git a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
index d57cd3cb428db58df7a87682b7440e6599cb56f0..24f85d6635fce1bcd806aff172a7d6afb4535de8 100644
--- a/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
+++ b/base/android/java/src/org/chromium/base/ApiCompatibilityUtils.java
@@ -26,6 +26,7 @@ import android.os.Build;
import android.os.PowerManager;
import android.os.Process;
import android.os.StatFs;
+import android.os.StrictMode;
import android.os.UserManager;
import android.provider.Settings;
import android.text.Html;
@@ -446,10 +447,15 @@ public class ApiCompatibilityUtils {
*/
@SuppressWarnings("deprecation")
public static Drawable getDrawable(Resources res, int id) throws NotFoundException {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- return res.getDrawable(id, null);
- } else {
- return res.getDrawable(id);
+ StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
+ try {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
+ return res.getDrawable(id, null);
+ } else {
+ return res.getDrawable(id);
+ }
+ } 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