user545199
user545199

Reputation:

Unsafe class in Android?

Do the Android Dalvik standard libraries have any class similar to the undocumented class sun.misc.Unsafe in Java SE which allows direct access to memory.

Upvotes: 9

Views: 3742

Answers (3)

mhansen
mhansen

Reputation: 1141

Yes, Android has sun.misc.Unsafe, but the interface is a little different from OpenJDK: https://cs.android.com/android/platform/superproject/main/+/main:libcore/ojluni/src/main/java/sun/misc/Unsafe.java

Upvotes: 0

fadden
fadden

Reputation: 52313

Android implements parts of sun.misc.Unsafe, primarily to support the JSR-166 concurrency classes. It's not part of the Android API.

Upvotes: 5

Andrew White
Andrew White

Reputation: 53496

It has the JNI bridge which could allow for just about anything but it's not "unsafe" since you have to code that into your app. As far as I know there is no exposed way to get out of the JVM sandbox (at least not without finding an exploit).

Upvotes: 3

Related Questions