Restrict addressOf() API to non-movable primitive arrays

Returning a native pointer to object arrays can lead to a lot of issues.
Some of them are listed in the bug.

Test: manual
Bug: 208920634
Change-Id: I75153bf90eb3c054fb299cceabb2639073976bf4
diff --git a/runtime/native/dalvik_system_VMRuntime.cc b/runtime/native/dalvik_system_VMRuntime.cc
index c7996b5..db5d420 100644
--- a/runtime/native/dalvik_system_VMRuntime.cc
+++ b/runtime/native/dalvik_system_VMRuntime.cc
@@ -161,6 +161,10 @@
     ThrowIllegalArgumentException("not an array");
     return 0;
   }
+  if (array->IsObjectArray()) {
+    ThrowIllegalArgumentException("not a primitive array");
+    return 0;
+  }
   if (Runtime::Current()->GetHeap()->IsMovableObject(array)) {
     ThrowRuntimeException("Trying to get address of movable array object");
     return 0;