Replace native Process getpid/getuid with calls to libcore equivalents.
The Process natives were getting called were getting called while
handling a jdwp packet before the vm had a chance to register them.
(cherry-pick of 5bce6a308fc8a3c1e449cf905b8b6e8ace4ef3e2.)
Change-Id: Ia2b4f79b11e427283a712b2d0c52948f394640bf
diff --git a/core/java/android/os/Process.java b/core/java/android/os/Process.java
index 476b4ea..0e38ebc 100644
--- a/core/java/android/os/Process.java
+++ b/core/java/android/os/Process.java
@@ -27,6 +27,8 @@
import java.io.OutputStreamWriter;
import java.util.ArrayList;
+import libcore.io.Libcore;
+
/*package*/ class ZygoteStartFailedEx extends Exception {
/**
* Something prevented the zygote process startup from happening normally
@@ -647,7 +649,9 @@
* Returns the identifier of this process, which can be used with
* {@link #killProcess} and {@link #sendSignal}.
*/
- public static final native int myPid();
+ public static final int myPid() {
+ return Libcore.os.getpid();
+ }
/**
* Returns the identifier of the calling thread, which be used with
@@ -661,7 +665,9 @@
* app-specific sandbox. It is different from {@link #myUserHandle} in that
* a uid identifies a specific app sandbox in a specific user.
*/
- public static final native int myUid();
+ public static final int myUid() {
+ return Libcore.os.getuid();
+ }
/**
* Returns this process's user handle. This is the