Merge "Make sure StrictMode allows disk reads when calling isThreadInProcess." into nyc-mr1-dev

This commit is contained in:
Tim Murray
2016-07-16 19:14:29 +00:00
committed by Android (Google) Code Review

View File

@@ -1263,6 +1263,7 @@ public class Process {
* @hide
*/
public static final boolean isThreadInProcess(int tid, int pid) {
StrictMode.ThreadPolicy oldPolicy = StrictMode.allowThreadDiskReads();
try {
if (Os.access("/proc/" + tid + "/task/" + pid, OsConstants.F_OK)) {
return true;
@@ -1271,6 +1272,9 @@ public class Process {
}
} catch (Exception e) {
return false;
} finally {
StrictMode.setThreadPolicy(oldPolicy);
}
}
}