Commit 11d50aa8 authored by Andrew Grieve's avatar Andrew Grieve Committed by Commit Bot

Android: Stop using reflection for Process.isIsolated()

Change-Id: Ib441c5bd3ce3dec875e3403d8bf7eb1512dfdbbb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1819349Reviewed-by: default avatarRichard Coles <torne@chromium.org>
Commit-Queue: Andrew Grieve <agrieve@chromium.org>
Auto-Submit: Andrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#699080}
parent 5a84cae0
......@@ -131,14 +131,10 @@ public class ContextUtils {
/**
* @return Whether the process is isolated.
*/
@SuppressWarnings("NewApi")
public static boolean isIsolatedProcess() {
try {
return (Boolean) Process.class.getMethod("isIsolated").invoke(null);
} catch (Exception e) { // No multi-catch below API level 19 for reflection exceptions.
// If fallback logic is ever needed, refer to:
// https://chromium-review.googlesource.com/c/chromium/src/+/905563/1
throw new RuntimeException(e);
}
// Was not made visible until Android P, but the method has always been there.
return Process.isIsolated();
}
/** @return The name of the current process. E.g. "org.chromium.chrome:privileged_process0". */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment